From 3534a9b8f048a9c2a8ef1a15ba7d9f28621e6e4c Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Thu, 9 Mar 2017 11:12:46 +0100 Subject: [PATCH 1/6] Rewire playback start when browsing by folder --- resources/lib/entrypoint.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py index 123c2283..6258f537 100644 --- a/resources/lib/entrypoint.py +++ b/resources/lib/entrypoint.py @@ -964,17 +964,24 @@ def __build_item(xml_element): listitem = api.CreateListItemFromPlexItem() api.AddStreamInfo(listitem) api.set_listitem_artwork(listitem) - if api.getType() != v.PLEX_TYPE_PHOTO: - url = "plugin://%s/" % v.ADDON_ID + if api.getType() == v.PLEX_TYPE_PHOTO: + url = listitem.getProperty('path') + elif api.getType() == v.PLEX_TYPE_CLIP: params = { 'mode': "Plex_Node", 'id': xml_element.attrib.get('key'), 'viewOffset': xml_element.attrib.get('viewOffset', '0'), 'plex_type': xml_element.attrib.get('type') } - url = '%s?%s' % (url, urlencode(params)) + url = 'plugin://%s?%s' % (v.ADDON_ID, urlencode(params)) else: - url = listitem.getProperty('path') + params = { + 'filename': api.getKey(), + 'id': api.getRatingKey(), + 'dbid': listitem.getProperty('dbid') or None, + 'mode': "play" + } + url = "plugin://%s?%s" % (v.ADDON_ID, urlencode(params)) xbmcplugin.addDirectoryItem(handle=HANDLE, url=url, listitem=listitem) From 762bb872f3ef4155ab63a1ef371634b5d9d5dfab Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Thu, 9 Mar 2017 11:21:13 +0100 Subject: [PATCH 2/6] Code optimization --- resources/lib/entrypoint.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py index 6258f537..7cce004b 100644 --- a/resources/lib/entrypoint.py +++ b/resources/lib/entrypoint.py @@ -117,8 +117,7 @@ def Plex_Node(url, viewOffset, playdirectly=False, node=True): return if viewOffset != '0': try: - viewOffset = int(v.PLEX_TO_KODI_TIMEFACTOR * - float(viewOffset)) + viewOffset = int(v.PLEX_TO_KODI_TIMEFACTOR * float(viewOffset)) except: pass else: @@ -964,24 +963,21 @@ def __build_item(xml_element): listitem = api.CreateListItemFromPlexItem() api.AddStreamInfo(listitem) api.set_listitem_artwork(listitem) - if api.getType() == v.PLEX_TYPE_PHOTO: - url = listitem.getProperty('path') - elif api.getType() == v.PLEX_TYPE_CLIP: + if api.getType() == v.PLEX_TYPE_CLIP: params = { 'mode': "Plex_Node", 'id': xml_element.attrib.get('key'), 'viewOffset': xml_element.attrib.get('viewOffset', '0'), 'plex_type': xml_element.attrib.get('type') } - url = 'plugin://%s?%s' % (v.ADDON_ID, urlencode(params)) else: params = { 'filename': api.getKey(), 'id': api.getRatingKey(), - 'dbid': listitem.getProperty('dbid') or None, + 'dbid': listitem.getProperty('dbid') or '', 'mode': "play" } - url = "plugin://%s?%s" % (v.ADDON_ID, urlencode(params)) + url = "plugin://%s?%s" % (v.ADDON_ID, urlencode(params)) xbmcplugin.addDirectoryItem(handle=HANDLE, url=url, listitem=listitem) From d9fc26f96a7866ab578ea8ea7620005ac01dd865 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Thu, 9 Mar 2017 12:24:04 +0100 Subject: [PATCH 3/6] Fix IndexError for playqueues --- resources/lib/playlist_func.py | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/lib/playlist_func.py b/resources/lib/playlist_func.py index 5ab80b6c..61d28b7c 100644 --- a/resources/lib/playlist_func.py +++ b/resources/lib/playlist_func.py @@ -260,7 +260,6 @@ def init_Plex_playlist(playlist, plex_id=None, kodi_item=None): except KeyError: log.error('Could not init Plex playlist') return - item.ID = xml[-1].attrib['%sItemID' % playlist.kind] playlist.items.append(item) log.debug('Initialized the playlist on the Plex side: %s' % playlist) From 7910a3fefe8b7a9a6f695b33a59eb6202a81e6e5 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Thu, 9 Mar 2017 12:36:32 +0100 Subject: [PATCH 4/6] Update addon.xml --- addon.xml | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/addon.xml b/addon.xml index b7a9df67..da8e127b 100644 --- a/addon.xml +++ b/addon.xml @@ -1,14 +1,10 @@ - + - + video audio image @@ -21,6 +17,13 @@ + all + + GNU GENERAL PUBLIC LICENSE. Version 2, June 1991 + https://forums.plex.tv + https://github.com/croneter/PlexKodiConnect + + https://github.com/croneter/PlexKodiConnect Native Integration of Plex into Kodi Native Integration of Plex into Kodi Native Integration of Plex into Kodi @@ -37,11 +40,5 @@ Connect Kodi to your Plex Media Server. This plugin assumes that you manage all your videos with Plex (and none with Kodi). You might lose data already stored in the Kodi video and music databases (as this plugin directly changes them). Use at your own risk! 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! Verbind Kodi met je Plex Media Server. Deze plugin gaat ervan uit dat je al je video's met Plex (en niet met Kodi) beheerd. Je kunt gegevens reeds opgeslagen in de databases voor video en muziek van Kodi (deze plugin wijzigt deze gegevens direct) verliezen. Gebruik op eigen risico! - all - GPL v2.0 - https://forums.plex.tv - https://github.com/croneter/PlexKodiConnect - - https://github.com/croneter/PlexKodiConnect - \ No newline at end of file + From 14532a7d9cd8d750d6cb17ae569045331d2e66eb Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Thu, 9 Mar 2017 12:40:57 +0100 Subject: [PATCH 5/6] Remove setting that wasn't implemented - Fixes #136 --- resources/settings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/settings.xml b/resources/settings.xml index fd50830b..429c7173 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -96,7 +96,7 @@ - + From 9be6f04f656de3d6777b0e2e058c65df01bae36a Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Thu, 9 Mar 2017 12:43:35 +0100 Subject: [PATCH 6/6] Remove newline --- resources/language/English/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index 69313894..527e90f6 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -517,4 +517,4 @@ Amazon Alexa (Voice Recognition) Activate Alexa Browse by folder - + \ No newline at end of file