2022-01-18 20:43:45 +00:00
|
|
|
import asyncio
|
|
|
|
import gravesong
|
|
|
|
import logging
|
|
|
|
import os
|
|
|
|
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(
|
|
|
|
{
|
2022-08-18 10:59:02 +00:00
|
|
|
"authors": ["Pirateaba"],
|
2022-01-18 20:43:45 +00:00
|
|
|
"language": "en",
|
|
|
|
"cover": f"{output_imgs}/gravesong-by-boboplushie.jpg",
|
|
|
|
},
|
|
|
|
output_epubs,
|
|
|
|
),
|
|
|
|
twi.process(
|
|
|
|
{
|
2022-08-18 10:59:02 +00:00
|
|
|
"authors": ["Pirateaba"],
|
2022-01-18 20:43:45 +00:00
|
|
|
"language": "en",
|
|
|
|
"cover": f"{output_imgs}/twi.jpg",
|
|
|
|
},
|
|
|
|
output_epubs,
|
|
|
|
"https://wanderinginn.com/table-of-contents/",
|
|
|
|
),
|
|
|
|
twi.process(
|
|
|
|
{
|
2022-08-18 10:59:02 +00:00
|
|
|
"authors": ["Pirateaba", "ElliVia"],
|
2022-01-18 20:43:45 +00:00
|
|
|
"language": "fr",
|
|
|
|
"cover": f"{output_imgs}/twi.jpg",
|
|
|
|
},
|
|
|
|
output_epubs,
|
|
|
|
"https://aubergevagabonde.wordpress.com/sommaire/",
|
|
|
|
),
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
asyncio.run(main())
|