From 643899ce494a81b5bf31066b40aa8eb72607b5a2 Mon Sep 17 00:00:00 2001 From: RickDB Date: Mon, 17 Jul 2017 12:30:12 +0200 Subject: [PATCH 01/10] Updated playcount check in KodiMonitor, if playcount was empty / null it would incorrectly mark it as watched. While updating play state make sure offset never exceeds item duration. --- resources/lib/itemtypes.py | 6 ++++++ resources/lib/kodimonitor.py | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) 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') From 3cb4b538876cc2a30a55d6e9d8fd2acad0d6d16d Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Wed, 2 Aug 2017 18:26:48 +0200 Subject: [PATCH 02/10] Add Kodi info screen for episodes in context menu --- 8356 | 0 FETCH_HEAD | 0 develop | 0 resources/language/resource.language.en_gb/strings.po | 5 +++++ resources/lib/PlexAPI.py | 2 ++ resources/lib/entrypoint.py | 1 + script-plex-connect-server.xml} | 0 7 files changed, 8 insertions(+) create mode 100644 8356 create mode 100644 FETCH_HEAD create mode 100644 develop create mode 100644 script-plex-connect-server.xml} diff --git a/8356 b/8356 new file mode 100644 index 00000000..e69de29b diff --git a/FETCH_HEAD b/FETCH_HEAD new file mode 100644 index 00000000..e69de29b diff --git a/develop b/develop new file mode 100644 index 00000000..e69de29b diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index 6a5d051c..a2297406 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -83,6 +83,11 @@ msgctxt "#30017" msgid "Unauthorized for PMS" msgstr "" +# Kodi context menu entry for movie and episode information screen +msgctxt "#30018" +msgid "Information" +msgstr "" + msgctxt "#30022" msgid "Advanced" msgstr "" diff --git a/resources/lib/PlexAPI.py b/resources/lib/PlexAPI.py index 6f1c1661..6b8773cd 100644 --- a/resources/lib/PlexAPI.py +++ b/resources/lib/PlexAPI.py @@ -2534,6 +2534,8 @@ class API(): # Expensive operation metadata['title'] = title listItem.setInfo('video', infoLabels=metadata) + # Add context menu entry for information screen + listItem.addContextMenuItems([(lang(30018), 'XBMC.Action(Info)',)]) return listItem def add_video_streams(self, listItem): diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py index eaf360fb..a72d3a9c 100644 --- a/resources/lib/entrypoint.py +++ b/resources/lib/entrypoint.py @@ -255,6 +255,7 @@ 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','')) + li.addContextMenuItems([(lang(30018), 'XBMC.Action(Info)',)]) for key, value in item['streamdetails'].iteritems(): for stream in value: li.addStreamInfo(key, stream) diff --git a/script-plex-connect-server.xml} b/script-plex-connect-server.xml} new file mode 100644 index 00000000..e69de29b From 18b2781210e8ad74e86fc2a281bbe3f87d2e62d0 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Wed, 2 Aug 2017 18:30:29 +0200 Subject: [PATCH 03/10] Revert "Add Kodi info screen for episodes in context menu" This reverts commit 3cb4b538876cc2a30a55d6e9d8fd2acad0d6d16d. --- 8356 | 0 FETCH_HEAD | 0 develop | 0 resources/language/resource.language.en_gb/strings.po | 5 ----- resources/lib/PlexAPI.py | 2 -- resources/lib/entrypoint.py | 1 - script-plex-connect-server.xml} | 0 7 files changed, 8 deletions(-) delete mode 100644 8356 delete mode 100644 FETCH_HEAD delete mode 100644 develop delete mode 100644 script-plex-connect-server.xml} diff --git a/8356 b/8356 deleted file mode 100644 index e69de29b..00000000 diff --git a/FETCH_HEAD b/FETCH_HEAD deleted file mode 100644 index e69de29b..00000000 diff --git a/develop b/develop deleted file mode 100644 index e69de29b..00000000 diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index a2297406..6a5d051c 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -83,11 +83,6 @@ msgctxt "#30017" msgid "Unauthorized for PMS" msgstr "" -# Kodi context menu entry for movie and episode information screen -msgctxt "#30018" -msgid "Information" -msgstr "" - msgctxt "#30022" msgid "Advanced" msgstr "" diff --git a/resources/lib/PlexAPI.py b/resources/lib/PlexAPI.py index 6b8773cd..6f1c1661 100644 --- a/resources/lib/PlexAPI.py +++ b/resources/lib/PlexAPI.py @@ -2534,8 +2534,6 @@ class API(): # Expensive operation metadata['title'] = title listItem.setInfo('video', infoLabels=metadata) - # Add context menu entry for information screen - listItem.addContextMenuItems([(lang(30018), 'XBMC.Action(Info)',)]) return listItem def add_video_streams(self, listItem): diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py index a72d3a9c..eaf360fb 100644 --- a/resources/lib/entrypoint.py +++ b/resources/lib/entrypoint.py @@ -255,7 +255,6 @@ 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','')) - li.addContextMenuItems([(lang(30018), 'XBMC.Action(Info)',)]) for key, value in item['streamdetails'].iteritems(): for stream in value: li.addStreamInfo(key, stream) diff --git a/script-plex-connect-server.xml} b/script-plex-connect-server.xml} deleted file mode 100644 index e69de29b..00000000 From 26f0c6e55652fa12cc1ad350fcb1a2f8450532df Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Wed, 2 Aug 2017 18:31:52 +0200 Subject: [PATCH 04/10] Add Kodi info screen for episodes in context menu --- resources/language/resource.language.en_gb/strings.po | 5 +++++ resources/lib/PlexAPI.py | 2 ++ resources/lib/entrypoint.py | 1 + 3 files changed, 8 insertions(+) diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index 6a5d051c..a2297406 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -83,6 +83,11 @@ msgctxt "#30017" msgid "Unauthorized for PMS" msgstr "" +# Kodi context menu entry for movie and episode information screen +msgctxt "#30018" +msgid "Information" +msgstr "" + msgctxt "#30022" msgid "Advanced" msgstr "" diff --git a/resources/lib/PlexAPI.py b/resources/lib/PlexAPI.py index 6f1c1661..6b8773cd 100644 --- a/resources/lib/PlexAPI.py +++ b/resources/lib/PlexAPI.py @@ -2534,6 +2534,8 @@ class API(): # Expensive operation metadata['title'] = title listItem.setInfo('video', infoLabels=metadata) + # Add context menu entry for information screen + listItem.addContextMenuItems([(lang(30018), 'XBMC.Action(Info)',)]) return listItem def add_video_streams(self, listItem): diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py index eaf360fb..a72d3a9c 100644 --- a/resources/lib/entrypoint.py +++ b/resources/lib/entrypoint.py @@ -255,6 +255,7 @@ 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','')) + li.addContextMenuItems([(lang(30018), 'XBMC.Action(Info)',)]) for key, value in item['streamdetails'].iteritems(): for stream in value: li.addStreamInfo(key, stream) From 64fe06400833cdf54d7743d47a32e294f3a4dc1a Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Wed, 2 Aug 2017 18:54:05 +0200 Subject: [PATCH 05/10] Fix Kodi TypeError with ListItems --- resources/lib/PlexAPI.py | 8 ++++++-- resources/lib/entrypoint.py | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/resources/lib/PlexAPI.py b/resources/lib/PlexAPI.py index 6b8773cd..930c2e1c 100644 --- a/resources/lib/PlexAPI.py +++ b/resources/lib/PlexAPI.py @@ -2534,8 +2534,12 @@ class API(): # Expensive operation metadata['title'] = title listItem.setInfo('video', infoLabels=metadata) - # Add context menu entry for information screen - listItem.addContextMenuItems([(lang(30018), 'XBMC.Action(Info)',)]) + try: + # Add context menu entry for information screen + listItem.addContextMenuItems([(lang(30018), '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 a72d3a9c..2c83ba1d 100644 --- a/resources/lib/entrypoint.py +++ b/resources/lib/entrypoint.py @@ -255,7 +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','')) - li.addContextMenuItems([(lang(30018), 'XBMC.Action(Info)',)]) + try: + li.addContextMenuItems([(lang(30018), 'XBMC.Action(Info)',)]) + except TypeError: + # Kodi fuck-up + pass for key, value in item['streamdetails'].iteritems(): for stream in value: li.addStreamInfo(key, stream) From c3a6bd99b677459474b85d999cb443a656b8d53a Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Wed, 2 Aug 2017 19:07:29 +0200 Subject: [PATCH 06/10] Fix PKC asking for trailers not working - Fixes #328 --- resources/lib/playbackutils.py | 1 + 1 file changed, 1 insertion(+) 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! From 61ea145d496ea893a7410e6c7079601ab0c3aadb Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Wed, 2 Aug 2017 19:57:53 +0200 Subject: [PATCH 07/10] Update addon.xml --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index 105a8729..04d6d22e 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + From e5d4e44951a850301dc4d11224d9867d6a1fd298 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Wed, 2 Aug 2017 20:01:13 +0200 Subject: [PATCH 08/10] Change string ID --- resources/language/resource.language.en_gb/strings.po | 10 +++++----- resources/lib/PlexAPI.py | 2 +- resources/lib/entrypoint.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index a2297406..018cfd44 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -83,11 +83,6 @@ msgctxt "#30017" msgid "Unauthorized for PMS" msgstr "" -# Kodi context menu entry for movie and episode information screen -msgctxt "#30018" -msgid "Information" -msgstr "" - msgctxt "#30022" msgid "Advanced" msgstr "" @@ -108,6 +103,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 930c2e1c..65db0967 100644 --- a/resources/lib/PlexAPI.py +++ b/resources/lib/PlexAPI.py @@ -2536,7 +2536,7 @@ class API(): listItem.setInfo('video', infoLabels=metadata) try: # Add context menu entry for information screen - listItem.addContextMenuItems([(lang(30018), 'XBMC.Action(Info)',)]) + listItem.addContextMenuItems([(lang(30032), 'XBMC.Action(Info)',)]) except TypeError: # Kodi fuck-up pass diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py index 2c83ba1d..5dfc93d2 100644 --- a/resources/lib/entrypoint.py +++ b/resources/lib/entrypoint.py @@ -256,7 +256,7 @@ def createListItem(item, appendShowTitle=False, appendSxxExx=False): li.setProperty('dbid', str(item['episodeid'])) li.setProperty('fanart_image', item['art'].get('tvshow.fanart','')) try: - li.addContextMenuItems([(lang(30018), 'XBMC.Action(Info)',)]) + li.addContextMenuItems([(lang(30032), 'XBMC.Action(Info)',)]) except TypeError: # Kodi fuck-up pass From 5a978bd98a65a59aa40a48fc0e9b7b4f2038280e Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Wed, 2 Aug 2017 20:06:18 +0200 Subject: [PATCH 09/10] Update German --- resources/language/resource.language.de_DE/strings.po | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/resources/language/resource.language.de_DE/strings.po b/resources/language/resource.language.de_DE/strings.po index 82c207ff..356af051 100644 --- a/resources/language/resource.language.de_DE/strings.po +++ b/resources/language/resource.language.de_DE/strings.po @@ -104,6 +104,11 @@ msgctxt "#30031" msgid "I own this Plex Media Server" msgstr "Dieser Plex Media Server gehört mir" +# Kodi context menu entry for movie and episode information screen +msgctxt "#30032" +msgid "Information" +msgstr "Informationen" + msgctxt "#30035" msgid "Number of recent Music Albums to show:" msgstr "Anzahl anzuzeigender zuletzt hinzugefügter Alben:" From 630b848f6e0960911f9dd8d04e42e7beb79844e3 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Wed, 2 Aug 2017 20:09:02 +0200 Subject: [PATCH 10/10] Version bump --- README.md | 2 +- addon.xml | 8 +++++++- changelog.txt | 6 ++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dbae4777..a5d41149 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![stable version](https://img.shields.io/badge/stable_version-1.8.5-blue.svg?maxAge=60&style=flat) ](https://dl.bintray.com/croneter/PlexKodiConnect/bin/repository.plexkodiconnect/repository.plexkodiconnect-1.0.0.zip) -[![beta version](https://img.shields.io/badge/beta_version-1.8.5-red.svg?maxAge=60&style=flat) ](https://dl.bintray.com/croneter/PlexKodiConnect_BETA/bin-BETA/repository.plexkodiconnectbeta/repository.plexkodiconnectbeta-1.0.0.zip) +[![beta version](https://img.shields.io/badge/beta_version-1.8.7-red.svg?maxAge=60&style=flat) ](https://dl.bintray.com/croneter/PlexKodiConnect_BETA/bin-BETA/repository.plexkodiconnectbeta/repository.plexkodiconnectbeta-1.0.0.zip) [![Installation](https://img.shields.io/badge/wiki-installation-brightgreen.svg?maxAge=60&style=flat)](https://github.com/croneter/PlexKodiConnect/wiki/Installation) [![FAQ](https://img.shields.io/badge/wiki-FAQ-brightgreen.svg?maxAge=60&style=flat)](https://github.com/croneter/PlexKodiConnect/wiki/faq) diff --git a/addon.xml b/addon.xml index 04d6d22e..9499dd5f 100644 --- a/addon.xml +++ b/addon.xml @@ -59,7 +59,13 @@ Indbygget Integration af Plex i Kodi Tilslut Kodi til din Plex Media Server. Dette plugin forudsætter, at du administrere alle dine videoer med Plex (og ikke med Kodi). Du kan miste data som allerede er gemt i Kodi video og musik-databaser (dette plugin ændrer direkte i dem). Brug på eget ansvar! Brug på eget ansvar - version 1.8.6: + version 1.8.7: +- Some fixes to playstate reporting, thanks @RickDB +- Add Kodi info screen for episodes in context menu +- Fix PKC asking for trailers not working +- Fix PKC not automatically updating + +version 1.8.6: - Portuguese translation, thanks @goncalo532 - Updated other translations diff --git a/changelog.txt b/changelog.txt index d59f84f0..6213c72e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,9 @@ +version 1.8.7: +- Some fixes to playstate reporting, thanks @RickDB +- Add Kodi info screen for episodes in context menu +- Fix PKC asking for trailers not working +- Fix PKC not automatically updating + version 1.8.6: - Portuguese translation, thanks @goncalo532 - Updated other translations