Created
February 10, 2010 20:07
-
-
Save matagus/300785 to your computer and use it in GitHub Desktop.
how to get unique artists and albums in exaile 0.3.1 beta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [88]: from xl import collection, xdg | |
In [89]: c = collection.Collection("Collection", location=os.path.join(xdg.get_data_dirs()[0], 'music.db')) | |
In [90]: from xl.trax.track import Track | |
In [91]: albums = set() | |
In [92]: artists = set() | |
In [93]: for filename in c.tracks.keys(): | |
....: track = Track(filename) | |
....: artists.add(track.get_tag_display("artist")) | |
....: albums.add(track.get_tag_display("album")) | |
....: | |
....: | |
In [94]: artists | |
Out[94]: | |
set([u'Al Green', | |
u'Bonnie "Prince" Billy', | |
u"Bonnie 'Prince' Billy", | |
u"Collection D'Arnell Andr\xe9a", | |
u'Dark Alley Gospel', | |
u"Dead Man's Bones", | |
u'El Ni\xf1o Gusano', | |
u'Hope Sandoval & The Warm Inventions', | |
u"Jim O'Rourke", | |
u'Marilyn Manson & The Spooky Kids', | |
u'Novos Baianos e Baby Consuelo', | |
u'Pia Fraus', | |
u'PluPaRT', | |
u'Porcupine Tree', | |
u'Pram', | |
u'Sebastian Kramer', | |
u'The Aliens', | |
u'The Flaming Lips', | |
u'pram ']) | |
In [95]: albums | |
Out[95]: | |
set([u'Barcos Y Jirafas', | |
u'Barcos y Jirafas', | |
u'Beware', | |
u'Circo Luso', | |
u'Cirses Des Champs', | |
u"Dead Man's Bones", | |
u'El Cuarto De Leo BSO', | |
u'Embryonic', | |
u'Fant\xe1stico Entre Los Pinos', | |
u'Gaia Theory', | |
u'Greatest Hits', | |
u'I See a Darkness', | |
u'LUNCH BOXES & CHOKLIT COWS', | |
u'Luna', | |
u'Mooie Island EP', | |
u'No Final Do Juizo', | |
u'Sargasso Sea', | |
u'Tamper', | |
u'The Incident', | |
u'Through The Devil Softly', | |
u'Yoshimi Battles The Pink Robots', | |
u'the moving frontier', | |
u'\xc1lbum desconocido (21/04/2006 10:31:57 p.m.)']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment