Little clean up. Updated requirements.txt and turned off the flask run thing in preperation to try running under waitress.
This commit is contained in:
@@ -1,67 +0,0 @@
|
||||
from manga_py1.parser import Parser
|
||||
from manga_py1.info import Info
|
||||
|
||||
|
||||
my_awesome_handler = open('my-handler')
|
||||
|
||||
|
||||
class MyAwesomeInfo(Info):
|
||||
pass
|
||||
|
||||
|
||||
# main class (you will have your own)
|
||||
class MyAwesomeClass:
|
||||
args = {}
|
||||
"""
|
||||
is just a Namespace or dict with arguments
|
||||
(filled below. You can implement your implementation. The main thing is to have all keys possible)
|
||||
see manga_py.cli.args.get_cli_arguments()
|
||||
"""
|
||||
|
||||
parser = None # the found parser gets here (see below)
|
||||
|
||||
def get_info(self):
|
||||
MyAwesomeInfo(self.args) # use the Info class from manga-py or overload the Info class from manga-py
|
||||
|
||||
def start(self):
|
||||
self.parser = Parser(self.args)
|
||||
try:
|
||||
self.parser.init_provider(
|
||||
progress=self.progress,
|
||||
log=self.print,
|
||||
quest=self.quest,
|
||||
quest_password=self.quest_password,
|
||||
info=self.get_info(),
|
||||
)
|
||||
except AttributeError as e:
|
||||
raise e
|
||||
self.parser.start() # provider main method
|
||||
|
||||
def progress(self, items_count: int, current_item: int, re_init: bool = False): # the same progress function. re_init = True means "next chapter"
|
||||
# simple progress
|
||||
pass
|
||||
|
||||
def print(self, text, **kwargs):
|
||||
"""
|
||||
Not used everywhere. Better reload global print method
|
||||
"""
|
||||
print(text, **kwargs, file=my_awesome_handler)
|
||||
|
||||
def quest(self, variants: enumerate, title: str, select_type=0): # 0 = single, 1 = multiple
|
||||
if select_type == 0:
|
||||
print(' Question ')
|
||||
return 'Answer'
|
||||
else:
|
||||
print(' Question multiple answers')
|
||||
return [
|
||||
'Answer 1',
|
||||
'Answer 2',
|
||||
...
|
||||
]
|
||||
|
||||
def quest_password(self, title):
|
||||
"""
|
||||
used to ask user password
|
||||
"""
|
||||
print(title)
|
||||
return 'my_awesome_password'
|
||||
3
main.py
3
main.py
@@ -195,7 +195,6 @@ def ood():
|
||||
def test():
|
||||
y = 0
|
||||
mangaInfo=[]
|
||||
tf = """{"version":2,"mangas":[{"manga":["/manga/ul921197","A Wife Who Heals With Tights",2528986671771677900,0,0]},{"manga":["/manga/Amano-Megumi-Wa-Suki-Darake","Amano Megumi wa Suki Darake!",9,0,0]},{"manga":["/manga/Ansatsu-Kyoushitsu","Ansatsu Kyoushitsu",9,0,0]},{"manga":["/manga/ab918062","Ashigei Shoujo Komura-San",2528986671771677900,0,0]},{"manga":["/manga/mrs-serie-200174290","Asper Girl",1554176584893433663,0,0]},{"manga":["/manga/ga919880","Awkward Senpai",2528986671771677900,0,0]},{"manga":["/manga/31231/","Azur Lane: Queen\u0027s Orders",2499283573021220255,0,0]},{"manga":["https://manganelo.com/manga/read_bakuman_manga_online","Bakuman",2528986671771677900,0,0]}]"""
|
||||
mangaName = manga.query.all()
|
||||
|
||||
with open(PATH + "/tach.json", "r") as tf:
|
||||
@@ -213,4 +212,4 @@ def test():
|
||||
return jsonify(mangaInfo)
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(host='0.0.0.0', debug=True)
|
||||
# app.run(host='0.0.0.0', debug=True)
|
||||
|
||||
@@ -1,8 +1,25 @@
|
||||
aiocontextvars==0.2.2
|
||||
certifi==2020.4.5.1
|
||||
chardet==3.0.4
|
||||
click==7.1.1
|
||||
Flask==1.1.1
|
||||
colorama==0.4.3
|
||||
contextvars==2.4
|
||||
cssselect==1.1.0
|
||||
Flask==1.1.2
|
||||
Flask-SQLAlchemy==2.4.1
|
||||
idna==2.9
|
||||
immutables==0.11
|
||||
itsdangerous==1.1.0
|
||||
Jinja2==2.11.1
|
||||
Jinja2==2.11.2
|
||||
loguru==0.4.1
|
||||
lxml==4.5.0
|
||||
MarkupSafe==1.1.1
|
||||
Pillow==7.1.1
|
||||
PyMySQL==0.9.3
|
||||
Werkzeug==1.0.0
|
||||
requests==2.23.0
|
||||
SQLAlchemy==1.3.16
|
||||
style==1.1.6
|
||||
update==0.0.1
|
||||
urllib3==1.25.9
|
||||
Werkzeug==1.0.1
|
||||
win32-setctime==1.0.1
|
||||
|
||||
Reference in New Issue
Block a user