Update code

This commit is contained in:
2024-05-15 14:03:28 +08:00
parent 386cee66ec
commit df84f07bce
12 changed files with 636 additions and 21 deletions

View File

@@ -60,12 +60,15 @@ class LibraryDb:
re = cur.fetchone()
return dict(re) if re is not None else None
def get_audios(self, track: str, album: str = None):
args = ['Audio', track]
def get_audios(self, track: str = None, album: str = None):
args = ['MediaBrowser.Controller.Entities.Audio.Audio']
where_sql = ''
if track is not None:
where_sql += ' AND Name = ?'
args.append(track)
if album is not None:
where_sql = ' AND Album = ?'
where_sql += ' AND Album = ?'
args.append(album)
cur = self._db.execute(f"SELECT * FROM TypedBaseItems WHERE MediaType = ? AND Name = ?{where_sql};", args) # noqa: E501
cur = self._db.execute(f"SELECT * FROM TypedBaseItems WHERE type = ?{where_sql};", args) # noqa: E501
cur.row_factory = sqlite3.Row
return [dict(i) for i in cur.fetchall()]