mp3 batch tagging, renaming, and moving Scripts

General discussions.

Moderator: moderators

mp3 batch tagging, renaming, and moving Scripts

Postby jaquense » Mon Apr 11, 2011 9:31 pm

I've made a few python scripts to help handle some batch mp3 file organization operations for my SS server. I thought I'd share them with the community. Especially for those of you who have a headless server, or administrate via ssh (I do a lot). And sorry Linux systems only.

The mtag.py script lets you batch rename, set tags, move files, and analysis tags. It's not a grand leap in functionality from your basic CL commands it just simplifies stuff a bit.

These are very much tailored to my personal methods and preferences so I have no idea if anyone will find them useful, but more info is better then none so take a look. Maybe you can use them maybe not! Also this is absolutely my first use of python ever, so they are hacky, and probably offend convention all over the place.

download: https://github.com/Ananke/mtag

The scripts depend on another pkg called eyeD3 which is a great CLI for handling music files. My scripts overlap eyeD3 in some functionality: specifically in the tagging and conversion. The scripts are mainly to simplify eyeD3 output to only the stuff I immediately care about.

The functionality I've added is really in tag analysis. mtag -o will print out a list (by folder) of tags: Artist, Album, Genre, Year and tell you how many times particular tags occur. It lets you, at-a-glance determine whether any of these tags are different.

Example
DIR: /Brandi Carlilie/
Code: Select all
$ ls
The Story  Give Up The Ghost  Brandi Carlile

Code: Select all
$ mtag -Ro

Ocurrances of Tags in Folder(s)
------------------------------------------------------------
../The Story $ 13 file(s)
   Artists:                   |  Albums:                       |  Genres:                 |  Years:         
      (13) x Brandi Carlile   |     (13) x The Story   |     (13) x Indie (131)   |     (12) x 2007       
                              |                        |                          |     (1) x [Empty Tag] 

../Brandi Carlile $ 10 file(s)
   Artists:                   |  Albums:                       |  Genres:                 |  Years:         
      (10) x Brandi Carlile   |     (10) x Brandi Carlile      |     (10) x Pop (13)      |     (10) x 2005 

../Give Up The Ghost $ 11 file(s)
   Artists:                   |  Albums:                       |  Genres:                 |  Years:         
      (9) x Brandi Carlile    |     (11) x Give Up The Ghost   |     (10) x Soul (42)     |     (11) x 2009 
      (2) x brandi carlile    |                                |     (1) x Folk (80)      |   

The point being I can quickly see if I have any mis-tagged files.
First I can see that my genres are all different accross the three albums. also I see that in "Give Up The Ghost" I have 2 files with the 'wrong artist' (they are lowercase)

now I try:
Code: Select all
$ mtag -Rm
Files with Missing Information
------------------------------------------------------------
../The Story $
  10 Brandi Carlile- The Story - Until I Die.mp3 ...Title
-----------------------------------------------------------------------
../Brandi Carlile $
   No Missing Tags!

../Give Up The Ghost $
   No Missing Tags!

I can see that one file is missing a TRACK tag

I have my subsonic music folders all in one dir /var/music/subsonic/
I am assuming many of you have a similar setup.

Code: Select all
$ ls /var/music/subsonic/
country  good  pop  rap  seasonal  spoken  traditional  upload  video

all of these directories are valid destinations to move files to with mtag (you can set your own base music folder in settings.py)

if I want to move all of my Brandi Carlilie files I can use
Code: Select all
$ mtag -Rd good

and the script will move the files based on there album and artist tags so I'll get
../good/Brandi Carlilie/Give Up The Ghost
../good/Brandi Carlilie/The Story
../good/Brandi Carlilie/Brandi Carlilie

each with the mp3's bearing those artist/album tags in them.

You can also rename files according tags. I have it set to: "Track Artist - Album: Title.mp3"

There is a couple more things, to check em out just check the --help option of mtag.py
jaquense
 
Posts: 47
Joined: Tue Dec 28, 2010 7:06 pm

Return to General

Who is online

Users browsing this forum: No registered users and 4 guests