def __on_db_loaded(self, db): if not MediaDB.get_playlists(): MediaDB.create_playlist("local", _("Default List")) # From MediaDB loaded playlists. init_items = [ListTreeItem(pl) for pl in MediaDB.get_playlists()] self.category_list.add_items(init_items) # Init Category_list. self.category_list.set_highlight_item( self.get_categroy_item_by_index(self.get_save_item_index())) self.current_item = self.category_list.get_highlight_item() self.delete_source_id = self.current_item.song_view.connect( "delete-select-items", self.parser_delete_items) self.drag_source_id = self.current_item.song_view.connect( "drag-data-received", self.parser_drag_event) self.menu_source_id = self.current_item.song_view.connect( "right-press-items", self.popup_detail_menu) Player.set_source(self.current_item.song_view) self.right_box.add(self.current_item.get_list_widget()) self.category_list.check_view_status() self.list_paned.show_all()
def save_to_library(self): if self.search_flag: self.reset_search_entry() MediaDB.full_erase_playlists() for item in self.category_list.get_items(): if item.udi is not None: continue songs = item.get_songs() name = item.get_title() MediaDB.create_playlist("local", name, songs)
def leading_in_list(self): uri = WindowLoadPlaylist().run() try: p_name = utils.get_filename(uri) pl = MediaDB.create_playlist("local", p_name, []) new_item = ListTreeItem(pl) self.category_list.add_items([new_item]) new_item.song_view.async_add_uris(uri) except: pass
def __on_db_loaded(self, db): if not MediaDB.get_playlists(): MediaDB.create_playlist("local", _("Default List")) # From MediaDB loaded playlists. init_items = [ListTreeItem(pl) for pl in MediaDB.get_playlists()] self.category_list.add_items(init_items) # Init Category_list. self.category_list.set_highlight_item(self.get_categroy_item_by_index(self.get_save_item_index())) self.current_item = self.category_list.get_highlight_item() self.delete_source_id = self.current_item.song_view.connect("delete-select-items", self.parser_delete_items) self.drag_source_id = self.current_item.song_view.connect("drag-data-received", self.parser_drag_event) self.menu_source_id = self.current_item.song_view.connect("right-press-items", self.popup_detail_menu) Player.set_source(self.current_item.song_view) self.right_box.add(self.current_item.get_list_widget()) self.list_paned.show_all()
def import_list_from_uri(self, uri): p_name = utils.get_filename(uri) pl = MediaDB.create_playlist("local", p_name, []) new_item = ListTreeItem(pl) self.category_list.add_items([new_item]) new_item.song_view.async_add_uris(uri)