Cleanup due to wrong assumption that kodi playlist hash was unique
This commit is contained in:
parent
58ba03b94b
commit
eb3e655213
2 changed files with 7 additions and 12 deletions
|
@ -47,15 +47,13 @@ def update_playlist(playlist, delete=False):
|
||||||
plexdb.add_playlist(playlist)
|
plexdb.add_playlist(playlist)
|
||||||
|
|
||||||
|
|
||||||
def get_playlist(path=None, kodi_hash=None, plex_id=None):
|
def get_playlist(path=None, plex_id=None):
|
||||||
"""
|
"""
|
||||||
Returns the playlist as a Playlist for either the plex_id, path or
|
Returns the playlist as a Playlist for either the plex_id or path
|
||||||
kodi_hash. kodi_hash will be more reliable as it includes path and file
|
|
||||||
content.
|
|
||||||
"""
|
"""
|
||||||
playlist = Playlist()
|
playlist = Playlist()
|
||||||
with PlexDB() as plexdb:
|
with PlexDB() as plexdb:
|
||||||
playlist = plexdb.playlist(playlist, plex_id, path, kodi_hash)
|
playlist = plexdb.playlist(playlist, plex_id, path)
|
||||||
return playlist
|
return playlist
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -57,20 +57,17 @@ class Playlists(object):
|
||||||
playlist.kodi_type,
|
playlist.kodi_type,
|
||||||
playlist.kodi_hash))
|
playlist.kodi_hash))
|
||||||
|
|
||||||
def playlist(self, playlist, plex_id=None, path=None, kodi_hash=None):
|
def playlist(self, playlist, plex_id=None, path=None):
|
||||||
"""
|
"""
|
||||||
Returns a complete Playlist (empty one passed in via playlist)
|
Returns a complete Playlist (empty one passed in via playlist) for the
|
||||||
for the entry with plex_id OR kodi_hash OR kodi_path.
|
entry with plex_id OR kodi_path.
|
||||||
Returns None if not found
|
Returns None if not found
|
||||||
"""
|
"""
|
||||||
query = 'SELECT * FROM playlists WHERE %s = ? LIMIT 1'
|
query = 'SELECT * FROM playlists WHERE %s = ? LIMIT 1'
|
||||||
if plex_id:
|
if plex_id:
|
||||||
query = query % 'plex_id'
|
query = query % 'plex_id'
|
||||||
var = plex_id
|
var = plex_id
|
||||||
elif kodi_hash:
|
elif path:
|
||||||
query = query % 'kodi_hash'
|
|
||||||
var = kodi_hash
|
|
||||||
else:
|
|
||||||
query = query % 'kodi_path'
|
query = query % 'kodi_path'
|
||||||
var = path
|
var = path
|
||||||
self.cursor.execute(query, (var, ))
|
self.cursor.execute(query, (var, ))
|
||||||
|
|
Loading…
Reference in a new issue