def do(self): try: self.lineEdit.setDisabled(True) self.user_input_url = self.lineEdit.text() self.pushButton.setDisabled(True) self.checkBox.setDisabled(True) self.spinBox_fetch_limit.setDisabled(True) self.spinBox_threads.setDisabled(True) self.label_chapters.setDisabled(True) self.label_threads.setDisabled(True) self.label_save.setDisabled(True) self.lineEdit_save_location.setDisabled(True) self.save_dir = self.lineEdit_save_location.text() self.pushButton_browse_file.setDisabled(True) self.base = SharedBase(self.user_input_url) self.site_name = self.base.get_site_name() if self.checkBox.isChecked(): checkbox_value = self.spinBox_fetch_limit.value() else: checkbox_value = False threads = self.spinBox_threads.value() self.work = WorkingThread(self.site_name, self.user_input_url, checkbox_value, threads, self.save_dir) self.work.status_report_signal.connect(self.status_receive_signal) self.work.progress_report_signal.connect( self.progress_receive_signal) self.work.stop_signal.connect(self.stop_signal) self.work.chapter_start_signal.connect( self.chapter_start_receive_signal) self.work.start() except NameError as e: self.stop_signal('Website %s illegal or not supported' % e)
def do(self): try: self.lineEdit.setDisabled(True) self.user_input_url = self.lineEdit.text() self.pushButton.setDisabled(True) self.checkBox.setDisabled(True) self.spinBox.setDisabled(True) self.label.setDisabled(True) self.base = SharedBase(self.user_input_url) self.site_name = self.base.get_site_name() if self.checkBox.isChecked(): checkbox_value = self.spinBox.value() else: checkbox_value = False self.work = WorkingThread(self.site_name, self.user_input_url, checkbox_value) self.work.status_report_signal.connect(self.status_receive_signal) self.work.progress_report_signal.connect( self.progress_receive_signal) self.work.stop_signal.connect(self.stop_signal) self.work.start() except NameError as e: self.stop_signal('Website %s illegal or not supported' % e)
class MyMainWindow(QMainWindow, Ui_MainWindow): def __init__(self): super(MyMainWindow, self).__init__() self.setupUi(self) self.pushButton.clicked.connect(self.do) self.lineEdit.returnPressed.connect(self.do) def do(self): try: self.lineEdit.setDisabled(True) self.user_input_url = self.lineEdit.text() self.pushButton.setDisabled(True) self.checkBox.setDisabled(True) self.spinBox.setDisabled(True) self.label.setDisabled(True) self.base = SharedBase(self.user_input_url) self.site_name = self.base.get_site_name() if self.checkBox.isChecked(): checkbox_value = self.spinBox.value() else: checkbox_value = False self.work = WorkingThread(self.site_name, self.user_input_url, checkbox_value) self.work.status_report_signal.connect(self.status_receive_signal) self.work.progress_report_signal.connect( self.progress_receive_signal) self.work.stop_signal.connect(self.stop_signal) self.work.start() except NameError as e: self.stop_signal('Website %s illegal or not supported' % e) def status_receive_signal(self, text): self.statusBar().showMessage(text) def progress_receive_signal(self, progress): self.progressBar.setProperty("value", progress) def stop_signal(self, text=''): self.pushButton.setDisabled(False) self.lineEdit.setDisabled(False) self.checkBox.setDisabled(False) self.spinBox.setDisabled(False) self.label.setDisabled(False) self.statusBar().showMessage(text)
class MyMainWindow(QMainWindow, Ui_MainWindow): def __init__(self): super(MyMainWindow, self).__init__() self.setupUi(self) self.pushButton.clicked.connect(self.do) self.lineEdit.returnPressed.connect(self.do) def do(self): try: self.lineEdit.setDisabled(True) self.user_input_url = self.lineEdit.text() self.pushButton.setDisabled(True) self.checkBox.setDisabled(True) self.spinBox.setDisabled(True) self.label.setDisabled(True) self.base = SharedBase(self.user_input_url) self.site_name = self.base.get_site_name() if self.checkBox.isChecked(): checkbox_value = self.spinBox.value() else: checkbox_value = False self.work = WorkingThread(self.site_name, self.user_input_url, checkbox_value) self.work.status_report_signal.connect(self.status_receive_signal) self.work.progress_report_signal.connect(self.progress_receive_signal) self.work.stop_signal.connect(self.stop_signal) self.work.start() except NameError as e: self.stop_signal('Website %s illegal or not supported' % e) def status_receive_signal(self, text): self.statusBar().showMessage(text) def progress_receive_signal(self, progress): self.progressBar.setProperty("value", progress) def stop_signal(self, text=''): self.pushButton.setDisabled(False) self.lineEdit.setDisabled(False) self.checkBox.setDisabled(False) self.spinBox.setDisabled(False) self.label.setDisabled(False) self.statusBar().showMessage(text)
def do(self): try: self.lineEdit.setDisabled(True) self.user_input_url = self.lineEdit.text() self.pushButton.setDisabled(True) self.checkBox.setDisabled(True) self.spinBox.setDisabled(True) self.label.setDisabled(True) self.base = SharedBase(self.user_input_url) self.site_name = self.base.get_site_name() if self.checkBox.isChecked(): checkbox_value = self.spinBox.value() else: checkbox_value = False self.work = WorkingThread(self.site_name, self.user_input_url, checkbox_value) self.work.status_report_signal.connect(self.status_receive_signal) self.work.progress_report_signal.connect(self.progress_receive_signal) self.work.stop_signal.connect(self.stop_signal) self.work.start() except NameError as e: self.stop_signal('Website %s illegal or not supported' % e)
if opt == '-h': print('driveit.py\n\nUsage: python3 driveit.py [-u <URL>] [-l <number>] [-h]') print('Options:\n\t-u\t Download comics from specific origin') print('\t-l\tOptional. Download latest x chapters from origin') print('\t-h\tPrint this help') sys.exit() elif opt in ('-u', '--url'): user_input_url = arg elif opt in ('-l', '--latest'): fetch_latest = int(arg) except getopt.GetoptError as e: print('%s\n\nUsage: python3 driveit.py -u <URL>\nSee driveit.py -h for details' % e) sys.exit(2) base = SharedBase(user_input_url) if base.get_site_name() is 'dm5': from sites import DM5 as SiteClass elif base.get_site_name() is 'ck101': from sites import Ck101 as SiteClass elif base.get_site_name() is 'dmzj': from sites import Dmzj as SiteClass elif base.get_site_name() is 'ehentai': from sites import Ehentai as SiteClass try: website_object = SiteClass(user_input_url) comic_name = website_object.get_name() ref_box = website_object.get_parent_info() print('%s, total %d chapters detected.' % (comic_name, len(ref_box))) main_loop(ref_box, fetch_latest) except ConnectionError as e:
from base import SharedBase def main_loop(refer_box): for ref_tuple in refer_box: title, parent_link = ref_tuple total_page = website_object.get_page_info(parent_link) for page in range(1, total_page + 1): link = website_object.get_image_link(parent_link, page) try: website_object.down(comic_name, parent_link, link, title, page) print('%s page %d has been downloaded successfully' % (title, page)) except: print('Error occurred when downloading %s, Page %d.' % (title, page)) user_input_url = input('URL?\n') base = SharedBase(user_input_url) if base.get_site_name() is 'dm5': from sites import DM5 as SiteClass elif base.get_site_name() is 'ck101': from sites import Ck101 as SiteClass website_object = SiteClass(user_input_url) comic_name = website_object.get_name() ref_box = website_object.get_parent_info() print('%s, total %d chapters detected.' % (comic_name, len(ref_box))) main_loop(ref_box)
return parser parser = argparser() args = parser.parse_args() user_input_url = args.url if args.thread: download_limit = int(args.thread) else: download_limit = 1 if args.latest: fetch_latest = int(args.latest) else: fetch_latest = 0 base = SharedBase(user_input_url) try: if base.get_site_name() is 'dm5': from sites import DM5 as SiteClass elif base.get_site_name() is 'ck101': from sites import Ck101 as SiteClass elif base.get_site_name() is 'dmzj': from sites import Dmzj as SiteClass elif base.get_site_name() is 'manhua_dmzj': from sites import manhua_Dmzj as SiteClass elif base.get_site_name() is 'ehentai': from sites import Ehentai as SiteClass except NameError: print('Website illegal or nor supported yet.') exit() try:
class MyMainWindow(QMainWindow, Ui_MainWindow): def __init__(self): super(MyMainWindow, self).__init__() self.setupUi(self) self.initUI() def initUI(self): self.pushButton.clicked.connect(self.do) self.lineEdit.returnPressed.connect(self.do) self.pushButton_browse_file.clicked.connect(self.show_file_dialog) self.lineEdit_save_location.setText(os.getcwd()) self.lineEdit.setFocus() def show_file_dialog(self): selected_dir = QFileDialog.getExistingDirectory( self, caption='Choose Directory', directory=os.getcwd()) self.lineEdit_save_location.setText(selected_dir) def do(self): try: self.lineEdit.setDisabled(True) self.user_input_url = self.lineEdit.text() self.pushButton.setDisabled(True) self.checkBox.setDisabled(True) self.spinBox_fetch_limit.setDisabled(True) self.spinBox_threads.setDisabled(True) self.label_chapters.setDisabled(True) self.label_threads.setDisabled(True) self.label_save.setDisabled(True) self.lineEdit_save_location.setDisabled(True) self.save_dir = self.lineEdit_save_location.text() self.pushButton_browse_file.setDisabled(True) self.base = SharedBase(self.user_input_url) self.site_name = self.base.get_site_name() if self.checkBox.isChecked(): checkbox_value = self.spinBox_fetch_limit.value() else: checkbox_value = False threads = self.spinBox_threads.value() self.work = WorkingThread(self.site_name, self.user_input_url, checkbox_value, threads, self.save_dir) self.work.status_report_signal.connect(self.status_receive_signal) self.work.progress_report_signal.connect( self.progress_receive_signal) self.work.stop_signal.connect(self.stop_signal) self.work.chapter_start_signal.connect( self.chapter_start_receive_signal) self.work.start() except NameError as e: self.stop_signal('Website %s illegal or not supported' % e) def status_receive_signal(self, text): self.statusBar().showMessage(text) def progress_receive_signal(self, is_done): self.pages_done += 1 self.progressBar.setProperty('value', self.pages_done / self.total_pages * 100) def chapter_start_receive_signal(self, start_tuple): parent_title, total_pages = start_tuple self.status_receive_signal('Downloading %s' % parent_title) self.pages_done = 0 self.total_pages = total_pages def stop_signal(self, text=''): self.lineEdit.setDisabled(False) self.pushButton.setDisabled(False) self.checkBox.setDisabled(False) self.spinBox_fetch_limit.setDisabled(False) self.spinBox_threads.setDisabled(False) self.label_chapters.setDisabled(False) self.label_threads.setDisabled(False) self.label_save.setDisabled(False) self.lineEdit_save_location.setDisabled(False) self.pushButton_browse_file.setDisabled(False) self.statusBar().showMessage(text) self.lineEdit.setFocus()