post-refactor fixes

This commit is contained in:
dave 2020-10-05 23:30:01 -07:00
parent da53b4e153
commit 0d2f9a9587
2 changed files with 5 additions and 1 deletions

View File

@ -1,3 +1,4 @@
import os
import logging
import subprocess
from time import time
@ -171,7 +172,7 @@ class PysonicSubsonicApi(object):
maxBitRate = int(maxBitRate)
assert maxBitRate >= 32 and maxBitRate <= 320
song = self.db.get_songs(id=int(id))[0]
fpath = song["_fullpath"]
fpath = os.path.join(song["root"], song["file"])
media_bitrate = song.get("bitrate") / 1024 if song.get("bitrate") else 320
to_bitrate = min(maxBitRate,
self.options.max_bitrate,

View File

@ -312,12 +312,15 @@ class PysonicDatabase(object):
q = """
SELECT
s.*,
lib.path as root,
alb.name as albumname,
alb.coverid as albumcoverid,
art.name as artistname,
g.name as genrename,
albdir.id as albumdir
FROM songs as s
INNER JOIN libraries as lib
on s.library == lib.id
INNER JOIN albums as alb
on s.albumid == alb.id
INNER JOIN dirs as albdir