allow maxBitRate=0 as some clients set it as the default
Some checks reported errors
Gitea/pysonic/pipeline/head Something is wrong with the build of this commit

This commit is contained in:
dave 2023-01-09 22:46:59 -08:00
parent 092c833c4f
commit afbf71aa08

View File

@ -189,8 +189,9 @@ class PysonicSubsonicApi(object):
@cherrypy.expose
def stream_view(self, id, maxBitRate="256", **kwargs):
maxBitRate = int(maxBitRate)
assert maxBitRate >= 32 and maxBitRate <= 320
maxBitRate = int(maxBitRate) or 256
if maxBitRate < 32 or maxBitRate > 320:
raise cherrypy.HTTPError(400, message=f"invalid maxBitRate: {maxBitRate}. Must be between 32 and 320.")
song = self.db.get_songs(id=int(id))[0]
fpath = os.path.join(song["root"], song["file"])
media_bitrate = song.get("bitrate") / 1024 if song.get("bitrate") else 320