return None class OnlineMusic(): def activate(self):pass def __init__(self,source): self.source = source self.db=source.db self.entry_type=source.entry_type self.songPage=range(0,8) self.page=0 self.preference = Preference() self.listType, self.listId, self.album = self.preference.get_prefs() def deactivate(self): self.db = None self.entry_type = None self.source = None self.preference = None def add_song(self,song): entry = self.db.entry_new(self.entry_type, song['url']) self.db.set(entry, rhythmdb.PROP_TITLE, song['name']) self.db.set(entry, rhythmdb.PROP_ARTIST, song['artist']) self.db.set(entry, rhythmdb.PROP_ALBUM, song['genre']) self.db.set(entry, rhythmdb.PROP_DURATION, song['duration']) self.db.set(entry, rhythmdb.PROP_TRACK_NUMBER, song['track_number']) self.db.set(entry, rhythmdb.PROP_GENRE, song['album']) def nextPage(self): if self.page<7:self.page+=1 self.activate() def prePage(self): if self.page>=1:self.page-=1 self.activate() def reloadMusic(self): self.listType, self.listId, self.album = self.preference.get_prefs() self.activate()
def activate(self):pass def __init__(self,source): self.source = source self.db=source.db self.entry_type=source.entry_type self.songPage=range(0,8) self.page=0 self.preference = Preference()
def __init__(self, source, songs): threading.Thread.__init__(self) self.set_stop = False self.is_run = False self.source = source self.songs = songs self.db = source.db self.entry_type = source.entry_type self.preference = Preference() self.listType, self.listId, self.album = self.preference.get_prefs()
class OnlineMusic(threading.Thread): def run(self):pass def __init__(self, source, songs): threading.Thread.__init__(self) self.set_stop = False self.is_run = False self.source = source self.songs = songs self.db = source.db self.entry_type = source.entry_type self.preference = Preference() self.listType, self.listId, self.album = self.preference.get_prefs() def deactivate(self): while self.is_run: self.set_stop = True self.db = None self.entry_type = None self.source = None self.preference = None def add_song(self,song): try: aSong = Analyze.getSongByURL(song['url']) if not aSong: return entry = self.db.entry_new(self.entry_type, aSong['url']) print song print aSong self.db.set(entry, rhythmdb.PROP_TITLE, song['name']) self.db.set(entry, rhythmdb.PROP_ARTIST, song['artist']) self.db.set(entry, rhythmdb.PROP_ALBUM, song['album']) self.db.set(entry, rhythmdb.PROP_DURATION, song['duration']) #self.db.set(entry, rhythmdb.PROP_TRACK_NUMBER, song['track_number']) self.db.set(entry, rhythmdb.PROP_GENRE, self.n2str(aSong['genre'])) self.db.set(entry, rhythmdb.PROP_COMMENT, 'id=%s\nimage=%s\nlyrics=%s' % (song['id'], self.n2str(aSong['image']), self.n2str(aSong['lyrics']))) #self.db.set(entry, rhythmdb.PROP_IMAGE, aSong['image']) except Exception, e: traceback.print_exc()