From c5459f3a5ede5eb4a73c67e791d0771ef78e091b Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 20 Apr 2020 14:48:22 -0700 Subject: fallback sort by filename rather than title tag --- rebuild.py | 1 + run.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/rebuild.py b/rebuild.py index 4802272..faec616 100755 --- a/rebuild.py +++ b/rebuild.py @@ -69,6 +69,7 @@ def get_books(root_path): mp3 = dict() mp3['path'] = file_path mp3['duration'] = tag.duration + mp3['filename'] = os.path.split(file_path)[1] # attribute values must be populated and non-space if tag.title and not tag.title.isspace(): diff --git a/run.py b/run.py index e8b2c56..af9abba 100755 --- a/run.py +++ b/run.py @@ -135,7 +135,7 @@ def list_books(): # remove leading zeros from digits (natural sort) conv = lambda s: [int(x) if x.isdigit() else x.lower() for x in re.split('(\d+)', s)] - key = lambda x: conv(books[a]['files'][x]['title']) + key = lambda x: conv(books[a]['files'][x]['filename']) break track_list.append(track) else: -- cgit v1.2.3-54-g00ecf