def __init__(self): uri = WinFile().run() if uri and common.file_is_supported(utils.get_path_from_uri(uri)): try: MediaDB.get_songs_by_uri(uri) except: traceback.print_exc()
def choose_file_and_convert(self): filename = WinFile(False).run() if filename and common.file_is_supported(filename): tags = {"uri": utils.get_uri_from_path(filename)} s = Song() s.init_from_dict(tags) s.set_type("local") s.read_from_file() AttributesUI([s]).show_window()
def add_file(self, filename=None, play=False): if filename is None: uri = WinFile().run() else: uri = utils.get_uri_from_path(filename) if uri and common.file_is_supported(utils.get_path_from_uri(uri)): try: songs = MediaDB.get_songs_by_uri(uri) except: pass else: self.add_songs(songs, play=play)
def change_item_cover(self, item): new_cover_path = WinFile(False, _("Select image")).run() if new_cover_path: item.change_cover_pixbuf(new_cover_path)
def change_cover_image(self, widget): new_cover_path = WinFile(False, _("Select image")).run() if new_cover_path: CoverManager.change_cover(self.song, new_cover_path)
def allocation_lrc(self): lrc_path = WinFile(False).run() if lrc_path: self.lrc_manager.allocation_lrc_file(Player.song, lrc_path)