本文整理汇总了Python中kuwo.Net.get_song_link方法的典型用法代码示例。如果您正苦于以下问题:Python Net.get_song_link方法的具体用法?Python Net.get_song_link怎么用?Python Net.get_song_link使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kuwo.Net
的用法示例。
在下文中一共展示了Net.get_song_link方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_export
# 需要导入模块: from kuwo import Net [as 别名]
# 或者: from kuwo.Net import get_song_link [as 别名]
def do_export(button):
num_songs = len(liststore)
i = 0
export_dir = folder_chooser.get_filename()
for item in liststore:
song = Widgets.song_row_to_dict(item, start=0)
song_link, song_path = Net.get_song_link(song,
self.app.conf)
if song_link is not True:
continue
shutil.copy(song_path, export_dir)
i += 1
export_prog.set_fraction(i / num_songs)
Gdk.Window.process_all_updates()
dialog.destroy()
示例2: run
# 需要导入模块: from kuwo import Net [as 别名]
# 或者: from kuwo.Net import get_song_link [as 别名]
def run(self):
file_nums = len(self.liststore)
for i, item in enumerate(self.liststore):
if self.stop_flag:
return
song = Widgets.song_row_to_dict(item, start=0)
cached, song_link, song_path = Net.get_song_link(song, self.conf)
if not cached:
continue
shutil.copy(song_path, self.export_dir)
if self.including_lrc:
lrc_path, lrc_cached = Net.get_lrc_path(song)
if lrc_cached:
shutil.copy(lrc_path, self.export_dir)
self.emit('copied', song['name'], i)
self.emit('finished', file_nums)
示例3: do_export
# 需要导入模块: from kuwo import Net [as 别名]
# 或者: from kuwo.Net import get_song_link [as 别名]
def do_export(button):
num_songs = len(liststore)
export_dir = folder_chooser.get_filename()
export_lrc = with_lrc.get_active()
for i, item in enumerate(liststore):
song = Widgets.song_row_to_dict(item, start=0)
song_link, song_path = Net.get_song_link(
song, self.app.conf)
if song_link is not True:
continue
shutil.copy(song_path, export_dir)
if export_lrc:
(lrc_path, lrc_cached) = Net.get_lrc_path(song)
if lrc_cached:
shutil.copy(lrc_path, export_dir)
export_prog.set_fraction(i / num_songs)
Gdk.Window.process_all_updates()
dialog.destroy()
示例4: do_export
# 需要导入模块: from kuwo import Net [as 别名]
# 或者: from kuwo.Net import get_song_link [as 别名]
def do_export(self, button):
num_songs = len(self.liststore)
export_dir = self.folder_chooser.get_filename()
export_lrc = self.with_lrc.get_active()
for i, item in enumerate(self.liststore):
song = Widgets.song_row_to_dict(item, start=0)
cached, song_link, song_path = Net.get_song_link(
song, self.app.conf)
if not cached:
continue
self.export_prog.set_fraction(i / num_songs)
self.export_prog.set_text(song['name'])
shutil.copy(song_path, export_dir)
if export_lrc:
lrc_path, lrc_cached = Net.get_lrc_path(song)
if lrc_cached:
shutil.copy(lrc_path, export_dir)
Gdk.Window.process_all_updates()
self.destroy()
示例5: do_export
# 需要导入模块: from kuwo import Net [as 别名]
# 或者: from kuwo.Net import get_song_link [as 别名]
def do_export(button):
num_songs = len(liststore)
i = 0
for item in liststore:
name = item[0]
artist = item[1]
album = item[2]
rid = item[3]
song_link = Net.get_song_link(rid)
song_name = os.path.split(song_link)[1]
song_path = os.path.join(self.app.conf['song-dir'],
song_name)
if not os.path.exists(song_path):
continue
export_song_name = '{0}_{1}{2}'.format(name, artist,
os.path.splitext(song_name)[1]).replace('/', '+')
export_song_path = os.path.join(
folder_chooser.get_filename(), export_song_name)
i += 1
shutil.copy(song_path, export_song_path)
export_prog.set_fraction(i / num_songs)
Gdk.Window.process_all_updates()
dialog.destroy()
示例6: run
# 需要导入模块: from kuwo import Net [as 别名]
# 或者: from kuwo.Net import get_song_link [as 别名]
def run(self):
selection = self.treeview.get_selection()
liststore, selected_paths = selection.get_selected_rows()
if self.export_all:
file_nums = len(liststore)
song_rows = liststore
else:
file_nums = len(selected_paths)
song_rows = (liststore[path] for path in selected_paths)
for i, item in enumerate(song_rows):
if self.stop_flag:
return
song = Widgets.song_row_to_dict(item, start=0)
cached, song_link, song_path = Net.get_song_link(song, self.conf)
if not cached:
continue
shutil.copy(song_path, self.export_dir)
if self.including_lrc:
lrc_path, lrc_cached = Net.get_lrc_path(song)
if lrc_cached:
shutil.copy(lrc_path, self.export_dir)
self.emit('copied', song['name'], i /file_nums)
self.emit('finished', file_nums)