Created
April 30, 2017 22:53
-
-
Save saxbophone/9ec95eee76637fa03a08f86276fbd343 to your computer and use it in GitHub Desktop.
Bandcamp is great but the naming format they use for the downloaded tracks doesn't suit my system, so this script converts them!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| def fix_track_names(artist, album): | |
| """ | |
| Given an artist name and album name, renames all the tracks in the current | |
| directory from the format that Bandcamp names them to the format that I | |
| want them (<track number> - <track name>) | |
| """ | |
| for track in os.listdir('.'): | |
| # skip the cover artwork | |
| if track == 'cover.jpg': | |
| continue | |
| os.rename( | |
| track, | |
| ' - '.join( | |
| track.split( | |
| '{} - {} - '.format(artist, album) | |
| )[1].split(' ', 1) | |
| ) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment