From 33f17887c2def1f6a29ead085a235332263c9e1f Mon Sep 17 00:00:00 2001 From: dave Date: Wed, 23 Sep 2020 22:57:26 -0700 Subject: [PATCH] fix track ordering --- pysonic/api.py | 1 + pysonic/daemon.py | 8 ++++---- pysonic/database.py | 6 +++--- requirements.txt | 1 - 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pysonic/api.py b/pysonic/api.py index ba1c052..ebac7cf 100644 --- a/pysonic/api.py +++ b/pysonic/api.py @@ -143,6 +143,7 @@ class PysonicSubsonicApi(object): duration=child["length"], isDir="false", parent=entity["dir"], + track=child["track"], # title=xxx ) if entity["coverid"]: diff --git a/pysonic/daemon.py b/pysonic/daemon.py index 8cab4be..72a33e5 100644 --- a/pysonic/daemon.py +++ b/pysonic/daemon.py @@ -24,8 +24,8 @@ def main(): group = parser.add_argument_group("app options") group.add_argument("--skip-transcode", action="store_true", help="instead of trancoding mp3s, send as-is") group.add_argument("--no-rescan", action="store_true", help="don't perform simple scan on startup") - group.add_argument("--deep-rescap", action="store_true", help="perform deep scan (read id3 etc)") - group.add_argument("--enable-prune", action="store_true", help="enable removal of media not found on disk") + # group.add_argument("--deep-rescan", action="store_true", help="perform deep scan (read id3 etc)") + # group.add_argument("--enable-prune", action="store_true", help="enable removal of media not found on disk") group.add_argument("--max-bitrate", type=int, default=320, help="maximum send bitrate") group.add_argument("--enable-cors", action="store_true", help="add response headers to allow cors") @@ -37,7 +37,8 @@ def main(): db = PysonicDatabase(path=args.database_path) library = PysonicLibrary(db) for dirname in args.dirs: - assert os.path.exists(dirname) and dirname.startswith("/"), "--dirs must be absolute paths and exist!" + dirname = os.path.abspath(dirname) + assert os.path.exists(dirname), "--dirs must be paths that exist" try: library.add_root_dir(dirname) except DuplicateRootException: @@ -60,7 +61,6 @@ def main(): logging.warning("starting up with auth disabled") else: def validate_password(realm, username, password): - print("I JUST VALIDATED {}:{} ({})".format(username, password, realm)) return True api_config.update({'tools.auth_basic.on': True, diff --git a/pysonic/database.py b/pysonic/database.py index cdcc2f7..eb072d5 100644 --- a/pysonic/database.py +++ b/pysonic/database.py @@ -25,7 +25,7 @@ class DuplicateRootException(Exception): def hash_password(unicode_string): - return sha512(unicode_string.encode('UTF-8')).hexdigest() + return sha512(unicode_string.encode('UTF-8')).hexdigest() def readcursor(func): @@ -38,7 +38,7 @@ def readcursor(func): return func(*args, **kwargs) else: with closing(self.db.cursor()) as cursor: - return func(*[self, cursor], *args[1:], **kwargs) + return func(self, cursor, *args[1:], **kwargs) return wrapped @@ -386,7 +386,7 @@ class PysonicDatabase(object): artist_info = cursor.execute("SELECT * FROM artists WHERE id = ?", (album["artistid"], )).fetchall()[0] children = [] - for song in cursor.execute("SELECT * FROM songs WHERE albumid = ?", (album["id"], )): + for song in cursor.execute("SELECT * FROM songs WHERE albumid = ? ORDER BY track, title ASC;", (album["id"], )): song["_artist"] = artist_info children.append(("song", song)) ret[2]['children'] = children diff --git a/requirements.txt b/requirements.txt index 2d29bb7..0d50284 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,6 @@ lxml==4.2.1 more-itertools==4.1.0 mutagen==1.40.0 portend==2.2 -pysonic==0.0.1 pytz==2018.3 six==1.11.0 tempora==1.11