Clean up code
This commit is contained in:
parent
799f9ba25a
commit
c3b649c1b1
1 changed files with 3 additions and 5 deletions
|
@ -126,7 +126,8 @@ def create_kodi_playlist(plex_id=None, updated_at=None):
|
||||||
playlist.kodi_path = path
|
playlist.kodi_path = path
|
||||||
# Derive filename close to Plex playlist name
|
# Derive filename close to Plex playlist name
|
||||||
_write_playlist_to_file(playlist, xml)
|
_write_playlist_to_file(playlist, xml)
|
||||||
update_plex_table(playlist, update_kodi_hash=True)
|
playlist.kodi_hash = utils.generate_file_md5(path)
|
||||||
|
update_plex_table(playlist)
|
||||||
LOG.info('Created Kodi playlist based on Plex playlist: %s', playlist)
|
LOG.info('Created Kodi playlist based on Plex playlist: %s', playlist)
|
||||||
|
|
||||||
|
|
||||||
|
@ -147,8 +148,7 @@ def delete_kodi_playlist(playlist):
|
||||||
update_plex_table(playlist, delete=True)
|
update_plex_table(playlist, delete=True)
|
||||||
|
|
||||||
|
|
||||||
def update_plex_table(playlist, delete=False, new_path=None,
|
def update_plex_table(playlist, delete=False):
|
||||||
update_kodi_hash=False):
|
|
||||||
"""
|
"""
|
||||||
Assumes that all sync operations are over. Takes playlist [Playlist_Object]
|
Assumes that all sync operations are over. Takes playlist [Playlist_Object]
|
||||||
and creates/updates the corresponding Plex playlists table entry
|
and creates/updates the corresponding Plex playlists table entry
|
||||||
|
@ -159,8 +159,6 @@ def update_plex_table(playlist, delete=False, new_path=None,
|
||||||
with plexdb.Get_Plex_DB() as plex_db:
|
with plexdb.Get_Plex_DB() as plex_db:
|
||||||
plex_db.delete_playlist_entry(playlist)
|
plex_db.delete_playlist_entry(playlist)
|
||||||
return
|
return
|
||||||
if update_kodi_hash:
|
|
||||||
playlist.kodi_hash = utils.generate_file_md5(playlist.kodi_path)
|
|
||||||
with plexdb.Get_Plex_DB() as plex_db:
|
with plexdb.Get_Plex_DB() as plex_db:
|
||||||
plex_db.insert_playlist_entry(playlist)
|
plex_db.insert_playlist_entry(playlist)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue