from postoffice import postoffice
import util
import logging
+import thread
+import gobject
from albumlist import TrackList
from playlists import add_to_playlist
-from fetcher import fetcher
+from fetcher import Fetcher
import webbrowser
if self.fetcher:
self.fetcher.stop()
self.fetcher = None
- self.fetcher = Fetcher(jamaendo.starred_radios, self,
- on_item = self.on_radio_result,
- on_ok = self.on_radio_complete,
- on_fail = self.on_radio_complete)
+ self.fetcher = Fetcher(lambda: jamaendo.get_tracks(self.album.ID), self,
+ on_item = self.on_track_result,
+ on_ok = self.on_track_complete,
+ on_fail = self.on_track_complete)
self.fetcher.start()
def on_track_result(self, wnd, item):
if albumid == self.album.ID and size == 300:
self.cover.set_from_file(cover)
-
def on_add_to_playlist(self, button, user_data=None):
add_to_playlist(self, self.tracklist)
return btn
def on_goto_artist(self, btn):
- artist = jamaendo.get_artist(int(self.album.artist_id))
- self.open_item(artist)
+ def threadfun(wnd, artist_id):
+ try:
+ artist = jamaendo.get_artist(artist_id)
+ def oncomplete(wnd, artist):
+ wnd.open_item(artist)
+ hildon.hildon_gtk_window_set_progress_indicator(wnd, 0)
+ gobject.idle_add(oncomplete, wnd, artist)
+ except:
+ def onfail(wnd):
+ hildon.hildon_gtk_window_set_progress_indicator(wnd, 0)
+ gobject.idle_add(onfail, wnd)
+ hildon.hildon_gtk_window_set_progress_indicator(self, 1)
+ thread.start_new_thread(threadfun, (self, int(self.album.artist_id)))
def on_download(self, btn):
banner = hildon.hildon_banner_show_information(self, '', "Opening in web browser")