Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _():
missions = table.selected()
titles = [ m.title for m in missions ]
mission_manager.add("library", *missions)
print("已加入圖書館︰{}".format(", ".join(titles)))
def libDownloadUpdate():
missions = mission_manager.get_by_state("library", ("UPDATE",), all=True)
if not missions:
messagebox.showerror("Comic Crawler", "沒有新更新的任務")
return
mission_manager.add("view", *missions)
download_manager.start_download()
self.notebook.select(0)
self.btn_download_update["command"] = libDownloadUpdate
def analyze_thread():
err = None
with load_episodes(mission):
try:
Analyzer(mission).analyze()
except BaseException as _err:
err = _err
raise
else:
mission_manager.add("view", mission)
finally:
if on_finished:
on_finished(err)
self.analyze_threads.remove(analyze_thread)
self.analyze_threads.add(analyze_thread)
def tvAddToLib():
missions = table.selected()
titles = [ m.title for m in missions ]
mission_manager.add("library", *missions)
print("已加入圖書館︰{}".format(", ".join(titles)))
def lib_download_update():
missions = mission_manager.get_all("library", lambda m: m.state == "UPDATE")
if not missions:
self.messagebox("error", "Comic Crawler", "沒有新更新的任務")
return
mission_manager.add("view", *missions)
download_manager.start_download()
self.notebook.select(0)
self.btn_download_update["command"] = lib_download_update
def on_item_finished(err, mission):
if not err:
missions.popleft()
mission_manager.add("view", mission)
download_ch.pub("BATCH_ANALYZE_UPDATE", list(missions))