mirror of
				https://github.com/RicterZ/nhentai.git
				synced 2025-11-04 02:50:55 +01:00 
			
		
		
		
	slow down #50
This commit is contained in:
		@@ -26,10 +26,14 @@ def main():
 | 
				
			|||||||
        logger.info('Logging in to nhentai using credential pair \'%s:%s\'' % (username, '*' * len(password)))
 | 
					        logger.info('Logging in to nhentai using credential pair \'%s:%s\'' % (username, '*' * len(password)))
 | 
				
			||||||
        login(username, password)
 | 
					        login(username, password)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if options.is_download:
 | 
					        if options.is_download or options.is_show:
 | 
				
			||||||
            for doujinshi_info in login_parser():
 | 
					            for doujinshi_info in login_parser():
 | 
				
			||||||
                doujinshi_list.append(Doujinshi(**doujinshi_info))
 | 
					                doujinshi_list.append(Doujinshi(**doujinshi_info))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if options.is_show and not options.is_download:
 | 
				
			||||||
 | 
					                print_doujinshi([{'id': i.id, 'title': i.name} for i in doujinshi_list])
 | 
				
			||||||
 | 
					                exit(0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if options.tag:
 | 
					    if options.tag:
 | 
				
			||||||
        doujinshis = tag_parser(options.tag, max_page=options.max_page)
 | 
					        doujinshis = tag_parser(options.tag, max_page=options.max_page)
 | 
				
			||||||
        print_doujinshi(doujinshis)
 | 
					        print_doujinshi(doujinshis)
 | 
				
			||||||
@@ -38,6 +42,7 @@ def main():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if options.keyword:
 | 
					    if options.keyword:
 | 
				
			||||||
        doujinshis = search_parser(options.keyword, options.page)
 | 
					        doujinshis = search_parser(options.keyword, options.page)
 | 
				
			||||||
 | 
					        print(doujinshis)
 | 
				
			||||||
        print_doujinshi(doujinshis)
 | 
					        print_doujinshi(doujinshis)
 | 
				
			||||||
        if options.is_download:
 | 
					        if options.is_download:
 | 
				
			||||||
            doujinshi_ids = map(lambda d: d['id'], doujinshis)
 | 
					            doujinshi_ids = map(lambda d: d['id'], doujinshis)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -48,7 +48,7 @@ class Doujinshi(object):
 | 
				
			|||||||
            ["Characters", self.info.character],
 | 
					            ["Characters", self.info.character],
 | 
				
			||||||
            ["Authors", self.info.artist],
 | 
					            ["Authors", self.info.artist],
 | 
				
			||||||
            ["Language", self.info.language],
 | 
					            ["Language", self.info.language],
 | 
				
			||||||
            ["Tags", ', '.join(self.info.tag.keys())],
 | 
					            ["Tags", self.info.tags],
 | 
				
			||||||
            ["URL", self.url],
 | 
					            ["URL", self.url],
 | 
				
			||||||
            ["Pages", self.pages],
 | 
					            ["Pages", self.pages],
 | 
				
			||||||
        ]
 | 
					        ]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -95,7 +95,7 @@ def login_parser():
 | 
				
			|||||||
        ret.append(result)
 | 
					        ret.append(result)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # TODO: reduce threads number ...
 | 
					    # TODO: reduce threads number ...
 | 
				
			||||||
    thread_pool = threadpool.ThreadPool(3)
 | 
					    thread_pool = threadpool.ThreadPool(1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for page in range(1, pages + 1):
 | 
					    for page in range(1, pages + 1):
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user