Browse Source

fix track ordering

master
dave 2 months ago
parent
commit
33f17887c2
4 changed files with 8 additions and 8 deletions
  1. +1
    -0
      pysonic/api.py
  2. +4
    -4
      pysonic/daemon.py
  3. +3
    -3
      pysonic/database.py
  4. +0
    -1
      requirements.txt

+ 1
- 0
pysonic/api.py View File

@@ -143,6 +143,7 @@ class PysonicSubsonicApi(object):
duration=child["length"],
isDir="false",
parent=entity["dir"],
track=child["track"],
# title=xxx
)
if entity["coverid"]:


+ 4
- 4
pysonic/daemon.py View File

@@ -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,


+ 3
- 3
pysonic/database.py View File

@@ -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


+ 0
- 1
requirements.txt View File

@@ -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

Loading…
Cancel
Save