Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

My music collection has grown to now approx. 4000 files over the years. They mostly consist of mp3 downloaded from different online shops at various bitrates, mp3 ripped from CDs I own, and DRM-free m4a files from iTunes.

In case this matters, I made quite some effort to have my files orderly saved with the following pattern:

/shared/music/artist/album/track# title.mp3

Now I plan to upload these to a cloud music service (I was thinking of Google Play). I understand that these services are capable of not actually uploading the music data from my files but rather just provide a link to songs they already have on their servers.

This is fine as because of limited bandwith, and because of a possible violation of copyright laws in my country I do not want my music files to be uploaded anywhere.

Also I do not want my files to end up like this:

/artist/album/track# title1.mp3
/artist/collection/sometrack# title2.mp3
/artist/best_of/yetanothertrack# title3.mp3
/artist/bonusalbum_from_japan_only/specialtrack# title4.mp3

How would I have to prepare my music collection to be properly recognized by the service? What applications are available to aid me in doing so?

share|improve this question
add comment

5 Answers

up vote 5 down vote accepted
+100

Testing with Google Music, I realized that it's all about the ID3 tag. Whatever you put there, Google uses it. it doesn't matter what the name of your files are, it's all about the ID3. Even if you have songs where the Artist and Album Artist are different, Google will display both correctly without any confusion. I suggest that you organize your music exactly the way you want it. It seems that Google is following the ID3 standard pretty good, so as long as you also follow that standard your fine.

I also have a similar structure and I'm pretty obsessed on how my music should be organized, not only file names, but also the metadata.

I use two programs to achieve this: for a few changes to a few files, use kid3-qt. It doesn't have any dependencies on kde and it's the best ID3 tag software in Ubuntu. You have many options to tag your data from the file name or vice-versa. You can see all the ID3 tags (because software as easytag hide the ones they don't know). You can even select the version of ID3 and text encoding, so you're whole collection is standard. I used ID3v2.4 with UTF8. You can install kid3-qt here: http://apt.ubuntu.com/p/kid3-qt

For your case, I recommend using a script and use eyeD3 for it. It uses python and has amazing capabilities, and can access almost any tag in ID3. You can use eyeD3 directly from the command-line but I find it more powerful when you create a script with python. You can install eyeD3 by clicking here: http://apt.ubuntu.com/p/eyed3

The webpage has sample python scripts on how to use it in a script. I'm posting an example script that puts all the artist, album, track# and title in the ID3 following the format of your music directory. It saves the tag in ID3v2.4 with UTF8 encoding You should run the script in your root music folder (/shared/music/).

#! /usr/bin/python
import fnmatch
import os
import eyeD3

audiofile = eyeD3.Tag()

for root, dirnames, filenames in os.walk('.'):

    # Linking of ID3 tags and fixing Images
    for file in fnmatch.filter(filenames, '*.mp3'):

        # Splits the directory name
        dirSplit = root.split('/')
        fileSplit = file.split(' ',1)

        # Linking of tags
        audiofile.link(root + "/" + file, eyeD3.ID3_V2)

        audiofile.setTextEncoding(eyeD3.UTF_8_ENCODING)

        print fileSplit[0]

        # Setting the Artist, album, number and title
        audiofile.setArtist(dirSplit[1])
        audiofile.setAlbum(dirSplit[2])
        audiofile.setTrackNum([fileSplit[0]])
        audiofile.setTitle(fileSplit[1])

        audiofile.do_tdtg = 0     # set to not use the TDTG frame
        audiofile.update(eyeD3.ID3_V2_4,0)

You can use this script as a starting point and maybe read the full filename and directory and use it to tag each one of your file exactly the way you want. If you're not as obsessive as I am with metadata, kid3-qt with the option to set the metadata as the file structure (and you can set the structure exactly how you want it) will work perfectly. BTW, you can also use eyeD3 to batch remove ID3V1.1 which I find it extremely annoying since it's such an old standard that lacks many features and people and devices should stop using it completely.

share|improve this answer
add comment

Personally I like mp3tag. It can edit all the tags with a lot of helpful functions. It can also rename files according to their metadata and even extract metadata from file names. It is a windows program but it runs flawlessly with wine.

If you want a Linux native program try easytag. It seems to have similar functionality but I've never tried it myself. It should be installable using apt-get or the software center.

share|improve this answer
    
Do you have any experience in what tags I should use for files to be recognized by a cloud service? –  Takkat Feb 25 '13 at 13:23
    
I don't have any experience but I think artist, track name/number and album name should be sufficient. –  André Stannek Feb 25 '13 at 13:43
    
There are way better options than using mp3tag which is a windows program, and an inexperience user would have to go an install wine, so even though it works for you, I don't think it's the best to recommend to newcommers. –  Felipe Mar 5 '13 at 0:05
add comment

I would do two things. Because your directory structure is so neat (compliment) I would use this structure to a) put as much information as possible in the actual file name and b) put that information in the tags.

You could rename your files artist-album-track. You could also write a bash script to rename them based on your directory structure. If you have the right ID3 1.x tags, you can use mp3info to extract the data and use it in a bash script to rename your files according to their tags to achieve a similar result.

If you want to, you could even use your directory structure to add the album and artist tags in your files. Again you can use mp3info here:

mp3info is a utility used to read and modify the ID3 tags in MPEG layer 3 (MP3) files. It can also (optionally) display various technical attributes of the MP3 file.

share|improve this answer
add comment

This may be completely off-base, but I've used a program called Picard from Musicbrainz that allows you to add tags and artwork to files. It's exceptionally good at figuring out what files are which.

It's available here: http://musicbrainz.org/doc/MusicBrainz_Picard

share|improve this answer
    
Do cloud services recognize tracks and albums correctly when re-tagged from Picard? –  Takkat Mar 4 '13 at 7:13
    
I know my Logitech Squeezebox can handle the re-tagging. Not sure what other cloud services will do with that information as I don't use them. –  CraigM Mar 4 '13 at 12:01
add comment

Remark: I wanted to edit my other answer, but this tool deserves a separate answer for future reference.

For users that have metadata in their mp3s (which is often the case when music is bought legally), it is possible to rename the files based on the metadata.

There is an excellent package which does renaming based on metadata for music and images: pyRenamer. One can install it using sudo apt-get install pyrenamer.

It essentially uses regular expressions and metadata to rename files. You can thus rename the files to include the information available in the metadata. Here is a screenshot.

A screenshot of PyRenamer

This also works for images.

Sources:

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.