Solution for Music Scanner Woes

How to fix music scanner problems
So a lot of people are having problems with the music scanner, and I dug through the logs and figured out what is causing the problem. My iTunes has a lot of music that doesn't have a track number before the track name, i.e., "Artist/Album/Track_Name.mp3" and the scanner will only read music files in the format "Artist/Album/01 - Track_Name.mp3"

In the "Plex Music Scanner.py" file, I found these few lines of code,


# 01 - Track.mp3<br />
trackRx1 = '([0-9]{2})[-. ]*(.*)\.[a-z0-9]{3,4}'<br />
<br />
# Artist - 01 - Track.mp3<br />
trackRx2 = '.*[-. ]+([0-9]{2})[-\. ]+(.+)\.[a-z0-9]{3,4}'<br />
<br />
# 01 - Artist - Track.mp3 ALSO CHECKED IN getTitleTrack<br />




I changed the first regex to


trackRx1 = '(.*)\.[a-z0-9]{3,4}'<br />




to try and solve the problem, but no dice. Admittedly, I'm not very good at regex, so someone with a little more experience than me, how can I adjust the regex to read any audio file name instead of just those that have a track number ahead of it?

I checked quickly (I love regex), but I think this issue is due to the fact that 2 results are expected with each regex.

The first ones matches the track number, and the track name. Yours only matches the track name.



And it’s used like this in the code:


  for rx in trackRxs:<br />
    match = re.match(rx, file, re.IGNORECASE)<br />
    if match:<br />
      info = [match.group(2), int(match.group(1))]



Your best bet would be to change the function getTitleTrack to this:

def getTitleTrack(filename):<br />
  return [os.path.splitext(filename)[0], 0]


This will put the complete file name in the info.

Nice, thanks for the help, guys!

Actually, MP3 tracks are scanned in even if they don’t have track numbers on them, as long as it has ID3 tags for that. I suspect something else is the matter.



Not sure what you updated but now the music scanner appears to be picking up everything! Excellent work!

Plex Music Scanner appears to throw out tons of my songs. No obvious reason.

Any help is appreciated.

If log would help pls let me know.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.