Debug print
This commit is contained in:
parent
6ed57d322e
commit
da36543168
1 changed files with 9 additions and 4 deletions
|
@ -16,15 +16,17 @@ locale.setlocale(locale.LC_TIME, 'it_IT.UTF-8')
|
|||
|
||||
# Scarica tutti i post da Mastodon
|
||||
|
||||
mastodon = Mastodon(api_base_url = "https://mastodon.bida.im")
|
||||
all_vgos = []
|
||||
last_id = None
|
||||
print("Scarico i post")
|
||||
|
||||
def default(o):
|
||||
if isinstance(o, (datetime.date, datetime.datetime)):
|
||||
return o.isoformat()
|
||||
|
||||
if not os.path.isfile('oloturiadump.json'):
|
||||
if not os.path.isfile('oloturiadump.json'):
|
||||
mastodon = Mastodon(api_base_url = "https://mastodon.bida.im")
|
||||
all_vgos = []
|
||||
last_id = None
|
||||
|
||||
while True:
|
||||
statuses = list(filter(lambda s: s['account']['username'] == 'oloturia', mastodon.timeline_hashtag("vgo", local=True, max_id=last_id)))
|
||||
if not statuses:
|
||||
|
@ -53,6 +55,7 @@ if not os.path.isfile('oloturiadump.json'):
|
|||
|
||||
# Scarica tutte le immagini
|
||||
|
||||
print("Scarico le immagini")
|
||||
with open('oloturiadump.json') as json_file:
|
||||
all_vgos = json.load(json_file)
|
||||
os.makedirs('media', exist_ok=True)
|
||||
|
@ -86,6 +89,7 @@ with open('oloturiadump.json') as json_file:
|
|||
|
||||
# Genera i PDF
|
||||
|
||||
print("Genero i PDF")
|
||||
os.makedirs('pdf', exist_ok=True)
|
||||
for vgo in all_vgos:
|
||||
vgo_num = html2text.html2text(vgo['content']).split(' ')[0]
|
||||
|
@ -151,6 +155,7 @@ with open('oloturiadump.json') as json_file:
|
|||
|
||||
# Genera i libretti
|
||||
|
||||
print("Genero i libretti")
|
||||
os.makedirs('books', exist_ok=True)
|
||||
for book_num in range(1, int(len(vgo_dict) / 50) + 2):
|
||||
pdfWriter = PyPDF2.PdfFileWriter()
|
||||
|
|
Loading…
Reference in a new issue