How might I gather all the songs in my music library (maintained in iTunes) on Mac OS X 10.8.5 with ID3 title tags (I guess? their titles in iTunes) that consist of 4 random capital letters. Or all the ones whose titles are 4 characters long, case insensitive, or mixed character types... if they're just 4 in length... anything that could help me narrow it down to that specific criteria. My whole iTunes music library is contained within one folder, to be clear, so anything that could identify these for me within a particular folder will work. Thanks much.

How much python do you know? What have you tried? You can walk a directory like this:

import os
for root, dirs, files in os.walk('/my_directory'):
    for filename in files:
        if not filename.endswith('.mp3'):
            continue
        fullpath = os.path.join(root, filename)
        print('Found mp3 file: {}'.format(fullpath))

After that, there is the re module for regex, or simply str.startswith() and str.endswith(), or len(str). There are a lot of ways to do this. For the ID3 tags there is Mutagen and a bunch of other libraries that would help.

If you get stuck, come back for help (with a small code example to explain your problem).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.