Ejemplo n.º 1
0
    def on_search(self, w):
        mode = self.mode.get_active()
        txt = self.entry.get_text()
        self.musiclist.set_loading(False)
        self.musiclist.empty_message = "Searching..."
        self.musiclist.get_model().clear()

        if self.fetcher:
            self.fetcher.stop()
            self.fetcher = None

        itemgen = None
        if mode == 0:
            itemgen = lambda: jamaendo.search_artists(query=txt)
        elif mode == 1:
            itemgen = lambda: jamaendo.search_albums(query=txt)
        elif mode == 2:
            itemgen = lambda: jamaendo.search_tracks(query=txt)
        else:
            return

        self.fetcher = Fetcher(itemgen, self,
                               on_item = self.on_add_result,
                               on_ok = self.on_add_complete,
                               on_fail = self.on_add_complete)
        self.fetcher.start()
        '''
Ejemplo n.º 2
0
 def query_artists(self):
     result = jamaendo.search_artists(sys.argv[2])
     pp.pprint([(a.ID, a.name) for a in result])
     for a in result:
         albums = jamaendo.get_albums(a.ID)
         for album in albums:
             print "Playing album: %s - %s" % (a.name, album.name)
             self.play_album(album)