1 ### Use manga-py in your project
5 from manga_py.parser import Parser
6 from manga_py.info import Info
9 my_awesome_handler = open('my-handler')
12 class MyAwesomeInfo(Info):
16 # main class (you will have your own)
20 is just a Namespace or dict with arguments
21 (filled below. You can implement your implementation. The main thing is to have all keys possible)
22 see manga_py.cli.args.get_cli_arguments()
25 parser = None # the found parser gets here (see below)
28 MyAwesomeInfo(self.args) # use the Info class from manga-py or overload the Info class from manga-py
31 self.parser = Parser(self.args)
33 self.parser.init_provider(
34 progress=self.progress,
37 quest_password=self.quest_password,
40 except AttributeError as e:
42 self.parser.start() # provider main method
44 def progress(self, items_count: int, current_item: int, re_init: bool = False): # the same progress function. re_init = True means "next chapter"
48 def print(self, text, **kwargs):
50 Not used everywhere. Better reload global print method
52 print(text, **kwargs, file=my_awesome_handler)
54 def quest(self, variants: enumerate, title: str, select_type=0): # 0 = single, 1 = multiple
59 print(' Question multiple answers')
66 def quest_password(self, title):
68 used to ask user password
71 return 'my_awesome_password'