diff --git a/ApiClient.js b/ApiClient.js
index 97a443e844..8e64e4300d 100644
--- a/ApiClient.js
+++ b/ApiClient.js
@@ -2731,16 +2731,42 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
});
};
- /**
- * Marks an item as played or unplayed
- * This should not be used to update playstate following playback.
- * There are separate playstate check-in methods for that. This should be used for a
- * separate option to reset playstate.
- * @param {String} userId
- * @param {String} itemId
- * @param {Boolean} wasPlayed
- */
- self.updatePlayedStatus = function (userId, itemId, wasPlayed) {
+ self.getDateParamValue = function (date) {
+ function formatDigit(i) {
+ return i < 10 ? "0" + i : i;
+ }
+
+ var d = date;
+
+ return "" + d.getFullYear() + formatDigit(d.getMonth() + 1) + formatDigit(d.getDate()) + formatDigit(d.getHours()) + formatDigit(d.getMinutes()) + formatDigit(d.getSeconds());
+ };
+
+ self.markPlayed = function (userId, itemId, date) {
+
+ if (!userId) {
+ throw new Error("null userId");
+ }
+
+ if (!itemId) {
+ throw new Error("null itemId");
+ }
+
+ var options = {};
+
+ if (date) {
+ options.DatePlayed = self.getDateParamValue(date);
+ }
+
+ var url = self.getUrl("Users/" + userId + "/PlayedItems/" + itemId, options);
+
+ return self.ajax({
+ type: "POST",
+ url: url,
+ dataType: "json"
+ });
+ };
+
+ self.markUnplayed = function (userId, itemId) {
if (!userId) {
throw new Error("null userId");
@@ -2752,10 +2778,8 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
var url = self.getUrl("Users/" + userId + "/PlayedItems/" + itemId);
- var method = wasPlayed ? "POST" : "DELETE";
-
return self.ajax({
- type: method,
+ type: "DELETE",
url: url,
dataType: "json"
});
diff --git a/dashboard-ui/gamesrecommended.html b/dashboard-ui/gamesrecommended.html
index df718d2f7e..904cefe129 100644
--- a/dashboard-ui/gamesrecommended.html
+++ b/dashboard-ui/gamesrecommended.html
@@ -16,7 +16,7 @@
-
+
@@ -27,13 +27,6 @@
-
-
|
diff --git a/dashboard-ui/scripts/Itemdetailpage.js b/dashboard-ui/scripts/Itemdetailpage.js
index b6d1bcad3d..219d6eba59 100644
--- a/dashboard-ui/scripts/Itemdetailpage.js
+++ b/dashboard-ui/scripts/Itemdetailpage.js
@@ -74,7 +74,7 @@
$('#playButtonContainer', page).show();
$('#playExternalButtonContainer', page).hide();
}
-
+
$('#btnPlayExternal', page).attr('href', url || '#');
} else {
@@ -1045,6 +1045,11 @@
LibraryBrowser.showPlayMenu(this, currentItem.Id, currentItem.Type, mediaType, userdata.PlaybackPositionTicks);
});
+ $('#btnPlayExternal', page).on('click', function () {
+
+ ApiClient.markPlayed(Dashboard.getCurrentUserId(), currentItem.Id, new Date());
+ });
+
$('#btnEdit', page).on('click', function () {
Dashboard.navigate("edititemmetadata.html?id=" + currentItem.Id);
diff --git a/dashboard-ui/scripts/gamesrecommendedpage.js b/dashboard-ui/scripts/gamesrecommendedpage.js
index 7cc043e88a..dc0bd242cf 100644
--- a/dashboard-ui/scripts/gamesrecommendedpage.js
+++ b/dashboard-ui/scripts/gamesrecommendedpage.js
@@ -10,16 +10,14 @@
SortOrder: "Descending",
MediaTypes: "Game",
Limit: 5,
- Recursive: true,
- Fields: "PrimaryImageAspectRatio",
- Filters: "IsUnplayed"
+ Recursive: true
};
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
$('#recentlyAddedItems', page).html(LibraryBrowser.getPosterViewHtml({
items: result.Items,
- useAverageAspectRatio: true,
+ useAverageAspectRatio: false,
showNewIndicator: false,
transparent: true,
borderless: true
@@ -34,7 +32,6 @@
MediaTypes: "Game",
Limit: 5,
Recursive: true,
- Fields: "PrimaryImageAspectRatio",
Filters: "IsPlayed"
};
@@ -48,35 +45,7 @@
$('#recentlyPlayedItems', page).html(LibraryBrowser.getPosterViewHtml({
items: result.Items,
- useAverageAspectRatio: true,
- transparent: true,
- borderless: true
- }));
-
- });
-
- options = {
-
- SortBy: "PlayCount",
- SortOrder: "Descending",
- MediaTypes: "Game",
- Limit: 5,
- Recursive: true,
- Fields: "PrimaryImageAspectRatio",
- Filters: "IsPlayed"
- };
-
- ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
-
- if (result.Items.length) {
- $('#frequentlyPlayedSection', page).show();
- } else {
- $('#frequentlyPlayedSection', page).hide();
- }
-
- $('#frequentlyPlayedItems', page).html(LibraryBrowser.getPosterViewHtml({
- items: result.Items,
- useAverageAspectRatio: true,
+ useAverageAspectRatio: false,
transparent: true,
borderless: true
}));
diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js
index b8cb5ff046..b4d19ba04a 100644
--- a/dashboard-ui/scripts/librarybrowser.js
+++ b/dashboard-ui/scripts/librarybrowser.js
@@ -1519,7 +1519,11 @@
var markAsPlayed = $link.hasClass('imgPlayedOff');
- ApiClient.updatePlayedStatus(Dashboard.getCurrentUserId(), id, markAsPlayed);
+ if (markAsPlayed) {
+ ApiClient.markPlayed(Dashboard.getCurrentUserId(), id);
+ } else {
+ ApiClient.markUnplayed(Dashboard.getCurrentUserId(), id);
+ }
if (markAsPlayed) {
link.src = "css/images/userdata/playedon.png";
diff --git a/packages.config b/packages.config
index 9c48b38095..02daa2cae4 100644
--- a/packages.config
+++ b/packages.config
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file