Beispiel #1
0
def _get_id3_dict(mp3) :
    '''Returns title, artist, album, tracknum & compilation ID3 tags from <mp3> file arg.'''
    id3_dict = dict()
    (title, artist, album, tracknum, compilation) = id3.id3v2_getval(mp3, ('title', 'artist', 'album', 'tracknum', 'compilation'))
    id3_dict['title'] = title
    id3_dict['artist'] = artist
    id3_dict['album'] = album
    try :
        id3_dict['tracknum'] = int(tracknum)
    except :
        id3_dict['tracknum'] = 0
    id3_dict['compilation'] = compilation
    
    # check that theres info. in the ID3 tags 
    empty = True # if this remains True, we have empty tags [same as _empty_tags()]
    for tag in id3_dict:
        if tag:
            empty = False
            break
    
    id3_dict['empty'] = empty
    return id3_dict
def read_tags_using_eyeD3(filename):
    tagnames = ('title', 'artist', 'album', 'tracknum', 'compilation')
    tagdict = dict((x, mp3_eyeD3.id3v2_getval(filename, x)) for x in tagnames)
    return tagdict
def read_tags_using_eyeD3(filename):
    tagnames = ('title', 'artist', 'album', 'tracknum', 'compilation')
    tagdict = dict((x, mp3_eyeD3.id3v2_getval(filename, x)) for x in tagnames)
    return tagdict