Page 1 of 7

Write cover album art to MP3s, organize files, iTunes import

Posted: September 29th, 2008, 1:26 pm
by zakharm
Write Album Art is a python script that embeds cover / album art into MP3s downloaded from SABnzbd. Embedding cover art into the ID3 tag is my preferred way of getting cover art to display on all the devices / software that I use to play music (iPod / iPhone, iTunes, XBMC / Plex). The script also helps to organize your music (directory structure and files names) and import your music to iTunes.

For Windows users, choose the EXE file from below. Mac / Linux users running this from the Python source code will need an Amazon AWS Key and also a secondary AWS Secret Key that you can find in your Amazon Web Services Account. You'll need to sign up for Amazon Web Services if you don't already have a login.

Features
* Fetch and store album art into MP3 within SABnzbd
* Add MP3s to iTunes
* Remove extra files (.sfv, .nfo, .m3u)
* Fill in empty ID3 tags from Newzbin title, including empty track numbers
* Nested directory structure - Music/Artist/Album
* Soundtrack support
* Remove comments from ID3 tag
* Update XBMC / Plex library
* Move file to new directory after processing
* Rename files to "01 - title.mp3" or "01 - artist - title.mp3"

Updated to v0.6.5 - 12/20/2011 - currently not working, will update this soon
Updated with Amazon Associate Tag: You can add your own associate tag, but any random string will work. I've added a default random string. (If for some reason Amazon starts requiring a valid Associate Tag you'll need to sign up for that too)


Source (v0.6.0)  - requires AMZN AWS Key and also a secondary AWS Secret Key
This works on Snow Leopard, but not tested on Leopard, Lion or on Linux.
http://dl.dropbox.com/u/17457/write_alb ... 6-dist.zip

Win EXE (v0.5)
http://cli.gs/E4Z5mE

Requirements and install details
http://kins.net/wordpress/2008/09/27/sa ... s-to-mp3s/

Updated to v0.4 - 10/31/08
Major changes
   * Windows executable now available, Python not required for Windows *NEW*
   * Configuration now in ini file: waa_conf.ini  - (to support Win32 exe) *NEW*
   * Move and rename files feature *NEW*

Re: Write cover / album art images to MP3s - Win / Mac Python script

Posted: September 29th, 2008, 1:38 pm
by JayBird
This looks great, thanks for sharing. Gonna test it out now!

Re: Write cover / album art images to MP3s - Win / Mac Python script

Posted: September 29th, 2008, 6:47 pm
by rAf
Great script !
Working fine on Mac.
Just have to chmod +x your script.

Re: Write cover / album art images to MP3s - Win / Mac Python script

Posted: September 30th, 2008, 7:38 am
by zakharm
rAf wrote: Great script !
Working fine on Mac.
Just have to chmod +x your script.
Great, thanks!
I was wondering if the permissions needed to be changed, I'll it add it to the instructions.

Re: Write cover / album art images to MP3s - Win / Mac Python script

Posted: September 30th, 2008, 8:59 am
by JayBird
I havent manage to test this out yet, but does it only do the album art? no artist and title imformation?

Re: Write cover / album art images to MP3s - Win / Mac Python script

Posted: September 30th, 2008, 9:02 am
by zakharm
JayBird wrote: I havent manage to test this out yet, but does it only do the album art? no artist and title imformation?
Yeah, the script requires that the artist and album are already in the tag.  It uses that existing information to find the album art.

Re: Write cover / album art images to MP3s - Win / Mac Python script

Posted: September 30th, 2008, 9:21 am
by JayBird
Ah yeah, silly me...how else would it find the cover.

I find a lot of stuff downloaded from usenet doesn't have any ID3 info

Re: Write cover / album art images to MP3s - Win / Mac Python script

Posted: September 30th, 2008, 10:59 am
by zakharm
I could probably look it from the Newzbin title, but there are some exceptions to look out for:  VA - Various Artists  and maybe OST - Original Soundtrack posts.

Re: Write cover / album art images to MP3s - Win / Mac Python script

Posted: September 30th, 2008, 11:11 am
by JayBird
Yeah, that could be nice!

Is there any possibilty of auto importing downloaded music into the iTunes library?!

Re: Write cover / album art images to MP3s - Win / Mac Python script

Posted: September 30th, 2008, 11:15 am
by zakharm
JayBird wrote: Is there any possibilty of auto importing downloaded music into the iTunes library?!
That is a great point.  I still don't know why you can't have a "watch" directory in iTunes.  I wonder if there is a utility for Mac / PC out there that would do it.

As for my script, I can do it if there is a Python library out there or attempt to interface with an existing Apple script.

Re: Write cover / album art images to MP3s - Win / Mac Python script

Posted: September 30th, 2008, 11:23 am
by JayBird
Is it possible to initiate an automator script from SAB?

if so i have seen a few automator scripts that import new files to itunes

e.g. http://www.robertvenema.nl/journal/arch ... -mac-os-x/

Re: Write cover / album art images to MP3s - Win / Mac Python script

Posted: September 30th, 2008, 12:17 pm
by zakharm
Just after a quick look, there might be a way on the Mac to do it without adding anything to my script.

In Finder you can set "Folder Actions" for a folder.  When files are added to the folder it will run an AppleScript that will add the files to your iTunes library.

Folder Actions and iTunes
http://dougscripts.com/itunes/itinfo/folderaction01.php

Also, there is addToLib
http://dougscripts.com/itunes/scripts/s ... p=addtolib

I haven't tried either of these, but they look promising.  I don't know if they'll recurse into the folder that SAB will add for your music.

Let me know if you have any luck with these.

Re: Write cover / album art images to MP3s - Win / Mac Python script

Posted: October 2nd, 2008, 6:17 am
by stanpete
I'm getting this:

Code: Select all

Traceback (most recent call last):
  File "/Applications/SABnzbdPlus/Scripts/write_album_art.py", line 137, in <module>
    os.remove(IMAGE)
OSError: [Errno 2] No such file or directory: '/usenet/downloads/Music/<test>/album_cover.jpg'
( was changed by me)

Any idea what's wrong ? Did everything as described and got the Amazon Key...

st

Re: Write cover / album art images to MP3s - Win / Mac Python script

Posted: October 2nd, 2008, 7:23 am
by zakharm
stanpete wrote: I'm getting this:

Code: Select all

Traceback (most recent call last):
  File "/Applications/SABnzbdPlus/Scripts/write_album_art.py", line 137, in <module>
    os.remove(IMAGE)
OSError: [Errno 2] No such file or directory: '/usenet/downloads/Music/<test>/album_cover.jpg'
( was changed by me)

Any idea what's wrong ? Did everything as described and got the Amazon Key...

st
I don't have a check in there to see if album_cover.jpg actually exists when it tries to remove it.  It probably means that it didn't go out to Amazon to fetch your cover.  It will say "Fetch art from AMZN" or something when it does go out to Amazon.

Did the MP3s have Artist and Album in the tag?

Re: Write cover / album art images to MP3s - Win / Mac Python script

Posted: October 2nd, 2008, 9:15 am
by stanpete
Oh, it said "Fetch art from AMZN" right above my error message. Forgot to include it in my post.
And yes, the files had all the important information.

Don't get it...

st