diff --git a/addon.xml b/addon.xml index dc47e6a3..3d36cf59 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + @@ -21,6 +21,10 @@ + + icon.png + fanart.jpg + Native Integration of Plex into Kodi 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! Use at your own risk @@ -84,7 +88,17 @@ Natūralioji „Plex“ integracija į „Kodi“ Prijunkite „Kodi“ prie „Plex Medija Serverio“. Šiame papildinyje daroma prielaida, kad valdote visus savo vaizdo įrašus naudodami „Plex“ (ir nė vieno su „Kodi“). Galite prarasti jau saugomus „Kodi“ vaizdo įrašų ir muzikos duomenų bazių duomenis (kadangi šis papildinys juos tiesiogiai pakeičia). Naudokite savo pačių rizika! Naudokite savo pačių rizika - version 3.0.13: + version 3.0.15: +- 3.0.14 for everyone +- Rename skip intro skin file + +version 3.0.14 (beta only): +- Quickly sync recently watched items before synching the playstates of the entire Plex library +- Fix TypeError: function missing required argument 'message' +- Fix PlexKodiConnect Kodi add-on icon and fanart not showing +- Improve logging for websocket JSON loads + +version 3.0.13: - Fix UnboundLocalError: local variable 'user' referenced before assignment version 3.0.12: @@ -137,6 +151,10 @@ version 3.0.1: version 3.0.0: - Major upgrade from Python 2 to Python 3, allowing use of Kodi 19 Matrix +version 2.12.18 (beta only): +- Quickly sync recently watched items before synching the playstates of the entire Plex library +- Improve logging for websocket JSON loads + version 2.12.17 (beta only): - Sync name and user rating of a TV show season to Kodi - Fix rare TypeError: expected string or buffer on playback start diff --git a/changelog.txt b/changelog.txt index bea5b3af..ca7f91a3 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,13 @@ +version 3.0.15: +- 3.0.14 for everyone +- Rename skip intro skin file + +version 3.0.14 (beta only): +- Quickly sync recently watched items before synching the playstates of the entire Plex library +- Fix TypeError: function missing required argument 'message' +- Fix PlexKodiConnect Kodi add-on icon and fanart not showing +- Improve logging for websocket JSON loads + version 3.0.13: - Fix UnboundLocalError: local variable 'user' referenced before assignment @@ -51,6 +61,10 @@ version 3.0.1: version 3.0.0: - Major upgrade from Python 2 to Python 3, allowing use of Kodi 19 Matrix +version 2.12.18 (beta only): +- Quickly sync recently watched items before synching the playstates of the entire Plex library +- Improve logging for websocket JSON loads + version 2.12.17 (beta only): - Sync name and user rating of a TV show season to Kodi - Fix rare TypeError: expected string or buffer on playback start diff --git a/resources/lib/context_entry.py b/resources/lib/context_entry.py index 9f7970fc..8195016b 100644 --- a/resources/lib/context_entry.py +++ b/resources/lib/context_entry.py @@ -125,13 +125,13 @@ class ContextMenu(object): """ delete = True if utils.settings('skipContextMenu') != "true": - if not utils.dialog("yesno", heading="{plex}", text=utils.lang(33041)): + if not utils.dialog("yesno", heading="{plex}", message=utils.lang(33041)): LOG.info("User skipped deletion for: %s", self.plex_id) delete = False if delete: LOG.info("Deleting Plex item with id %s", self.plex_id) if PF.delete_item_from_pms(self.plex_id) is False: - utils.dialog("ok", heading="{plex}", text=utils.lang(30414)) + utils.dialog("ok", heading="{plex}", message=utils.lang(30414)) def _PMS_play(self): """ diff --git a/resources/lib/initialsetup.py b/resources/lib/initialsetup.py index 52a0816e..af04de73 100644 --- a/resources/lib/initialsetup.py +++ b/resources/lib/initialsetup.py @@ -668,10 +668,10 @@ class InitialSetup(object): # If you use several Plex libraries of one kind, e.g. "Kids Movies" and # "Parents Movies", be sure to check https://goo.gl/JFtQV9 - # dialog.ok(heading=utils.lang(29999), text=utils.lang(39076)) + # dialog.ok(heading=utils.lang(29999), message=utils.lang(39076)) # Need to tell about our image source for collections: themoviedb.org - # dialog.ok(heading=utils.lang(29999), text=utils.lang(39717)) + # dialog.ok(heading=utils.lang(29999), message=utils.lang(39717)) # Make sure that we only ask these questions upon first installation utils.settings('InstallQuestionsAnswered', value='true') diff --git a/resources/lib/library_sync/full_sync.py b/resources/lib/library_sync/full_sync.py index 7c4644e1..29e406f9 100644 --- a/resources/lib/library_sync/full_sync.py +++ b/resources/lib/library_sync/full_sync.py @@ -136,7 +136,7 @@ class FullSync(common.LibrarySyncMixin, bg.KillableThread): LOG.error('Could not entirely process section %s', section) self.successful = False - def threaded_get_generators(self, kinds, section_queue, all_items): + def threaded_get_generators(self, kinds, section_queue, items): """ Getting iterators is costly, so let's do it in a dedicated thread """ @@ -153,17 +153,28 @@ class FullSync(common.LibrarySyncMixin, bg.KillableThread): continue section = sections.get_sync_section(section, plex_type=kind[0]) - if self.repair or all_items: + timestamp = section.last_sync - UPDATED_AT_SAFETY \ + if section.last_sync else None + if items == 'all': updated_at = None - else: - updated_at = section.last_sync - UPDATED_AT_SAFETY \ - if section.last_sync else None + last_viewed_at = None + elif items == 'watched': + if not timestamp: + # No need to sync playstate updates since section + # has not yet been synched + continue + else: + updated_at = None + last_viewed_at = timestamp + elif items == 'updated': + updated_at = timestamp + last_viewed_at = None try: section.iterator = PF.get_section_iterator( section.section_id, plex_type=section.plex_type, updated_at=updated_at, - last_viewed_at=None) + last_viewed_at=last_viewed_at) except RuntimeError: LOG.error('Sync at least partially unsuccessful!') LOG.error('Error getting section iterator %s', section) @@ -194,19 +205,42 @@ class FullSync(common.LibrarySyncMixin, bg.KillableThread): (v.PLEX_TYPE_ARTIST, v.PLEX_TYPE_ARTIST), (v.PLEX_TYPE_ALBUM, v.PLEX_TYPE_ARTIST), ]) + # ADD NEW ITEMS # We need to enforce syncing e.g. show before season before episode bg.FunctionAsTask(self.threaded_get_generators, None, - kinds, section_queue, False).start() + kinds, + section_queue, + items='all' if self.repair else 'updated').start() # Do the heavy lifting self.process_new_and_changed_items(section_queue, processing_queue) common.update_kodi_library(video=True, music=True) if self.should_cancel() or not self.successful: return + # In order to not delete all your songs again for playstate synch + if app.SYNC.enable_music: + kinds.extend([ + (v.PLEX_TYPE_SONG, v.PLEX_TYPE_ARTIST), + ]) + + # Update playstate progress since last sync - especially useful for + # users of very large libraries since this step is very fast + # These playstates will be synched twice + LOG.debug('Start synching playstate for last watched items') + bg.FunctionAsTask(self.threaded_get_generators, + None, + kinds, + section_queue, + items='watched').start() + self.processing_loop_playstates(section_queue) + if self.should_cancel() or not self.successful: + return + # Sync Plex playlists to Kodi and vice-versa if common.PLAYLIST_SYNC_ENABLED: + LOG.debug('Start playlist sync') if self.show_dialog: if self.dialog: self.dialog.close() @@ -217,14 +251,9 @@ class FullSync(common.LibrarySyncMixin, bg.KillableThread): return # SYNC PLAYSTATE of ALL items (otherwise we won't pick up on items that - # were set to unwatched). Also mark all items on the PMS to be able - # to delete the ones still in Kodi + # were set to unwatched or changed user ratings). Also mark all items on + # the PMS to be able to delete the ones still in Kodi LOG.debug('Start synching playstate and userdata for every item') - if app.SYNC.enable_music: - # In order to not delete all your songs again - kinds.extend([ - (v.PLEX_TYPE_SONG, v.PLEX_TYPE_ARTIST), - ]) # Make sure we're not showing an item's title in the sync dialog if not self.show_dialog_userdata and self.dialog: # Close the progress indicator dialog @@ -232,7 +261,9 @@ class FullSync(common.LibrarySyncMixin, bg.KillableThread): self.dialog = None bg.FunctionAsTask(self.threaded_get_generators, None, - kinds, section_queue, True).start() + kinds, + section_queue, + items='all').start() self.processing_loop_playstates(section_queue) if self.should_cancel() or not self.successful: return diff --git a/resources/lib/skip_plex_intro.py b/resources/lib/skip_plex_intro.py index 74e1031f..b3590cab 100644 --- a/resources/lib/skip_plex_intro.py +++ b/resources/lib/skip_plex_intro.py @@ -15,7 +15,7 @@ def skip_intro(intros): if start <= progress < end: in_intro = True if in_intro and app.APP.skip_intro_dialog is None: - app.APP.skip_intro_dialog = SkipIntroDialog('skip_intro.xml', + app.APP.skip_intro_dialog = SkipIntroDialog('script-plex-skip_intro.xml', v.ADDON_PATH, 'default', '1080i', diff --git a/resources/lib/utils.py b/resources/lib/utils.py index 97b4393f..a3c46ecd 100644 --- a/resources/lib/utils.py +++ b/resources/lib/utils.py @@ -155,8 +155,7 @@ def dialog(typus, *args, **kwargs): 'yesno', 'ok', 'notification', 'input', 'select', 'numeric' kwargs: heading='{plex}' title bar (here PlexKodiConnect) - message=lang(30128), Dialog content. Don't use with 'OK', 'yesno' - text=str(), Dialog content for 'OK'. 'yesno' + message=lang(30128), Dialog content time=5000, sound=True, nolabel=str(), For 'yesno' dialogs diff --git a/resources/lib/websocket_client.py b/resources/lib/websocket_client.py index fc32e0bd..62002db5 100644 --- a/resources/lib/websocket_client.py +++ b/resources/lib/websocket_client.py @@ -174,9 +174,9 @@ class PMS_Websocket(WebSocket): try: message = loads(message) - except ValueError: - LOG.error('%s: Error decoding message from websocket', - self.__class__.__name__) + except ValueError as err: + LOG.error('%s: Error decoding message from websocket: %s', + self.__class__.__name__, err) LOG.error(message) return try: diff --git a/resources/skins/default/1080i/skip_intro.xml b/resources/skins/default/1080i/script-plex-skip_intro.xml similarity index 100% rename from resources/skins/default/1080i/skip_intro.xml rename to resources/skins/default/1080i/script-plex-skip_intro.xml