0

I have 1.8k different artists in my library of 3.6k songs. I'd like to sort my artists in order of which ones I have the most tracks from, going from the artist with the most total number of tracks to the lowest.

However, I would also like this total count to include songs in which they are not the original artist but are instead the remixer (so their name is in the track title) and if they are a collaborator (so their name and another's is the artist title). My songs are not tagged with both the original artist and remixer as the artist.

How can I sort my music library in this way? What software can do this for me? I’m on Windows.

  • 1
    How is the current information stored for artist(s), re-mixer, i.e. is it in directory name, track name or in the MP3 tags? – Steve Barnes Sep 29 '16 at 4:15
  • @SteveBarnes the original artists are stored in the artist meta, not track name. Remixers are only stored in the track name – Zach Saucier Sep 29 '16 at 12:12
1

I can make a start on this with a few lines of python, it is available for windows, and the mutagen library to read the ID3 tags this can be installed with pip install mutagen.

Then a very few lines of python:

import os
import collections
import mutagen

tracks = 0  # Track Counter
counter = collections.defaultdict(int)  # Counter for the tracks by each artist

for root, dirs, names in os.walk(r'/path/to/your/collection'):  # Walks the directory tree
    for n in names:
        if n.split('.')[-1].lower() in ['mp3', ]:  # Filter for mp3 files
            p = os.path.join(root, n)
            try:
                info = mutagen.easyid3.EasyID3(p)  # Get the track info
                tracks += 1
                if info.has_key('artist'):
                    for a in info['artist']:
                        counter[a] += 1
            except Exception, e:  # NOT best practice
                print e
# Wait a few seconds
print ('Tracks Scanned', tracks)  # In my test this gave 4854 in 
byf = [(c, n) for (n, c) in counter.iteritems()]  # Convert dictionary to list
byf.sort(reverse=True)  # Sort into descending order
for n in xrange(10):  # Print top 10
    print (byf[n])

Of course this alone does not count the re-mixers but without knowing the naming convention I would have to guess how to extract the name of the artist from the track filename, I would think that regular expressions should do the trick.

  • The remixes are formatted in (Foo Bar Remix) almost exclusively. I would think a (in JS) .indexOf would work fine for a rough estimate – Zach Saucier Sep 29 '16 at 20:23
  • 1
    @ZachSaucier - Of course the above doesn't help you find which tracks are credited to a given artist but you could easily build, and save, a dictionary of paths & track titles against the artist names at the same time. I'll adjust the above code a little to add that and the Foo Bar tags. – Steve Barnes Sep 30 '16 at 4:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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