This repository has been archived on 2024-02-23. You can view files and clone it, but cannot push or open issues or pull requests.
Auberge_Vagabonde/run.py
Michel Roux 0e9cd0eb96
Some checks failed
continuous-integration/drone/push Build is failing
Fix VF parsing and use poetry
2022-09-18 23:00:12 +00:00

68 lines
1.7 KiB
Python

import asyncio
import logging
import os
import gravesong
import requests
import twi
loggers = [logging.getLogger()] + [
logging.getLogger(name) for name in logging.root.manager.loggerDict
]
for logger in loggers:
logger.setLevel(logging.INFO)
output_epubs = "output/epubs"
output_imgs = "output/imgs"
if not os.path.isdir(output_epubs):
os.makedirs(output_epubs)
if not os.path.isdir(output_imgs):
os.makedirs(output_imgs)
gravesong_img = requests.get(
"https://wanderinginn.files.wordpress.com/2021/12/gravesong-by-boboplushie.jpg"
)
with open(f"{output_imgs}/gravesong-by-boboplushie.jpg", "wb") as f:
f.write(gravesong_img.content)
twi_img = requests.get(
"https://i0.wp.com/thefantasyinn.com/wp-content/uploads/2018/08/twi.jpg"
)
with open(f"{output_imgs}/twi.jpg", "wb") as f:
f.write(twi_img.content)
async def main():
await asyncio.gather(
gravesong.process(
{
"authors": ["Pirateaba"],
"language": "en",
"cover": f"{output_imgs}/gravesong-by-boboplushie.jpg",
},
output_epubs,
),
twi.process(
{
"authors": ["Pirateaba"],
"language": "en",
"cover": f"{output_imgs}/twi.jpg",
},
output_epubs,
"https://wanderinginn.com/table-of-contents/",
),
twi.process(
{
"authors": ["Pirateaba", "ElliVia"],
"language": "fr",
"cover": f"{output_imgs}/twi.jpg",
},
output_epubs,
"https://aubergevagabonde.wordpress.com/sommaire/",
),
)
asyncio.run(main())