Improve logging for playlists
This commit is contained in:
parent
b8286c9b14
commit
1f5ce87bdc
1 changed files with 8 additions and 12 deletions
|
@ -150,14 +150,11 @@ def _full_sync():
|
||||||
# Get rid of old Plex playlists that were deleted on the Plex side
|
# Get rid of old Plex playlists that were deleted on the Plex side
|
||||||
for plex_id in old_plex_ids:
|
for plex_id in old_plex_ids:
|
||||||
playlist = db.get_playlist(plex_id=plex_id)
|
playlist = db.get_playlist(plex_id=plex_id)
|
||||||
if playlist:
|
LOG.debug('Removing outdated Plex playlist: %s', playlist)
|
||||||
LOG.debug('Removing outdated Plex playlist %s from %s',
|
try:
|
||||||
playlist.plex_name, playlist.kodi_path)
|
kodi_pl.delete(playlist)
|
||||||
try:
|
except PlaylistError:
|
||||||
kodi_pl.delete(playlist)
|
LOG.debug('Skipping deletion of playlist: %s', playlist)
|
||||||
except PlaylistError:
|
|
||||||
LOG.debug('Skipping deletion of playlist %s: %s',
|
|
||||||
api.plex_id(), api.title())
|
|
||||||
# Look at all supported Kodi playlists. Check whether they are in the DB.
|
# Look at all supported Kodi playlists. Check whether they are in the DB.
|
||||||
old_kodi_paths = db.kodi_playlist_paths()
|
old_kodi_paths = db.kodi_playlist_paths()
|
||||||
for root, _, files in path_ops.walk(v.PLAYLIST_PATH):
|
for root, _, files in path_ops.walk(v.PLAYLIST_PATH):
|
||||||
|
@ -175,7 +172,7 @@ def _full_sync():
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
if not playlist:
|
if not playlist:
|
||||||
LOG.debug('New Kodi playlist detected: %s', path)
|
LOG.debug('New Kodi playlist detected: %s', playlist)
|
||||||
playlist = Playlist()
|
playlist = Playlist()
|
||||||
playlist.kodi_path = path
|
playlist.kodi_path = path
|
||||||
playlist.kodi_hash = kodi_hash
|
playlist.kodi_hash = kodi_hash
|
||||||
|
@ -186,14 +183,13 @@ def _full_sync():
|
||||||
playlist.kodi_hash = kodi_hash
|
playlist.kodi_hash = kodi_hash
|
||||||
plex_pl.create(playlist)
|
plex_pl.create(playlist)
|
||||||
except PlaylistError:
|
except PlaylistError:
|
||||||
LOG.info('Skipping Kodi playlist %s', path)
|
LOG.info('Skipping Kodi playlist %s', playlist)
|
||||||
for kodi_path in old_kodi_paths:
|
for kodi_path in old_kodi_paths:
|
||||||
playlist = db.get_playlist(path=kodi_path)
|
playlist = db.get_playlist(path=kodi_path)
|
||||||
try:
|
try:
|
||||||
plex_pl.delete(playlist)
|
plex_pl.delete(playlist)
|
||||||
except PlaylistError:
|
except PlaylistError:
|
||||||
LOG.debug('Skipping deletion of playlist %s: %s',
|
LOG.debug('Skipping deletion of playlist: %s', playlist)
|
||||||
playlist.plex_id, playlist.plex_name)
|
|
||||||
LOG.info('Playlist full sync done')
|
LOG.info('Playlist full sync done')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue