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

Come up with a useful post-processing script? Share it here!
Post Reply
zakharm
Release Testers
Release Testers
Posts: 56
Joined: September 29th, 2008, 1:08 pm

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

Post 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*
Last edited by zakharm on December 21st, 2011, 12:46 pm, edited 5 times in total.
Write album art post processing script
JayBird
Jr. Member
Jr. Member
Posts: 82
Joined: August 18th, 2008, 3:21 am

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

Post by JayBird »

This looks great, thanks for sharing. Gonna test it out now!
rAf
Moderator
Moderator
Posts: 546
Joined: April 28th, 2008, 2:35 pm
Location: France
Contact:

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

Post by rAf »

Great script !
Working fine on Mac.
Just have to chmod +x your script.
zakharm
Release Testers
Release Testers
Posts: 56
Joined: September 29th, 2008, 1:08 pm

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

Post 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.
Write album art post processing script
JayBird
Jr. Member
Jr. Member
Posts: 82
Joined: August 18th, 2008, 3:21 am

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

Post by JayBird »

I havent manage to test this out yet, but does it only do the album art? no artist and title imformation?
zakharm
Release Testers
Release Testers
Posts: 56
Joined: September 29th, 2008, 1:08 pm

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

Post 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.
Write album art post processing script
JayBird
Jr. Member
Jr. Member
Posts: 82
Joined: August 18th, 2008, 3:21 am

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

Post 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
zakharm
Release Testers
Release Testers
Posts: 56
Joined: September 29th, 2008, 1:08 pm

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

Post 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.
Write album art post processing script
JayBird
Jr. Member
Jr. Member
Posts: 82
Joined: August 18th, 2008, 3:21 am

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

Post by JayBird »

Yeah, that could be nice!

Is there any possibilty of auto importing downloaded music into the iTunes library?!
zakharm
Release Testers
Release Testers
Posts: 56
Joined: September 29th, 2008, 1:08 pm

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

Post 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.
Write album art post processing script
JayBird
Jr. Member
Jr. Member
Posts: 82
Joined: August 18th, 2008, 3:21 am

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

Post 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/
zakharm
Release Testers
Release Testers
Posts: 56
Joined: September 29th, 2008, 1:08 pm

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

Post 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.
Write album art post processing script
stanpete
Jr. Member
Jr. Member
Posts: 95
Joined: February 2nd, 2008, 11:35 am

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

Post 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
zakharm
Release Testers
Release Testers
Posts: 56
Joined: September 29th, 2008, 1:08 pm

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

Post 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?
Write album art post processing script
stanpete
Jr. Member
Jr. Member
Posts: 95
Joined: February 2nd, 2008, 11:35 am

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

Post 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
Post Reply