diff --git a/src/assets/js/plex/PlexServer.js b/src/assets/js/plex/PlexServer.js index 1d2048e4..06f47904 100644 --- a/src/assets/js/plex/PlexServer.js +++ b/src/assets/js/plex/PlexServer.js @@ -157,6 +157,13 @@ module.exports = function PlexServer () { return handleMetadata(result, that, callback) }) } + this.markWatchedByRatingKey = function (ratingKey, callback) { + console.log('Marking ' + ratingKey + ' as watched') + this.hitApi('/:/scrobble', { + identifier: 'com.plexapp.plugins.library', + key: ratingKey + }, callback) + } this.getUrlForLibraryLoc = function (location, width, height, blur) { if (!(blur > 0)) { blur = 0 diff --git a/src/components/application/plexbrowser.vue b/src/components/application/plexbrowser.vue index c9dee508..9e411387 100644 --- a/src/components/application/plexbrowser.vue +++ b/src/components/application/plexbrowser.vue @@ -161,15 +161,7 @@ }, name: 'plexbrowser', mounted () { - - if (this.lastServer){ - this.lastServer.getOnDeck(0, 10, (result) => { - if (result) { - this.onDeck = result - } - }) - } - + this.updateOnDeck() }, methods: { setContent (content) { @@ -183,7 +175,16 @@ return true } return false - }, + }, + updateOnDeck () { + if (this.lastServer){ + this.lastServer.getOnDeck(0, 10, (result) => { + if (result) { + this.onDeck = result + } + }) + } + }, subsetOnDeck (size) { if (!this.onDeck || !this.onDeck.MediaContainer || !this.onDeck.MediaContainer.Metadata){ return [] @@ -191,6 +192,7 @@ return this.onDeck.MediaContainer.Metadata.slice(this.onDeckOffset, this.onDeckOffset + size) }, reset () { + this.updateOnDeck() this.browsingServer = false this.selectedItem = false this.results = [] diff --git a/src/components/application/plexbrowser/plexcontent.vue b/src/components/application/plexbrowser/plexcontent.vue index 7c9f5ca0..10cac7db 100644 --- a/src/components/application/plexbrowser/plexcontent.vue +++ b/src/components/application/plexbrowser/plexcontent.vue @@ -115,6 +115,9 @@
+ + Mark Watched + play_arrow Play @@ -334,6 +337,12 @@ } return this.parentData.MediaContainer.Metadata.slice(this.contents.index - 1,this.contents.index + size -1) }, + markWatched (content, mediaIndex) { + var that = this; + this.server.markWatchedByRatingKey(content.ratingKey, function () { + that.$parent.reset() + }) + }, playMedia (content, mediaIndex) { var callback = function(result){ console.log(result) @@ -351,9 +360,6 @@ callback: callback } ) - - - }, getDuration (dur){ return humanizeDuration(dur, { diff --git a/src/components/application/plexbrowser/plexserver.vue b/src/components/application/plexbrowser/plexserver.vue index e1cf6eef..9e7d0cbb 100644 --- a/src/components/application/plexbrowser/plexserver.vue +++ b/src/components/application/plexbrowser/plexserver.vue @@ -118,12 +118,7 @@ this.setBackground() } }) - this.server.getOnDeck(0, 10, (result) => { - if (result) { - this.onDeck = result - } - }) - + this.updateOnDeck() }, beforeDestroy () { @@ -171,7 +166,14 @@ }, setLibrary (library) { this.browsingLibrary = library - }, + }, + updateOnDeck() { + this.server.getOnDeck(0, 10, (result) => { + if (result) { + this.onDeck = result + } + }) + }, onDeckDown (){ if (!this.onDeck || !this.onDeck.MediaContainer || !this.onDeck.MediaContainer.Metadata){ return false @@ -268,6 +270,7 @@ return this.server.getUrlForLibraryLoc(object.grandparentThumb, w / 3, h / 4) }, reset () { + this.updateOnDeck() this.browsingLibrary = false this.selectedItem = false this.setBackground()