Yes, it was probably just a typeo on my part.

I’ve now fixed the majority of cases but still got two strings that look 
identical but fail to match, this time (again by 10cc), “I’m Mandy Fly Me”.

I’m putting money on it being a utf8 problem but I’m stuck on how to handle it. 
It’s probably the single quote in I’m, although it has worked with other songs.

Any ideas?

All the Best
Cheers
Dave

Here is the whole function/method or whatever it’s called in Python:

################################################################################
#
#   checkMusicFiles
#
################################################################################
def checkMusicFiles(theBaseMusicLibraryFolder):
    myArtistDict = []

#
#  Loop thru Artists Folder
#
    myArtistsFoldlerList = getFolderList(theBaseMusicLibraryFolder)
    myArtistCount = 0
    for myArtistFolder in myArtistsFoldlerList:
        print('Artist: ' + myArtistFolder)
#
#  Loop thru Albums Folder
#
        myAlbumList = getFolderList(theBaseMusicLibraryFolder + myArtistFolder)
        for myAlbum in myAlbumList:
            print('Album: ' + myAlbum)

#
#  Loop thru Tracks (Files) Folder
#
            myAlbumPath = theBaseMusicLibraryFolder + myArtistFolder + '/' + 
myAlbum + '/'
            myFilesList = getFileList(myAlbumPath)
            for myFile in myFilesList:
                myFilePath = myAlbumPath + myFile
                myID3 = eyed3.load(myFilePath)
                if myID3 is None:
                    continue

                myArtistName = myID3.tag.artist
                if myArtistName is None:
                    continue

                myAlbumName = myID3.tag.album
                if myAlbumName is None:
                    continue

                myTitleName = myID3.tag.title
                if myTitleName is None:
                    continue

                myCompareFileName = myFile[0:-4]
                if myCompareFileName[0].isdigit() and 
myCompareFileName[1].isdigit():
                    myCompareFileName = myFile[3:-4]

                if myCompareFileName != myTitleName:
                    myLength1 = len(myCompareFileName)
                    myLength2 = len(myTitleName)
                    print('File Name Mismatch - Artist: [' + myArtistName + ']  
Album: ['+ myAlbumName + ']  Track: [' + myTitleName + ']  File: [' + 
myCompareFileName + ']')
                    if (myLength1 == myLength2):
                        print('lengths match: ',myLength1)
                    else:
                        print('lengths mismatch: ',myLength1,'  ',myLength2)

                        print('     ')




    return myArtistsFoldlerList






> On 8 Jun 2022, at 00:07, MRAB <pyt...@mrabarnett.plus.com> wrote:
> 
> On 2022-06-07 21:23, Dave wrote:
>> Thanks a lot for this! isDigit was the method I was looking for and couldn’t 
>> find.
>> I have another problem related to this, the following code uses the code you 
>> just sent. I am getting a files ID3 tags using eyed3, this part seems to 
>> work and I get expected values in this case myTitleName (Track name) is set 
>> to “Deadlock Holiday” and myCompareFileName is set to “01 Deadlock Holiday” 
>> (File Name with the Track number prepended). The is digit test works and 
>> myCompareFileName is set to  “Deadlock Holiday”, so they should match, right?
> OT, but are you sure about that name? Isn't it "Dreadlock Holiday" (by 10cc)?
> 
> [snip]
> -- 
> https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to