示例#1
0
 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))
示例#2
0
 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))
示例#3
0
 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))
示例#4
0
 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))
示例#5
0
 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)
示例#6
0
 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))
示例#7
0
 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)
示例#8
0
 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)
示例#9
0
 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)
示例#10
0
 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))
示例#11
0
 def cache_song(self, song):
     rid = song['rid']
     liststore = self.tabs['Caching'].liststore
     liststore.append(Widgets.song_dict_to_row(song))
示例#12
0
 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()
示例#13
0
 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))
示例#14
0
 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()
示例#15
0
 def cache_song(self, song):
     rid = song['rid']
     liststore = self.tabs['Caching'].liststore
     liststore.append(Widgets.song_dict_to_row(song))
示例#16
0
 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()
示例#17
0
 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()