check if track exists in db before sending file

This commit is contained in:
mungai-njoroge
2023-06-19 21:49:13 +03:00
parent a201303bd9
commit cc6552cb94
17 changed files with 96 additions and 31 deletions
+5
View File
@@ -31,6 +31,7 @@ class SQLitePlaylistMethods:
with SQLiteManager(userdata_db=True) as cur:
cur.execute(sql, playlist)
pid = cur.lastrowid
cur.close()
p_tuple = (pid, *playlist.values())
return tuple_to_playlist(p_tuple)
@@ -43,6 +44,7 @@ class SQLitePlaylistMethods:
cur.execute(sql, (name,))
data = cur.fetchone()
cur.close()
if data is not None:
return tuple_to_playlist(data)
@@ -57,6 +59,7 @@ class SQLitePlaylistMethods:
cur.execute(sql, (name,))
data = cur.fetchone()
cur.close()
return int(data[0])
@@ -65,6 +68,7 @@ class SQLitePlaylistMethods:
with SQLiteManager(userdata_db=True) as cur:
cur.execute("SELECT * FROM playlists")
playlists = cur.fetchall()
cur.close()
if playlists is not None:
return tuples_to_playlists(playlists)
@@ -79,6 +83,7 @@ class SQLitePlaylistMethods:
cur.execute(sql, (playlist_id,))
data = cur.fetchone()
cur.close()
if data is not None:
return tuple_to_playlist(data)