Fix saving Plex updatedAt value for new playlists
This commit is contained in:
parent
8ee20b1bba
commit
341571e232
1 changed files with 4 additions and 4 deletions
|
@ -71,7 +71,7 @@ def delete_plex_playlist(playlist):
|
||||||
update_plex_table(playlist, delete=True)
|
update_plex_table(playlist, delete=True)
|
||||||
|
|
||||||
|
|
||||||
def create_kodi_playlist(plex_id=None):
|
def create_kodi_playlist(plex_id=None, updated_at=None):
|
||||||
"""
|
"""
|
||||||
Creates a new Kodi playlist file. Will also add (or modify an existing) Plex
|
Creates a new Kodi playlist file. Will also add (or modify an existing) Plex
|
||||||
playlist table entry.
|
playlist table entry.
|
||||||
|
@ -89,7 +89,7 @@ def create_kodi_playlist(plex_id=None):
|
||||||
playlist.id = api.plex_id()
|
playlist.id = api.plex_id()
|
||||||
playlist.type = v.KODI_PLAYLIST_TYPE_FROM_PLEX[api.playlist_type()]
|
playlist.type = v.KODI_PLAYLIST_TYPE_FROM_PLEX[api.playlist_type()]
|
||||||
playlist.plex_name = api.title()
|
playlist.plex_name = api.title()
|
||||||
playlist.plex_updatedat = api.updated_at()
|
playlist.plex_updatedat = updated_at
|
||||||
LOG.info('Creating new Kodi playlist from Plex playlist %s: %s',
|
LOG.info('Creating new Kodi playlist from Plex playlist %s: %s',
|
||||||
playlist.id, playlist.plex_name)
|
playlist.id, playlist.plex_name)
|
||||||
name = utils.valid_filename(playlist.plex_name)
|
name = utils.valid_filename(playlist.plex_name)
|
||||||
|
@ -296,7 +296,7 @@ def full_sync():
|
||||||
if not playlist:
|
if not playlist:
|
||||||
LOG.debug('New Plex playlist %s discovered: %s',
|
LOG.debug('New Plex playlist %s discovered: %s',
|
||||||
api.plex_id(), api.title())
|
api.plex_id(), api.title())
|
||||||
create_kodi_playlist(api.plex_id())
|
create_kodi_playlist(api.plex_id(), api.updated_at())
|
||||||
continue
|
continue
|
||||||
elif playlist.plex_updatedat != api.updated_at():
|
elif playlist.plex_updatedat != api.updated_at():
|
||||||
LOG.debug('Detected changed Plex playlist %s: %s',
|
LOG.debug('Detected changed Plex playlist %s: %s',
|
||||||
|
@ -305,7 +305,7 @@ def full_sync():
|
||||||
delete_kodi_playlist(playlist)
|
delete_kodi_playlist(playlist)
|
||||||
else:
|
else:
|
||||||
update_plex_table(playlist, delete=True)
|
update_plex_table(playlist, delete=True)
|
||||||
create_kodi_playlist(api.plex_id())
|
create_kodi_playlist(api.plex_id(), api.updated_at())
|
||||||
except PL.PlaylistError:
|
except PL.PlaylistError:
|
||||||
LOG.info('Skipping playlist %s: %s', api.plex_id(), api.title())
|
LOG.info('Skipping playlist %s: %s', api.plex_id(), api.title())
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue