How to use the comiccrawler.channel.download_ch function in comiccrawler

To help you get started, we’ve selected a few comiccrawler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eight04 / ComicCrawler / comiccrawler / crawler.py View on Github external
print("total {} episode.".format(len(mission.episodes)))

	for ep in mission.episodes:
		if ep.skip or ep.complete:
			continue

		print("Downloading ep {}".format(ep.title))
		
		try:
			crawler = Crawler(mission, ep, savepath)
			crawlpage(crawler)

		except LastPageError:
			print("Episode download complete!")
			ep.complete = True
			download_ch.pub("DOWNLOAD_EP_COMPLETE", (mission, ep))

		except SkipEpisodeError as err:
			print("Something bad happened, skip the episode.")
			if err.always:
				ep.skip = True
github eight04 / ComicCrawler / comiccrawler / core / __init__.py View on Github external
mission.state = "PAUSE"
		download_ch.pub('DOWNLOAD_PAUSE', mission)
		raise

	except PauseDownloadError as err:
		mission.state = "ERROR"
		download_ch.pub('DOWNLOAD_INVALID', (err, mission))

	except Exception as err:
		mission.state = "ERROR"
		download_ch.pub('DOWNLOAD_ERROR', (err, mission))
		raise

	else:
		mission.state = "FINISHED"
		download_ch.pub("DOWNLOAD_FINISHED", mission)	
github eight04 / ComicCrawler / comiccrawler / download_manager.py View on Github external
def on_finished(err):
			self.batch_analyzer = None
			download_ch.pub("BATCH_ANALYZE_END", err)
github eight04 / ComicCrawler / comiccrawler / analyzer.py View on Github external
def analyze(mission):
	"""Analyze mission."""
	try:
		Analyzer(mission).analyze()

	except WorkerExit: # pylint: disable=try-except-raise
		raise

	except Exception as err: # pylint: disable=broad-except
		traceback.print_exc()
		download_ch.pub("ANALYZE_FAILED", (err, mission))

	except PauseDownloadError as err:
		download_ch.pub("ANALYZE_INVALID", (err, mission))

	else:
		download_ch.pub("ANALYZE_FINISHED", mission)
github eight04 / ComicCrawler / comiccrawler / gui.py View on Github external
def register_listeners(self):
		"""Add listeners."""
		
		mission_ch.sub(self.thread)
		download_ch.sub(self.thread)
		message_ch.sub(self.thread)
		
		@self.thread.listen("LOG_MESSAGE")
		def _(event):
			text = event.data.splitlines()[0]
			self.statusbar["text"] = safe_tk(text)

		@self.thread.listen("MISSION_PROPERTY_CHANGED")
		def _(event):
			self.update_mission_info(self.view_table, event.data)
			self.update_mission_info(self.library_table, event.data)

		@self.thread.listen("MISSION_LIST_REARRANGED")
		def _(event):
			self.update_table(event.data)
github eight04 / ComicCrawler / comiccrawler / download_manager.py View on Github external
def __init__(self):
		"""Construct."""
		self.download_thread = None
		self.analyze_threads = ThreadSafeSet()
		self.library_thread = None
		self.library_err_count = None
		self.batch_analyzer = None
		
		thread = current()
		
		download_ch.sub(thread)
		
		@thread.listen("DOWNLOAD_ERROR")
		def _(event):
			_err, mission = event.data
			mission_manager.drop("view", mission)

		@thread.listen("DOWNLOAD_FINISHED")
		def _(event):
			"""After download, execute command."""
			if event.target is not self.download_thread:
				return
				
			cmd = event.data.module.config.get("runafterdownload")
			default_cmd = setting.get("runafterdownload")
			
			commands = []
github eight04 / ComicCrawler / comiccrawler / core / __init__.py View on Github external
def analyze(self):
		err = None
		
		while self.missions:
			mission = None
			with self.lock:
				mission = self.missions.popleft()
			with mission.load_episode():
				try:
					Analyzer(mission).analyze()
				except BaseException as _err:
					with self.lock:
						self.missions.appendleft(mission)
					err = _err
					break
				download_ch.pub("BATCH_ANALYZE_ITEM_FINISHED", (self, mission))
				
		download_ch.pub("BATCH_ANALYZE_END", (self, err))
github eight04 / ComicCrawler / comiccrawler / gui / main_window.py View on Github external
def register_listeners(self):
		"""Add listeners."""
		
		mission_ch.sub(self.thread)
		download_ch.sub(self.thread)
		message_ch.sub(self.thread)
		
		@self.thread.listen("LOG_MESSAGE")
		def _(event):
			text = event.data.splitlines()[0]
			self.statusbar["text"] = safe_tk(text)

		@self.thread.listen("MISSION_PROPERTY_CHANGED")
		def _(event):
			self.update_mission_info(self.view_table, event.data)
			self.update_mission_info(self.library_table, event.data)

		@self.thread.listen("MISSION_LIST_REARRANGED")
		def _(event):
			self.update_table(event.data)