Пример #1
0
                    if frame.header.id == 'TPOS':
                        gotTPOS = True
                    if frame.header.id == 'TPE2':
                        gotTPE2 = True
                        
                if cover and not gotCover:
                    tag.link(mp3file)
                    print "Adding cover to MP3 ID3 tags"
                    tag.addImage(3, coverfilename, u"cover")
                    needsUpdate = True
                    
                if not gotTPE2:
                    print "Updating TPE2 fields"
                    tpe2Header = FrameHeader(tag.header)
                    tpe2Header.id = "TPE2"
                    tpe2 = TextFrame(tpe2Header)
                    tpe2.text = discMeta.artist
                    tag.frames.append(tpe2)
		    needsUpdate = True
                    
                if not gotTPOS:
                    print "Updating TPOS/TRCK fields"
                    tposHeader = FrameHeader(tag.header)
                    tposHeader.id = "TPOS"
                    tpos = TextFrame(tposHeader)
                    tpos.text = "%d/%d" % discMeta.discNumber
                    tag.frames.append(tpos)

                    # Also update the TRCK to be in x/y format
                    tag.frames["TRCK"][0].text = "%d/%d" % (trackNum, len(discMeta.tracks))
                    needsUpdate = True
Пример #2
0
                tag.link(mp3file)

                gotTSO2 = False
                needsUpdate = False

                for frame in tag.frames:
                    if frame.header.id == 'TSO2':
                        gotTSO2 = True

                if not gotTSO2:
                    try:
                        print "Updating TSO2 fields"
                        tpe2Header = FrameHeader(tag.header)
                        tpe2Header.id = "TSO2"
                        tpe2 = TextFrame(tpe2Header)
                        tpe2.text = discMeta.artistSort if 'artistSort' in dir(
                            discMeta) else discMeta.artist
                        tag.frames.append(tpe2)
                        needsUpdate = True
                    except:
                        print "SOMETHING WENT BAD :("

                if needsUpdate:
                    try:
                        tag.setTextEncoding(UTF_8_ENCODING)
                        tag.update()
                    except:
                        print "FAILED first time -- trying again"
                        try:
                            sleep(1.0)
Пример #3
0
                    if frame.header.id == 'TPOS':
                        gotTPOS = True
                    if frame.header.id == 'TPE2':
                        gotTPE2 = True

                if cover and not gotCover:
                    tag.link(mp3file)
                    print "Adding cover to MP3 ID3 tags"
                    tag.addImage(3, coverfilename, u"cover")
                    needsUpdate = True

                if not gotTPE2:
                    print "Updating TPE2 fields"
                    tpe2Header = FrameHeader(tag.header)
                    tpe2Header.id = "TPE2"
                    tpe2 = TextFrame(tpe2Header)
                    tpe2.text = discMeta.artist
                    tag.frames.append(tpe2)
                    needsUpdate = True

                if not gotTPOS:
                    print "Updating TPOS/TRCK fields"
                    tposHeader = FrameHeader(tag.header)
                    tposHeader.id = "TPOS"
                    tpos = TextFrame(tposHeader)
                    tpos.text = "%d/%d" % discMeta.discNumber
                    tag.frames.append(tpos)

                    # Also update the TRCK to be in x/y format
                    tag.frames["TRCK"][0].text = "%d/%d" % (
                        trackNum, len(discMeta.tracks))
Пример #4
0
                tag.link(mp3file)
                
                gotTSO2 = False
                needsUpdate = False
                
                for frame in tag.frames:
                    if frame.header.id == 'TSO2':
                        gotTSO2 = True
                
                if not gotTSO2:
                    try:
                        print "Updating TSO2 fields"
                        tpe2Header = FrameHeader(tag.header)
                        tpe2Header.id = "TSO2"
                        tpe2 = TextFrame(tpe2Header)
                        tpe2.text = discMeta.artistSort if 'artistSort' in dir(discMeta) else discMeta.artist
                        tag.frames.append(tpe2)
                        needsUpdate = True
                    except:
                        print "SOMETHING WENT BAD :("
                    
                if needsUpdate:
                    try:
                        tag.setTextEncoding(UTF_8_ENCODING)
                        tag.update()
                    except:
                        print "FAILED first time -- trying again"
                        try:
                            sleep(1.0)
                            tag.update()