I have this dictionary called audio that displays information about MP3 files in unicode. I used str() to turn the album and title values into strings.
alb = []
trck = []
audio = MP3(fullname)
albums = (str(audio['TALB'])) #TALB is the album key
tracks = (str(audio['TIT2'])) #Track key
trck = trck.append(tracks)
alb = alb.append(album)
When I print the result after the sixth line, it dumps out all the album and tracks titles of 5000+ songs. After that, I'd like to add the tracks and albums to separate lists so I use append() however I get an error. Are there any alternatives? Also I've tried creating a list straight from the dict using .iteritem() but all the values are in unicode so it's harder to organize. Plus, it creates a separate array for each .mp3 file.
I'm relatively new to Python so any help regarding my issue would be appreciated.
MORE INFO:
The audio dictionary gives me about 5000+ lines of something looking like this when I print it out:
{'TDRC': TDRC(encoding=3, text=[u'1993']), 'TIT2': TIT2(encoding=3, text=[u'All I Wanna Do']), 'TRCK': TRCK(encoding=3,
text=[u'9']), 'TPE1': TPE1(encoding=3, text=[u'Sheryl Crow']), 'TALB': TALB(encoding=3, text=[u'Tuesday Night Music Club
']), 'TSSE': TSSE(encoding=3, text=[u'Xiph.Org libVorbis I 20070622']), 'TCON': TCON(encoding=3, text=[u'Rock'])}
So after using str() on say, all the TIT2 keys, printing it out gives me only the values of every TIT2 key in the audio dictionary.
Tricky Kid
Vent
A Groovy Kind Of Love
Do You know The Way To San Jose?
Jamaica
I (Who Have Nothing)
River Deep - Mountain High
Spanish Harlem
Ten Lonely Guys
Will You Love Me Tomorow
Cry
In The Sand
Michel
My Friend
The Dark
Let It Ride
Urban Solitude
Be A Man
And so on. Next, I try to append these results to the empty list trck[].
trck.append(tracks)
print trck
When I print it out, I get this:
['Tricky Kid']
['Vent']
['A Groovy Kind Of Love']
['Do You know The Way To San Jose?']
['Jamaica']
['I (Who Have Nothing)']
['River Deep - Mountain High']
['Spanish Harlem']
['Ten Lonely Guys']
['Will You Love Me Tomorow']
['Cry']
['In The Sand']
['Michel']
['My Friend']
['The Dark']
['Let It Ride']
['Urban Solitude']
['Be A Man']
When I print track[0], it gives me all 5000 songs and trck[1] is out of range. How can I fix this?
arraymodule in Python as well.