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.

2
  • 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? Sep 29, 2016 at 4:15
  • @SteveBarnes the original artists are stored in the artist meta, not track name. Remixers are only stored in the track name Sep 29, 2016 at 12:12

1 Answer 1

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.

2
  • The remixes are formatted in (Foo Bar Remix) almost exclusively. I would think a (in JS) .indexOf would work fine for a rough estimate Sep 29, 2016 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. Sep 30, 2016 at 4:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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