Merge pull request #1400 from croneter/python3-beta

Bump Python3 stable
This commit is contained in:
croneter 2021-03-14 14:03:12 +01:00 committed by GitHub
commit 73bcd85658
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 89 additions and 27 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.plexkodiconnect" name="PlexKodiConnect" version="3.0.13" provider-name="croneter"> <addon id="plugin.video.plexkodiconnect" name="PlexKodiConnect" version="3.0.15" provider-name="croneter">
<requires> <requires>
<import addon="xbmc.python" version="3.0.0"/> <import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.requests" version="2.22.0+matrix.1" /> <import addon="script.module.requests" version="2.22.0+matrix.1" />
@ -21,6 +21,10 @@
</item> </item>
</extension> </extension>
<extension point="xbmc.addon.metadata"> <extension point="xbmc.addon.metadata">
<assets>
<icon>icon.png</icon>
<fanart>fanart.jpg</fanart>
</assets>
<summary lang="en">Native Integration of Plex into Kodi</summary> <summary lang="en">Native Integration of Plex into Kodi</summary>
<description lang="en">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!</description> <description lang="en">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!</description>
<disclaimer lang="en">Use at your own risk</disclaimer> <disclaimer lang="en">Use at your own risk</disclaimer>
@ -84,7 +88,17 @@
<summary lang="lt_LT">Natūralioji „Plex“ integracija į „Kodi“</summary> <summary lang="lt_LT">Natūralioji „Plex“ integracija į „Kodi“</summary>
<description lang="lt_LT">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!</description> <description lang="lt_LT">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!</description>
<disclaimer lang="lt_LT">Naudokite savo pačių rizika</disclaimer> <disclaimer lang="lt_LT">Naudokite savo pačių rizika</disclaimer>
<news>version 3.0.13: <news>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 - Fix UnboundLocalError: local variable 'user' referenced before assignment
version 3.0.12: version 3.0.12:
@ -137,6 +151,10 @@ version 3.0.1:
version 3.0.0: version 3.0.0:
- Major upgrade from Python 2 to Python 3, allowing use of Kodi 19 Matrix - 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): version 2.12.17 (beta only):
- Sync name and user rating of a TV show season to Kodi - Sync name and user rating of a TV show season to Kodi
- Fix rare TypeError: expected string or buffer on playback start - Fix rare TypeError: expected string or buffer on playback start

View file

@ -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: version 3.0.13:
- Fix UnboundLocalError: local variable 'user' referenced before assignment - Fix UnboundLocalError: local variable 'user' referenced before assignment
@ -51,6 +61,10 @@ version 3.0.1:
version 3.0.0: version 3.0.0:
- Major upgrade from Python 2 to Python 3, allowing use of Kodi 19 Matrix - 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): version 2.12.17 (beta only):
- Sync name and user rating of a TV show season to Kodi - Sync name and user rating of a TV show season to Kodi
- Fix rare TypeError: expected string or buffer on playback start - Fix rare TypeError: expected string or buffer on playback start

View file

@ -125,13 +125,13 @@ class ContextMenu(object):
""" """
delete = True delete = True
if utils.settings('skipContextMenu') != "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) LOG.info("User skipped deletion for: %s", self.plex_id)
delete = False delete = False
if delete: if delete:
LOG.info("Deleting Plex item with id %s", self.plex_id) LOG.info("Deleting Plex item with id %s", self.plex_id)
if PF.delete_item_from_pms(self.plex_id) is False: 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): def _PMS_play(self):
""" """

View file

@ -668,10 +668,10 @@ class InitialSetup(object):
# If you use several Plex libraries of one kind, e.g. "Kids Movies" and # If you use several Plex libraries of one kind, e.g. "Kids Movies" and
# "Parents Movies", be sure to check https://goo.gl/JFtQV9 # "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 # 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 # Make sure that we only ask these questions upon first installation
utils.settings('InstallQuestionsAnswered', value='true') utils.settings('InstallQuestionsAnswered', value='true')

View file

