A library that tags music files using Spotify API or Discogs.
-
Clone the repository
git clone https://github.com/pynathanthomas/tagger.git
-
Install dependencies
cd tagger; pip3 install -r requirements.txt
There are two options: tag an album or tag a bunch of random tracks in a directory.
python3 ~/tagger/tag_album.py '/path/to/album'
Use the -s
or -d
flags to specify searching in Spotify or Discogs, respectively. It defaults to Spotify.
python3 ~/tagger/tag_album.py -s '/path/to/album'
python3 ~/tagger/tag_album.py -d '/path/to/album'
For this to work, the tracks have to be named using a pattern. For example,
these tracks are named using the $artist - $track.m4a
pattern.
A file named Back in the U.S.S.R by The Beatles.flac
would have the pattern $track by $artist.flac
. There are other variables you can name such as $year
, $id
, and $album
but these are ignored in the search. You can use them to block out things in the file name that are obtrusive.
Now, to actually do the tagging, type:
python3 ~/tagger/tag_tracks.py '/path/to/playlist' 'pattern'
Example:
python3 ~/tagger/tag_tracks.py '~/music/rapcaviar' '$artist - $track.m4a'
This only works with the Spotify API.
See tag_tracks.py
and tag_album.py
as examples.