From b1c8504f8d2df3fadbb6590b5b9cf2f559ec8714 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Mon, 22 May 2017 21:45:29 +0200 Subject: [PATCH 01/11] Update German --- resources/language/resource.language.de_DE/strings.po | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/resources/language/resource.language.de_DE/strings.po b/resources/language/resource.language.de_DE/strings.po index aa898677..48c73a5f 100644 --- a/resources/language/resource.language.de_DE/strings.po +++ b/resources/language/resource.language.de_DE/strings.po @@ -2098,3 +2098,13 @@ msgstr "Sync" msgctxt "#39715" msgid "items" msgstr "Einträge" + +# Error message if an xml, e.g. advancedsettings.xml cannot be parsed (xml is +# screwed up; formated the wrong way). Do NOT replace {0} and {1}! +msgctxt "#39716" +msgid "" +"Kodi cannot parse {0}. PKC will not function correctly. Please visit {1} and" +" correct your file!" +msgstr "" +"Kodi kann die Datei {0} nicht übersetzen. PKC wird nicht richtig " +"funktionieren. Bitte {1} besuchen und die Datei korrigieren!" From 9104a56db009e052067e0aad08c60a6ef7bcc22c Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Thu, 25 May 2017 13:15:54 +0200 Subject: [PATCH 02/11] Fix playback stop not being recognized by the PMS --- resources/lib/plexbmchelper/subscribers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lib/plexbmchelper/subscribers.py b/resources/lib/plexbmchelper/subscribers.py index 0f8c56e4..4ac31483 100644 --- a/resources/lib/plexbmchelper/subscribers.py +++ b/resources/lib/plexbmchelper/subscribers.py @@ -167,7 +167,7 @@ class SubscriptionManager: # Process the players we have left (to signal a stop) for typus, p in self.lastplayers.iteritems(): self.lastinfo[typus]['state'] = 'stopped' - # self._sendNotification(self.lastinfo[typus]) + self._sendNotification(self.lastinfo[typus]) def _sendNotification(self, info): xargs = getXArgsDeviceInfo() From 5be7a5be8b9976ed5252cb35ce18dd15c9026ce3 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Thu, 25 May 2017 13:57:32 +0200 Subject: [PATCH 03/11] Remove obsolete code --- resources/lib/player.py | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/resources/lib/player.py b/resources/lib/player.py index 5b465ae5..d7d74006 100644 --- a/resources/lib/player.py +++ b/resources/lib/player.py @@ -362,32 +362,6 @@ class Player(xbmc.Player): None, data['playcount'] + 1, DateToKodi(getUnixTimestamp())) - # Send the delete action to the server. - offerDelete = False - - if media_type == "Episode" and settings('deleteTV') == "true": - offerDelete = True - elif media_type == "Movie" and settings('deleteMovies') == "true": - offerDelete = True - - if settings('offerDelete') != "true": - # Delete could be disabled, even if the subsetting is enabled. - offerDelete = False - - # Plex: never delete - offerDelete = False - if percentComplete >= markPlayed and offerDelete: - resp = xbmcgui.Dialog().yesno( - lang(30091), - lang(33015), - autoclose=120000) - if not resp: - log.info("User skipped deletion.") - continue - - url = "{server}/emby/Items/%s?format=json" % itemid - log.info("Deleting request: %s" % itemid) - self.doUtils(url, action_type="DELETE") # Clean the WINDOW properties for filename in self.played_info: From 0c0cf342df85fd58492853592ee66c0b43fdaa16 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Thu, 25 May 2017 13:58:15 +0200 Subject: [PATCH 04/11] Simplify loop --- resources/lib/player.py | 65 +++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/resources/lib/player.py b/resources/lib/player.py index d7d74006..0a289bb8 100644 --- a/resources/lib/player.py +++ b/resources/lib/player.py @@ -326,42 +326,43 @@ class Player(xbmc.Player): # Process each items for item in self.played_info: data = self.played_info.get(item) - if data: - log.debug("Item path: %s" % item) - log.debug("Item data: %s" % data) + if not data: + continue + log.debug("Item path: %s" % item) + log.debug("Item data: %s" % data) - runtime = data['runtime'] - currentPosition = data['currentPosition'] - itemid = data['item_id'] - refresh_id = data['refresh_id'] - currentFile = data['currentfile'] - media_type = data['Type'] - playMethod = data['playmethod'] + runtime = data['runtime'] + currentPosition = data['currentPosition'] + itemid = data['item_id'] + refresh_id = data['refresh_id'] + currentFile = data['currentfile'] + media_type = data['Type'] + playMethod = data['playmethod'] - # Prevent manually mark as watched in Kodi monitor - window('plex_skipWatched%s' % itemid, value="true") + # Prevent manually mark as watched in Kodi monitor + window('plex_skipWatched%s' % itemid, value="true") - if currentPosition and runtime: - try: - percentComplete = float(currentPosition) / float(runtime) - except ZeroDivisionError: - # Runtime is 0. - percentComplete = 0 + if currentPosition and runtime: + try: + percentComplete = float(currentPosition) / float(runtime) + except ZeroDivisionError: + # Runtime is 0. + percentComplete = 0 - markPlayed = 0.90 - log.info("Percent complete: %s Mark played at: %s" - % (percentComplete, markPlayed)) - if percentComplete >= markPlayed: - # Tell Kodi that we've finished watching (Plex knows) - if (data['fileid'] is not None and - data['itemType'] in (v.KODI_TYPE_MOVIE, v.KODI_TYPE_EPISODE)): - with kodidb.GetKodiDB('video') as kodi_db: - kodi_db.addPlaystate( - data['fileid'], - None, - None, - data['playcount'] + 1, - DateToKodi(getUnixTimestamp())) + markPlayed = 0.90 + log.info("Percent complete: %s Mark played at: %s" + % (percentComplete, markPlayed)) + if percentComplete >= markPlayed: + # Tell Kodi that we've finished watching (Plex knows) + if (data['fileid'] is not None and + data['itemType'] in (v.KODI_TYPE_MOVIE, v.KODI_TYPE_EPISODE)): + with kodidb.GetKodiDB('video') as kodi_db: + kodi_db.addPlaystate( + data['fileid'], + None, + None, + data['playcount'] + 1, + DateToKodi(getUnixTimestamp())) # Clean the WINDOW properties for filename in self.played_info: From 74af562ada356c33c182d8a598cdae3a52a192b4 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Thu, 25 May 2017 14:00:30 +0200 Subject: [PATCH 05/11] Simplify loop --- resources/lib/player.py | 42 +++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/resources/lib/player.py b/resources/lib/player.py index 0a289bb8..e596c854 100644 --- a/resources/lib/player.py +++ b/resources/lib/player.py @@ -342,27 +342,29 @@ class Player(xbmc.Player): # Prevent manually mark as watched in Kodi monitor window('plex_skipWatched%s' % itemid, value="true") - if currentPosition and runtime: - try: - percentComplete = float(currentPosition) / float(runtime) - except ZeroDivisionError: - # Runtime is 0. - percentComplete = 0 + if not currentPosition or not runtime: + continue + try: + percentComplete = float(currentPosition) / float(runtime) + except ZeroDivisionError: + # Runtime is 0. + percentComplete = 0 - markPlayed = 0.90 - log.info("Percent complete: %s Mark played at: %s" - % (percentComplete, markPlayed)) - if percentComplete >= markPlayed: - # Tell Kodi that we've finished watching (Plex knows) - if (data['fileid'] is not None and - data['itemType'] in (v.KODI_TYPE_MOVIE, v.KODI_TYPE_EPISODE)): - with kodidb.GetKodiDB('video') as kodi_db: - kodi_db.addPlaystate( - data['fileid'], - None, - None, - data['playcount'] + 1, - DateToKodi(getUnixTimestamp())) + markPlayed = 0.90 + log.info("Percent complete: %s Mark played at: %s" + % (percentComplete, markPlayed)) + if percentComplete >= markPlayed: + # Tell Kodi that we've finished watching (Plex knows) + if (data['fileid'] is not None and + data['itemType'] in (v.KODI_TYPE_MOVIE, + v.KODI_TYPE_EPISODE)): + with kodidb.GetKodiDB('video') as kodi_db: + kodi_db.addPlaystate( + data['fileid'], + None, + None, + data['playcount'] + 1, + DateToKodi(getUnixTimestamp())) # Clean the WINDOW properties for filename in self.played_info: From cee2bfcc6c3933f1b0dcec383df9b3c3b025c0fc Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Thu, 25 May 2017 14:21:27 +0200 Subject: [PATCH 06/11] Better way to sync progress to another account - Partially fixes #297 --- resources/lib/PlexCompanion.py | 8 ++++++-- resources/lib/player.py | 2 +- resources/lib/playlist_func.py | 3 +++ resources/lib/playqueue.py | 3 +++ resources/lib/plexbmchelper/subscribers.py | 13 ++++++++++--- 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/resources/lib/PlexCompanion.py b/resources/lib/PlexCompanion.py index c172ca38..a16bf50e 100644 --- a/resources/lib/PlexCompanion.py +++ b/resources/lib/PlexCompanion.py @@ -78,7 +78,7 @@ class PlexCompanion(Thread): data = task['data'] # Get the token of the user flinging media (might be different one) - state.PLEX_TRANSIENT_TOKEN = data.get('token') + token = data.get('token') if task['action'] == 'alexa': # e.g. Alexa xml = GetPlexMetadata(data['key']) @@ -90,9 +90,11 @@ class PlexCompanion(Thread): api = API(xml[0]) if api.getType() == v.PLEX_TYPE_ALBUM: log.debug('Plex music album detected') - self.mgr.playqueue.init_playqueue_from_plex_children( + queue = self.mgr.playqueue.init_playqueue_from_plex_children( api.getRatingKey()) + queue.plex_transient_token = token else: + state.PLEX_TRANSIENT_TOKEN = token params = { 'mode': 'plex_node', 'key': '{server}%s' % data.get('key'), @@ -106,6 +108,7 @@ class PlexCompanion(Thread): elif (task['action'] == 'playlist' and data.get('address') == 'node.plexapp.com'): # E.g. watch later initiated by Companion + state.PLEX_TRANSIENT_TOKEN = token params = { 'mode': 'plex_node', 'key': '{server}%s' % data.get('key'), @@ -144,6 +147,7 @@ class PlexCompanion(Thread): ID, repeat=query.get('repeat'), offset=data.get('offset')) + playqueue.plex_transient_token = token def run(self): # Ensure that sockets will be closed no matter what diff --git a/resources/lib/player.py b/resources/lib/player.py index e596c854..1dafbe68 100644 --- a/resources/lib/player.py +++ b/resources/lib/player.py @@ -310,7 +310,7 @@ class Player(xbmc.Player): 'plex_forcetranscode'): window(item, clear=True) # We might have saved a transient token from a user flinging media via - # Companion + # Companion (if we could not use the playqueue to store the token) state.PLEX_TRANSIENT_TOKEN = None log.debug("Cleared playlist properties.") diff --git a/resources/lib/playlist_func.py b/resources/lib/playlist_func.py index fa439cde..f1371acd 100644 --- a/resources/lib/playlist_func.py +++ b/resources/lib/playlist_func.py @@ -29,6 +29,8 @@ class Playlist_Object_Baseclase(object): selectedItemOffset = None shuffled = 0 # [int], 0: not shuffled, 1: ??? 2: ??? repeat = 0 # [int], 0: not repeated, 1: ??? 2: ??? + # If Companion playback is initiated by another user + plex_transient_token = None def __repr__(self): answ = "<%s: " % (self.__class__.__name__) @@ -58,6 +60,7 @@ class Playlist_Object_Baseclase(object): self.selectedItemOffset = None self.shuffled = 0 self.repeat = 0 + self.plex_transient_token = None log.debug('Playlist cleared: %s' % self) def log_Kodi_playlist(self): diff --git a/resources/lib/playqueue.py b/resources/lib/playqueue.py index 6df21b0d..2420ca0a 100644 --- a/resources/lib/playqueue.py +++ b/resources/lib/playqueue.py @@ -78,6 +78,8 @@ class Playqueue(Thread): def init_playqueue_from_plex_children(self, plex_id): """ Init a new playqueue e.g. from an album. Alexa does this + + Returns the Playlist_Object """ xml = GetAllPlexChildren(plex_id) try: @@ -93,6 +95,7 @@ class Playqueue(Thread): PL.add_item_to_playlist(playqueue, i, plex_id=api.getRatingKey()) log.debug('Firing up Kodi player') Player().play(playqueue.kodi_pl, None, False, 0) + return playqueue def update_playqueue_from_PMS(self, playqueue, diff --git a/resources/lib/plexbmchelper/subscribers.py b/resources/lib/plexbmchelper/subscribers.py index 4ac31483..dcee3e57 100644 --- a/resources/lib/plexbmchelper/subscribers.py +++ b/resources/lib/plexbmchelper/subscribers.py @@ -123,6 +123,8 @@ class SubscriptionManager: ret += ' itemType="%s"' % info['itemType'] if state.PLEX_TRANSIENT_TOKEN: ret += ' token="%s"' % state.PLEX_TRANSIENT_TOKEN + elif info['plex_transient_token']: + ret += ' token="%s"' % info['plex_transient_token'] # Might need an update in the future if ptype == 'video': ret += ' subtitleStreamID="-1"' @@ -157,7 +159,7 @@ class SubscriptionManager: def notifyServer(self, players): for typus, p in players.iteritems(): info = self.playerprops[p.get('playerid')] - self._sendNotification(info) + self._sendNotification(info, int(p['playerid'])) self.lastinfo[typus] = info # Cross the one of the list try: @@ -167,9 +169,10 @@ class SubscriptionManager: # Process the players we have left (to signal a stop) for typus, p in self.lastplayers.iteritems(): self.lastinfo[typus]['state'] = 'stopped' - self._sendNotification(self.lastinfo[typus]) + self._sendNotification(self.lastinfo[typus], int(p['playerid'])) - def _sendNotification(self, info): + def _sendNotification(self, info, playerid): + playqueue = self.playqueue.playqueues[playerid] xargs = getXArgsDeviceInfo() params = { 'containerKey': self.containerKey or "/library/metadata/900000", @@ -181,6 +184,8 @@ class SubscriptionManager: } if state.PLEX_TRANSIENT_TOKEN: xargs['X-Plex-Token'] = state.PLEX_TRANSIENT_TOKEN + elif playqueue.plex_transient_token: + xargs['X-Plex-Token'] = playqueue.plex_transient_token if info.get('playQueueID'): params['containerKey'] = '/playQueues/%s' % info['playQueueID'] params['playQueueVersion'] = info['playQueueVersion'] @@ -272,6 +277,8 @@ class SubscriptionManager: info['volume'] = self.volume info['mute'] = self.mute + info['plex_transient_token'] = playqueue.plex_transient_token + return info From 35e1337b15d54997d5268051a8e3d52b4d4575cf Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Thu, 25 May 2017 14:22:27 +0200 Subject: [PATCH 07/11] Version bump --- README.md | 2 +- addon.xml | 8 ++++++-- changelog.txt | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 750a1a59..16b1e7f0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![stable version](https://img.shields.io/badge/stable_version-1.7.7-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.7.21-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.7.22-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 39c83f4d..0fe46a77 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + @@ -44,7 +44,11 @@ Gebruik op eigen risico 使用風險由您自己承擔 Usar a su propio riesgo - version 1.7.21 (beta only) + version 1.7.22 (beta only) +- Fix playback stop not being recognized by the PMS +- Better way to sync progress to another account + +version 1.7.21 (beta only) - Fix Playback and watched status not syncing - Fix PKC syncing progress to wrong account - Warn user if a xml cannot be parsed diff --git a/changelog.txt b/changelog.txt index 37b20604..454e1a44 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +version 1.7.22 (beta only) +- Fix playback stop not being recognized by the PMS +- Better way to sync progress to another account + version 1.7.21 (beta only) - Fix Playback and watched status not syncing - Fix PKC syncing progress to wrong account From 4af5080f31a0268e5673d5a7401cb9e32d342aa3 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Sat, 27 May 2017 11:39:57 +0200 Subject: [PATCH 08/11] Version bump --- README.md | 4 ++-- addon.xml | 11 +++++++++-- changelog.txt | 7 +++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 16b1e7f0..bb8869d7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -[![stable version](https://img.shields.io/badge/stable_version-1.7.7-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.7.22-red.svg?maxAge=60&style=flat) ](https://dl.bintray.com/croneter/PlexKodiConnect_BETA/bin-BETA/repository.plexkodiconnectbeta/repository.plexkodiconnectbeta-1.0.0.zip) +[![stable version](https://img.shields.io/badge/stable_version-1.8.0-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.0-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 0fe46a77..04fbf2a8 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + @@ -44,7 +44,14 @@ Gebruik op eigen risico 使用風險由您自己承擔 Usar a su propio riesgo - version 1.7.22 (beta only) + version 1.8.0 +Featuring: +- Major music overhaul: Direct Paths should now work! Many thanks @Memesa for the pointers! Don't forget to reset your database +- Big transcoding overhaul +- Many Plex Companion fixes +- Add support to Kodi 18.0-alpha1 (thanks @CotzaDev) + +version 1.7.22 (beta only) - Fix playback stop not being recognized by the PMS - Better way to sync progress to another account diff --git a/changelog.txt b/changelog.txt index 454e1a44..5b7d3fd1 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,10 @@ +version 1.8.0 +Featuring: +- Major music overhaul: Direct Paths should now work! Many thanks @Memesa for the pointers! Don't forget to reset your database +- Big transcoding overhaul +- Many Plex Companion fixes +- Add support to Kodi 18.0-alpha1 (thanks @CotzaDev) + version 1.7.22 (beta only) - Fix playback stop not being recognized by the PMS - Better way to sync progress to another account From 55d75d3d51742783d86bab975c6d0a52cf3eaad1 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Mon, 29 May 2017 10:51:26 +0200 Subject: [PATCH 09/11] Translate plex.tv login status in PKC settings --- resources/language/resource.language.en_gb/strings.po | 10 ++++++++++ resources/lib/PlexAPI.py | 2 +- resources/lib/entrypoint.py | 2 +- resources/lib/initialsetup.py | 4 ++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index aac7adc3..54cca5fc 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -1705,6 +1705,16 @@ msgctxt "#39225" msgid "Missing only" msgstr "" +# Message in the PKC settings if user has not logged in to plex.tv +msgctxt "#39226" +msgid "Not logged in to plex.tv" +msgstr "" + +# Message in the PKC settings if user is logged in to plex.tv +msgctxt "#39227" +msgid "Logged in to plex.tv" +msgstr "" + # Plex Artwork.py msgctxt "#39250" diff --git a/resources/lib/PlexAPI.py b/resources/lib/PlexAPI.py index 19e3d2cf..670bba42 100644 --- a/resources/lib/PlexAPI.py +++ b/resources/lib/PlexAPI.py @@ -208,7 +208,7 @@ class PlexAPI(): settings('plexHomeSize', homeSize) # Let Kodi log into plex.tv on startup from now on settings('myplexlogin', 'true') - settings('plex_status', value='Logged in to plex.tv') + settings('plex_status', value=lang(39227)) return result def CheckPlexTvSignin(self, identifier): diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py index 4745afea..eaf360fb 100644 --- a/resources/lib/entrypoint.py +++ b/resources/lib/entrypoint.py @@ -78,7 +78,7 @@ def togglePlexTV(): settings('plexid', value="") settings('plexHomeSize', value="1") settings('plexAvatar', value="") - settings('plex_status', value="Not logged in to plex.tv") + settings('plex_status', value=lang(39226)) window('plex_token', clear=True) plex_command('PLEX_TOKEN', '') diff --git a/resources/lib/initialsetup.py b/resources/lib/initialsetup.py index f044dfad..d8ad99e4 100644 --- a/resources/lib/initialsetup.py +++ b/resources/lib/initialsetup.py @@ -82,7 +82,7 @@ class InitialSetup(): answer = False else: log.info('plex.tv connection with token successful') - settings('plex_status', value='Logged in to plex.tv') + settings('plex_status', value=lang(39227)) # Refresh the info from Plex.tv xml = self.doUtils('https://plex.tv/users/account', authenticate=False, @@ -413,7 +413,7 @@ class InitialSetup(): # Optionally sign into plex.tv. Will not be called on very first run # as plexToken will be '' - settings('plex_status', value='Not logged in to plex.tv') + settings('plex_status', value=lang(39226)) if self.plexToken and self.myplexlogin: self.CheckPlexTVSignIn() From e917761ae35275bcd33c3d9c9ae701f1ad5e7467 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Mon, 29 May 2017 10:53:16 +0200 Subject: [PATCH 10/11] Translate plex.tv user in PKC settings --- resources/language/resource.language.en_gb/strings.po | 5 +++++ resources/settings.xml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index 54cca5fc..04288b71 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -1715,6 +1715,11 @@ msgctxt "#39227" msgid "Logged in to plex.tv" msgstr "" +# Message in the PKC settings to display the plex.tv username. Leave the colon : +msgctxt "#39228" +msgid "Plex user:" +msgstr "" + # Plex Artwork.py msgctxt "#39250" diff --git a/resources/settings.xml b/resources/settings.xml index bb80d34e..131e03a4 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -23,7 +23,7 @@ - + From 8860edd59272bfe9385f50526e80f74a28f0866c Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Mon, 29 May 2017 15:39:11 +0200 Subject: [PATCH 11/11] Fix library sync crash due to UnicodeDecodeError - Fixes #302 --- resources/lib/music.py | 3 +-- resources/lib/utils.py | 13 +++++++------ resources/lib/videonodes.py | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/resources/lib/music.py b/resources/lib/music.py index 9ed2cb7b..ab229f0e 100644 --- a/resources/lib/music.py +++ b/resources/lib/music.py @@ -65,7 +65,6 @@ def set_excludefromscan_music_folders(): path = api.validatePlayurl(location.attrib['path'], typus=v.PLEX_TYPE_ARTIST, omitCheck=True) - path = tryEncode(path) paths.append(__turn_to_regex(path)) # Get existing advancedsettings root, tree = advancedsettings_xml(['audio', 'excludefromscan'], @@ -98,7 +97,7 @@ def set_excludefromscan_music_folders(): if write_xml is True: indent(tree.getroot()) - tree.write('%sadvancedsettings.xml' % v.KODI_PROFILE) + tree.write('%sadvancedsettings.xml' % v.KODI_PROFILE, encoding="UTF-8") return changed diff --git a/resources/lib/utils.py b/resources/lib/utils.py index 0a64942b..322ff9c2 100644 --- a/resources/lib/utils.py +++ b/resources/lib/utils.py @@ -557,8 +557,8 @@ def __setXMLTag(element, tag, value, attrib=None): If "subelement" does not exist, create it using attrib and value. element : etree element - tag : string/unicode for subelement - value : string/unicode + tag : unicode for subelement + value : unicode attrib : dict; will use etree attrib method Returns the subelement @@ -657,7 +657,7 @@ def advancedsettings_xml(node_list, new_value=None, attrib=None, # Indent and make readable indent(root) # Safe the changed xml - tree.write(path) + tree.write(path, encoding="UTF-8") return element, tree @@ -705,7 +705,7 @@ def sourcesXML(): try: indent(root) except: pass - etree.ElementTree(root).write(xmlpath) + etree.ElementTree(root).write(xmlpath, encoding="UTF-8") def passwordsXML(): @@ -749,7 +749,8 @@ def passwordsXML(): paths.remove(path) log.info("Successfully removed credentials for: %s" % credentials) - etree.ElementTree(root).write(xmlpath) + etree.ElementTree(root).write(xmlpath, + encoding="UTF-8") break else: log.error("Failed to find saved server: %s in passwords.xml" @@ -817,7 +818,7 @@ def passwordsXML(): indent(root) except: pass - etree.ElementTree(root).write(xmlpath) + etree.ElementTree(root).write(xmlpath, encoding="UTF-8") # dialog.notification( # heading="PlexKodiConnect", diff --git a/resources/lib/videonodes.py b/resources/lib/videonodes.py index 12aed035..9f526175 100644 --- a/resources/lib/videonodes.py +++ b/resources/lib/videonodes.py @@ -120,7 +120,7 @@ class VideoNodes(object): indent(root) except: pass - etree.ElementTree(root).write(nodeXML) + etree.ElementTree(root).write(nodeXML, encoding="UTF-8") nodetypes = { '1': "all", @@ -375,7 +375,7 @@ class VideoNodes(object): indent(root) except: pass - etree.ElementTree(root).write(nodeXML) + etree.ElementTree(root).write(nodeXML, encoding="UTF-8") def singleNode(self, indexnumber, tagname, mediatype, itemtype): tagname = tryEncode(tagname) @@ -431,7 +431,7 @@ class VideoNodes(object): indent(root) except: pass - etree.ElementTree(root).write(nodeXML) + etree.ElementTree(root).write(nodeXML, encoding="UTF-8") def clearProperties(self):