-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can I sort by track number? #624
Comments
Python has the def get_tracknumber(file):
if trck := file.tags['TRCK']:
number, total = trck.text[0].split('/')
try:
return int(number)
except ValueError:
return number
sorted_files = sorted(files, key=get_tracknumber) Getting the tracknumber from If you use Have a look at https://docs.python.org/3/howto/sorting.html for more details on how to do sorting in Python. |
Is it possible to sort existing files list with mutagen with
TRCK
ID3 tag as the key? Does that module have any available iterators that I could use?I'm not embedding code since I don't know how to do it. Any ideas?
I mean, I could create dictionary with track number as key and file as value, but I think that there can be some easier solution to this.The text was updated successfully, but these errors were encountered: