fix output
This commit is contained in:
parent
ca94704e4e
commit
23f4608cc8
@ -11,11 +11,13 @@ def update_viewings_csv_file_from_page(token_id, token_secret):
|
|||||||
# Page ID of https://wiki.jacknet.io/books/vcinema/page/csv
|
# Page ID of https://wiki.jacknet.io/books/vcinema/page/csv
|
||||||
page_id = 11
|
page_id = 11
|
||||||
|
|
||||||
|
print("Retrieving viewings page")
|
||||||
html_page = Bookstack.get_page_html(VCinemaUtils.JACKNET_WIKI_URL, token_id, token_secret, page_id)
|
html_page = Bookstack.get_page_html(VCinemaUtils.JACKNET_WIKI_URL, token_id, token_secret, page_id)
|
||||||
|
|
||||||
soup = BeautifulSoup(html_page, 'html.parser')
|
soup = BeautifulSoup(html_page, 'html.parser')
|
||||||
csv_data = soup.find("code").text.strip().encode('utf-8')
|
csv_data = soup.find("code").text.strip().encode('utf-8')
|
||||||
|
|
||||||
|
print("Retrieving existing file")
|
||||||
existing_attachment_id = VCinemaUtils.get_viewings_csv_attachment_id(token_id, token_secret)
|
existing_attachment_id = VCinemaUtils.get_viewings_csv_attachment_id(token_id, token_secret)
|
||||||
|
|
||||||
attachment = Bookstack.get_attachment(VCinemaUtils.JACKNET_WIKI_URL, token_id, token_secret, existing_attachment_id)
|
attachment = Bookstack.get_attachment(VCinemaUtils.JACKNET_WIKI_URL, token_id, token_secret, existing_attachment_id)
|
||||||
@ -25,13 +27,13 @@ def update_viewings_csv_file_from_page(token_id, token_secret):
|
|||||||
page_hash = hashlib.md5(csv_data).hexdigest()
|
page_hash = hashlib.md5(csv_data).hexdigest()
|
||||||
|
|
||||||
if page_hash != existing_attachment_hash:
|
if page_hash != existing_attachment_hash:
|
||||||
print("updating file")
|
print("Updating file")
|
||||||
# bookstack update file via api doesn't work
|
# bookstack update file via api doesn't work
|
||||||
Bookstack.post_attachment(VCinemaUtils.JACKNET_WIKI_URL, token_id, token_secret, "vcinema.csv", csv_data, page_id)
|
Bookstack.post_attachment(VCinemaUtils.JACKNET_WIKI_URL, token_id, token_secret, "vcinema.csv", csv_data, page_id)
|
||||||
Bookstack.delete_attachment(VCinemaUtils.JACKNET_WIKI_URL, token_id, token_secret, existing_attachment_id)
|
Bookstack.delete_attachment(VCinemaUtils.JACKNET_WIKI_URL, token_id, token_secret, existing_attachment_id)
|
||||||
print("done")
|
print("Done")
|
||||||
else:
|
else:
|
||||||
print("file already up to date")
|
print("File already up to date")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user