jf-roku/source/api/UserLibrary.brs

34 lines
1.2 KiB
Plaintext
Raw Normal View History

2019-03-13 02:09:17 +00:00
function MarkItemFavorite(id as String)
url = Substitute("Users/{0}/FavoriteItems/{1}", get_setting("active_user"), id)
resp = APIRequest(url)
return postJson(resp)
end function
2019-03-13 03:15:24 +00:00
function UnmarkItemFavorite(id as String)
url = Substitute("Users/{0}/FavoriteItems/{1}", get_setting("active_user"), id)
resp = APIRequest(url)
resp.setRequest("DELETE")
return getJson(resp)
end function
2019-03-14 03:01:05 +00:00
function MarkItemWatched(id as String)
date = CreateObject("roDateTime")
dateStr = stri(date.getYear()).trim()
dateStr += leftPad(stri(date.getMonth()).trim(), "0", 2)
dateStr += leftPad(stri(date.getDayOfMonth()).trim(), "0", 2)
dateStr += leftPad(stri(date.getHours()).trim(), "0", 2)
dateStr += leftPad(stri(date.getMinutes()).trim(), "0", 2)
dateStr += leftPad(stri(date.getSeconds()).trim(), "0", 2)
url = Substitute("Users/{0}/PlayedItems/{1}", get_setting("active_user"), id)
resp = APIRequest(url, {"DatePlayed": dateStr})
data = postJson(resp)
end function
function UnmarkItemWatched(id as String)
url = Substitute("Users/{0}/PlayedItems/{1}", get_setting("active_user"), id)
resp = APIRequest(url)
resp.setRequest("DELETE")
return getJson(resp)
end function