def add_song_to_playlist(self, song, list_name='Default'): liststore = self.tabs[list_name].liststore rid = song['rid'] path = self.get_song_path_in_liststore(liststore, rid) if path is not None: return liststore.append(Widgets.song_dict_to_row(song))
def add_song_to_playlist(self, song, list_name='Default'): liststore = self.tabs[list_name].liststore rid = song['rid'] path = self.get_song_path_in_liststore(liststore, rid) if path > -1: return liststore.append(Widgets.song_dict_to_row(song))
def start(): tree.freeze_child_notify() for song in songs: rid = song['rid'] path = self.get_song_path_in_liststore(liststore, rid) if path > -1: continue liststore.append(Widgets.song_dict_to_row(song))
def append_cached_song(self, song): ''' When a new song is cached locally, call this function. Insert a new item to database and liststore_cached. ''' # check this song already exists. req = self.get_song_from_cached_db(song['rid']) if req: return song_list = Widgets.song_dict_to_row(song) sql = 'INSERT INTO `songs` values(?, ?, ?, ?, ?, ?)' self.cursor.execute(sql, song_list) self.tabs['Cached'].liststore.append(song_list)
def cache_song(self, song): rid = song['rid'] # first, check if this song exists in cached_db #req = self.get_song_from_cached_db(rid) #if req is not None: # print('local cache exists, quit') # return # second, check song in caching_liststore. liststore = self.tabs['Caching'].liststore #path = self.get_song_path_in_liststore(liststore, rid) #if path is not None: # return liststore.append(Widgets.song_dict_to_row(song))
def play_song(self, song, list_name='Default'): if not song: return liststore = self.tabs[list_name].liststore rid = song['rid'] path = self.get_song_path_in_liststore(liststore, rid) if path is not None: # curr_playing contains: listname, path self.curr_playing = [list_name, path] song = Widgets.song_row_to_dict(liststore[path], start=0) self.app.player.load(song) return liststore.append(Widgets.song_dict_to_row(song)) self.curr_playing = [list_name, len(liststore)-1, ] self.app.player.load(song)
def play_song(self, song, list_name='Default', use_mv=False): if not song: return if not list_name: list_name = 'Default' liststore = self.tabs[list_name].liststore rid = song['rid'] path = self.get_song_path_in_liststore(liststore, rid) if path > -1: # curr_playing contains: listname, path self.curr_playing = [list_name, path] song = Widgets.song_row_to_dict(liststore[path], start=0) else: liststore.append(Widgets.song_dict_to_row(song)) self.curr_playing = [list_name, len(liststore)-1, ] self.locate_curr_song(popup_page=False) if use_mv is True: self.app.player.load_mv(song) else: self.app.player.load(song)
def play_song(self, song, list_name='Default', use_mv=False): if not song: return if not list_name: list_name = 'Default' liststore = self.tabs[list_name].liststore rid = song['rid'] path = self.get_song_path_in_liststore(liststore, rid) if path > -1: # curr_playing contains: listname, path self.curr_playing = [list_name, path] song = Widgets.song_row_to_dict(liststore[path], start=0) self.app.player.load(song) return liststore.append(Widgets.song_dict_to_row(song)) self.curr_playing = [list_name, len(liststore)-1, ] self.locate_curr_song(popup_page=False) if use_mv: self.app.player.load_mv(song) else: self.app.player.load(song)
def add_song_to_playlist(self, song, list_name='Default'): liststore = self.tabs[list_name].liststore if self.check_song_in_playlist(song, list_name): return liststore.append(Widgets.song_dict_to_row(song))
def cache_song(self, song): rid = song['rid'] liststore = self.tabs['Caching'].liststore liststore.append(Widgets.song_dict_to_row(song))
def cache_song(self, song): rid = song['rid'] liststore = self.tabs['Caching'].liststore liststore.append(Widgets.song_dict_to_row(song)) if not self.cache_enabled: self.switch_caching_daemon()
def cache_song(self, song): '''Add song to cache playlist''' rid = song['rid'] liststore = self.tabs['Caching'].liststore liststore.append(Widgets.song_dict_to_row(song)) self.start_caching_daemon()