aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.WebDashboard/ApiClient.js
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-03-24 23:23:42 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-03-24 23:23:42 -0400
commit9b41a3d35c81596e61780413361e5a0c1d4e1065 (patch)
treeff67f43048d0f66f3bbda9902c98b14e23fd7417 /MediaBrowser.WebDashboard/ApiClient.js
parent8b32e3292a8ce0e0b59cfd807e4c922375cb0ed0 (diff)
update to latest js api client
Diffstat (limited to 'MediaBrowser.WebDashboard/ApiClient.js')
-rw-r--r--MediaBrowser.WebDashboard/ApiClient.js69
1 files changed, 66 insertions, 3 deletions
diff --git a/MediaBrowser.WebDashboard/ApiClient.js b/MediaBrowser.WebDashboard/ApiClient.js
index 1d2d18006..ebd4f8a27 100644
--- a/MediaBrowser.WebDashboard/ApiClient.js
+++ b/MediaBrowser.WebDashboard/ApiClient.js
@@ -1571,7 +1571,70 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
dataType: "json"
});
};
- };
+
+ /**
+ * Reports progress viewing an item
+ * @param {String} userId
+ * @param {String} itemId
+ */
+ self.reportPlaybackProgress = function (userId, itemId, positionTicks) {
+
+ if (!userId) {
+ throw new Error("null userId");
+ }
+
+ if (!itemId) {
+ throw new Error("null itemId");
+ }
+
+ var params = {
+ };
+
+ if (positionTicks) {
+ params.positionTicks = positionTicks;
+ }
+
+ var url = self.getUrl("Users/" + userId + "/PlayingItems/" + itemId + "/Progress", params);
+
+ return self.ajax({
+ type: "POST",
+ url: url,
+ dataType: "json"
+ });
+ };
+
+
+ /**
+ * Reports a user has stopped playing an item
+ * @param {String} userId
+ * @param {String} itemId
+ */
+ self.reportPlaybackStopped = function (userId, itemId, positionTicks) {
+
+ if (!userId) {
+ throw new Error("null userId");
+ }
+
+ if (!itemId) {
+ throw new Error("null itemId");
+ }
+
+ var params = {
+ };
+
+ if (positionTicks) {
+ params.positionTicks = positionTicks;
+ }
+
+ var url = self.getUrl("Users/" + userId + "/PlayingItems/" + itemId, params);
+
+ return self.ajax({
+ type: "DELETE",
+ url: url,
+ dataType: "json"
+ });
+ };
+ }
}(jQuery, navigator, JSON, window.WebSocket, setTimeout);
@@ -1669,7 +1732,7 @@ MediaBrowser.SHA1 = function (msg) {
var word_array = new Array();
for (i = 0; i < msg_len - 3; i += 4) {
j = msg.charCodeAt(i) << 24 | msg.charCodeAt(i + 1) << 16 |
- msg.charCodeAt(i + 2) << 8 | msg.charCodeAt(i + 3);
+ msg.charCodeAt(i + 2) << 8 | msg.charCodeAt(i + 3);
word_array.push(j);
}
@@ -1756,4 +1819,4 @@ MediaBrowser.SHA1 = function (msg) {
var temp = cvt_hex(H0) + cvt_hex(H1) + cvt_hex(H2) + cvt_hex(H3) + cvt_hex(H4);
return temp.toLowerCase();
-}; \ No newline at end of file
+}