@ -136,7 +136,7 @@ class FullSync(common.LibrarySyncMixin, bg.KillableThread):
LOG.error('Could not entirely process section %s', section) LOG.error('Could not entirely process section %s', section)
self.successful = False 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 Getting iterators is costly, so let's do it in a dedicated thread
""" """
@ -153,17 +153,28 @@ class FullSync(common.LibrarySyncMixin, bg.KillableThread):
continue continue
section = sections.get_sync_section(section, section = sections.get_sync_section(section,
plex_type=kind[0]) 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 updated_at = None
else: last_viewed_at = None
updated_at = section.last_sync - UPDATED_AT_SAFETY \ elif items == 'watched':
if section.last_sync else None 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: try:
section.iterator = PF.get_section_iterator( section.iterator = PF.get_section_iterator(
section.section_id, section.section_id,
plex_type=section.plex_type, plex_type=section.plex_type,
updated_at=updated_at, updated_at=updated_at,
last_viewed_at=None) last_viewed_at=last_viewed_at)
except RuntimeError: except RuntimeError:
LOG.error('Sync at least partially unsuccessful!') LOG.error('Sync at least partially unsuccessful!')
LOG.error('Error getting section iterator %s', section) 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_ARTIST, v.PLEX_TYPE_ARTIST),
(v.PLEX_TYPE_ALBUM, v.PLEX_TYPE_ARTIST), (v.PLEX_TYPE_ALBUM, v.PLEX_TYPE_ARTIST),
]) ])
# ADD NEW ITEMS # ADD NEW ITEMS
# We need to enforce syncing e.g. show before season before episode # We need to enforce syncing e.g. show before season before episode
bg.FunctionAsTask(self.threaded_get_generators, bg.FunctionAsTask(self.threaded_get_generators,
None, None,
kinds, section_queue, False).start() kinds,
section_queue,
items='all' if self.repair else 'updated').start()
# Do the heavy lifting # Do the heavy lifting
self.process_new_and_changed_items(section_queue, processing_queue) self.process_new_and_changed_items(section_queue, processing_queue)
common.update_kodi_library(video=True, music=True) common.update_kodi_library(video=True, music=True)
if self.should_cancel() or not self.successful: if self.should_cancel() or not self.successful:
return 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 # Sync Plex playlists to Kodi and vice-versa
if common.PLAYLIST_SYNC_ENABLED: if common.PLAYLIST_SYNC_ENABLED:
LOG.debug('Start playlist sync')
if self.show_dialog: if self.show_dialog:
if self.dialog: if self.dialog:
self.dialog.close() self.dialog.close()
@ -217,14 +251,9 @@ class FullSync(common.LibrarySyncMixin, bg.KillableThread):
return return
# SYNC PLAYSTATE of ALL items (otherwise we won't pick up on items that # 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 # were set to unwatched or changed user ratings). Also mark all items on
# to delete the ones still in Kodi # the PMS to be able to delete the ones still in Kodi
LOG.debug('Start synching playstate and userdata for every item') 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 # Make sure we're not showing an item's title in the sync dialog
if not self.show_dialog_userdata and self.dialog: if not self.show_dialog_userdata and self.dialog:
# Close the progress indicator dialog # Close the progress indicator dialog
@ -232,7 +261,9 @@ class FullSync(common.LibrarySyncMixin, bg.KillableThread):
self.dialog = None self.dialog = None
bg.FunctionAsTask(self.threaded_get_generators, bg.FunctionAsTask(self.threaded_get_generators,
None, None,
kinds, section_queue, True).start() kinds,
section_queue,
items='all').start()
self.processing_loop_playstates(section_queue) self.processing_loop_playstates(section_queue)
if self.should_cancel() or not self.successful: if self.should_cancel() or not self.successful:
return return

View file

@ -15,7 +15,7 @@ def skip_intro(intros):
if start <= progress < end: if start <= progress < end:
in_intro = True in_intro = True
if in_intro and app.APP.skip_intro_dialog is None: 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, v.ADDON_PATH,
'default', 'default',
'1080i', '1080i',

View file

@ -155,8 +155,7 @@ def dialog(typus, *args, **kwargs):
'yesno', 'ok', 'notification', 'input', 'select', 'numeric' 'yesno', 'ok', 'notification', 'input', 'select', 'numeric'
kwargs: kwargs:
heading='{plex}' title bar (here PlexKodiConnect) heading='{plex}' title bar (here PlexKodiConnect)
message=lang(30128), Dialog content. Don't use with 'OK', 'yesno' message=lang(30128), Dialog content
text=str(), Dialog content for 'OK'. 'yesno'
time=5000, time=5000,
sound=True, sound=True,
nolabel=str(), For 'yesno' dialogs nolabel=str(), For 'yesno' dialogs

View file

@ -174,9 +174,9 @@ class PMS_Websocket(WebSocket):
try: try:
message = loads(message) message = loads(message)
except ValueError: except ValueError as err:
LOG.error('%s: Error decoding message from websocket', LOG.error('%s: Error decoding message from websocket: %s',
self.__class__.__name__) self.__class__.__name__, err)
LOG.error(message) LOG.error(message)
return return
try: try: