diff options
author | Jordan <me@jordan.im> | 2020-04-16 01:59:34 -0700 |
---|---|---|
committer | Jordan <me@jordan.im> | 2020-04-16 01:59:34 -0700 |
commit | a06816b9c33d0d7d0ef35211c16b5592e0801433 (patch) | |
tree | d7fbb4236f1b30ec9a339d7cc4a89f01b2e93fd5 | |
parent | 7754e48a592dd8d7cba3d366444989be8dd2749e (diff) | |
download | roka-a06816b9c33d0d7d0ef35211c16b5592e0801433.tar.gz roka-a06816b9c33d0d7d0ef35211c16b5592e0801433.zip |
use natural sort (remove leading zeros) if no track num
-rwxr-xr-x | run.py | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -102,10 +102,14 @@ def list_books(): for a_file in books[a]['files']: track = books[a]['files'][a_file]['track'] if not track or track in track_list: - key = lambda x: books[a]['files'][x]['title'] + # 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']) break track_list.append(track) else: + # we have populated and unique track values, use those key = lambda x: books[a]['files'][x]['track'] # populate XML attribute values required by Apple podcasts |