diff --git a/addon.xml b/addon.xml index 105a8729..04d6d22e 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index 4cdd8da2..b7852fe5 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -128,6 +128,11 @@ msgctxt "#30031" msgid "I own this Plex Media Server" msgstr "" +# Kodi context menu entry for movie and episode information screen +msgctxt "#30032" +msgid "Information" +msgstr "" + msgctxt "#30035" msgid "Number of recent Music Albums to show:" msgstr "" diff --git a/resources/lib/PlexAPI.py b/resources/lib/PlexAPI.py index dccf885e..e089ebf6 100644 --- a/resources/lib/PlexAPI.py +++ b/resources/lib/PlexAPI.py @@ -1468,6 +1468,12 @@ class API(): # Expensive operation metadata['title'] = title listItem.setInfo('video', infoLabels=metadata) + try: + # Add context menu entry for information screen + listItem.addContextMenuItems([(lang(30032), 'XBMC.Action(Info)',)]) + except TypeError: + # Kodi fuck-up + pass return listItem def add_video_streams(self, listItem): diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py index c8a5b4ca..ccd5170e 100644 --- a/resources/lib/entrypoint.py +++ b/resources/lib/entrypoint.py @@ -255,6 +255,11 @@ def createListItem(item, appendShowTitle=False, appendSxxExx=False): li.setArt({'icon': 'DefaultTVShows.png'}) li.setProperty('dbid', str(item['episodeid'])) li.setProperty('fanart_image', item['art'].get('tvshow.fanart','')) + try: + li.addContextMenuItems([(lang(30032), 'XBMC.Action(Info)',)]) + except TypeError: + # Kodi fuck-up + pass for key, value in item['streamdetails'].iteritems(): for stream in value: li.addStreamInfo(key, stream) diff --git a/resources/lib/itemtypes.py b/resources/lib/itemtypes.py index 4cfa311a..f244844b 100644 --- a/resources/lib/itemtypes.py +++ b/resources/lib/itemtypes.py @@ -158,6 +158,12 @@ class Items(object): # If the playback was stopped, check whether we need to increment the # playcount. PMS won't tell us the playcount via websockets if item['state'] in ('stopped', 'ended'): + + # If offset exceeds duration skip update + if item['viewOffset'] > item['duration']: + log.error("Error while updating play state, viewOffset exceeded duration") + return + complete = float(item['viewOffset']) / float(item['duration']) log.info('Item %s stopped with completion rate %s percent.' 'Mark item played at %s percent.' diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py index 579c9033..fde49a13 100644 --- a/resources/lib/kodimonitor.py +++ b/resources/lib/kodimonitor.py @@ -92,6 +92,7 @@ class KodiMonitor(Monitor): # Manually marking as watched/unwatched playcount = data.get('playcount') item = data.get('item') + try: kodiid = item['id'] item_type = item['type'] @@ -114,7 +115,7 @@ class KodiMonitor(Monitor): window('plex_skipWatched%s' % itemid, clear=True) else: # notify the server - if playcount != 0: + if playcount > 0: scrobble(itemid, 'watched') else: scrobble(itemid, 'unwatched') diff --git a/resources/lib/playbackutils.py b/resources/lib/playbackutils.py index 1ca853d4..388b0dc5 100644 --- a/resources/lib/playbackutils.py +++ b/resources/lib/playbackutils.py @@ -129,6 +129,7 @@ class PlaybackUtils(): trailers = xbmcgui.Dialog().yesno( lang(29999), "Play trailers?") + trailers = True if trailers else False else: trailers = True # Post to the PMS. REUSE THE PLAYQUEUE!