2014-03-22, 13:46
This guide is for people who want to automate their music tagging from MusicBrainz after downloading from SABnzbd.
Let me begin by saying that if you do not use MusicBrainz data in your tags, then stop reading. I always hated having to open supplimentary tools like Picard to tag my recently acquired music. There is something clunky about downloading with SAB, then opening another program, properly tagging, embedding art etc, then finally moving it into your library. Why can't this be scripted..... ohh wait, it can!
I came across an amazing CLI tool called Beets!. This program is amazingly powerful and down right effective. I won't get into how to install, because the authors of Beets have already made a Getting Started Guide.
Beets does all sorts of amazing things, but for this guide we will focus on just a couple of things when it comes to integration with SABnzbd and some of my preferred Beets settings.
Heres what will happen if you follow this guide:
An album gets downloaded with SABnzbd.
SABnzbd will call on Beets.
Beets will match the album via MusicBrainz and update tags/download cover art/embed cover art and finally move it into your final library folder. If it can't find a suitable match, it will exit gracefully and do nothing.
My Beets Settings:
So I will assume you have at least created the beets config.yaml in the appropriate directory, you did follow the Getting Started Guide right? RIGHT?
Open up the config.yaml with a decent text editor and paste the following below your "library:" line.
Code:
import:
move: yes
plugins: fetchart embedart
art_filename: folder
id3v23: yes
match:
strong_rec_thresh: 0.2
ignored: missing_tracks unmatched_tracks
paths:
default: $albumartist/$album%aunique{}/$track $title
comp: Various Artists/$album%aunique{}/$track $title
So what exactly does that config do, lets break it down:
Code:
import:
move: yes
Code:
plugins: fetchart embedart
art_filename: folder
Code:
id3v23: yes
Quote:By default, beets writes MP3 tags using the ID3v2.4 standard, the latest version of ID3. Enable this option to instead use the older ID3v2.3 standard, which is preferred by certain older software such as Windows Media Player.
Code:
match:
strong_rec_thresh: 0.2
ignored: missing_tracks unmatched_tracks
This is where things get interesting....
Quote:The threshold is a distance value between 0.0 and 1.0, so you can think of it as the opposite of a similarity value. For example, if you want to automatically accept any matches above 90% similarity, use:
match:
strong_rec_thresh: 0.10
In my config, I'm using a threshold of 80%, you can obviously change this to a higher rating if you want to make sure your matches are more stringent.
Quote:ignored: missing_tracks unmatched_tracks
So suppose you download an album, it is missing track 16 of an album it has matched on MusicBrainz, It will not do any more processing at that point and intentionally leave the album untouched. Likewise, if it has extra songs that don't match any known release it will not NOT attempt to tag those albums either.
Code:
paths:
default: $albumartist/$album%aunique{}/$track $title
comp: Various Artists/$album%aunique{}/$track $title
The paths function will sort your physical files after they have been matched. Feel free to change this if your final folder paths do not match my final layout.
SABnzbd Configuration:
Create a .bat or .cmd file and place it in your SABnzbd "Post Processing Scripts Folder", I named mine beets.bat and my script folder is using Sickbeards "autoProcessTV" folder.
Paste the following into the .bat.
Code:
@echo off
beet import -q "%1"
In your SABnzbd config page, click the Catagories link. Make sure your music catagory/catagories now use your new beets.bat as its post processing script.
Also, it might be worth mentioning to create a temporary music directory (not your final library path) where SAB downloads the music to. In my example, it moves the file to E:\Music (this is not my final library directory). You can do this so that if beets can not find a match it will leave it in that temporary directory so that you can manually tag it, or even better, add the album to MusicBrainz yourself so it can be tagged correctly for others!
So after downloading an album with SAB, it will then call on beets as its post processing script and you should end up with something similar to the following:
Clicking on the View Script Log from SAB, you can see that beets tagged and changed the following tags and also added MusicBrainz MBID data etc.
Code:
E:\Music\Jeff_Beck-Best_of_Beck-CD-FLAC-1995 (14 items)
Correcting tags from:
Jeff Beck - Best of Beck CD
To:
Jeff Beck - Best of Beck
(Similarity: 98.6%) (album) (CD, 1995, US, Epic)
* Shapes Of Things -> Shapes of Things
* Plynth (Water Down The Drain) -> Plynth (Water Down the Drain)
* She's A Woman -> She's a Woman
If beets does not find a suitable match, beets will exit gracefully and the SAB script log will say "Skipping" and leave the album untouched and not moved.
That should be it, everything should now work as advertised. Remember, if beets doesn't process the album, its either because the album doesn't exist on MusicBrainz or it did not find a close enough match.