Compare commits

...

2 Commits

Author SHA1 Message Date
Sarah
067ac573c7 fix image upload 2022-04-03 16:22:27 +01:00
Sarah
46df8c7168 specify args 2022-04-03 15:50:20 +01:00
3 changed files with 10 additions and 29 deletions

View File

@ -29,9 +29,8 @@ def build_page(films_by_country):
country_counter = Counter(films_by_country)
png_data = draw_map(country_counter)
encoded = base64.b64encode(png_data).decode("utf-8")
image_html = "<img src=\"data:image/png;base64,{}\" />".format(encoded)
page = image_html + film_by_country_table
image = "![](data:image/png;base64,{})".format(encoded)
page = image + "\n" + film_by_country_table
return page
@ -54,36 +53,18 @@ def build_table(films_by_country, bar=None):
flags = get_flags_dict()
table = "<table>"
table += "<thead><tr><th>Country</th><th>Films</th></tr>"
table += "<tbody>"
table = "| Country | Films |\n| - | - |"
for country in films_by_country_sorted.keys():
row = "<tr>"
row += "<td>"
row += "{} {}".format(str(country), flags[country] if country in flags.keys() else "")
row += "</td>"
row += "<td>"
film_links = ["<a href=\"https://www.imdb.com/title/tt{}/\">{}</a>".format(film['imdb_id'], film['title'])
for film in films_by_country_sorted[country]]
row += "<br>".join(film_links)
row += "</td>"
row += "</tr>"
table += row
table += "\n"
table += "{} {}".format(str(country), flags[country] if country in flags.keys() else "")
table += " | "
film_links = ["[{}](https://www.imdb.com/title/tt{}/)".format(film['title'], film['imdb_id']) for film in films_by_country_sorted[country]]
table += "<br>".join(film_links)
if bar is not None:
bar.next()
table += "</tbody>"
table += "</table>"
if bar is not None:
bar.finish()

View File

@ -55,10 +55,10 @@ def update_wiki(token_id, token_secret, update_csv=False, update_films_by_year=T
with IncrementalBar('Updating pages', max=update_page_count, check_tty=False) as bar:
if update_films_by_year:
Bookstack.update_page(VCinemaUtils.JACKNET_WIKI_URL, token_id, token_secret, FILMS_BY_YEAR_PAGE_ID, films_by_year_page)
Bookstack.update_page(VCinemaUtils.JACKNET_WIKI_URL, token_id, token_secret, FILMS_BY_YEAR_PAGE_ID, markdown=films_by_year_page)
bar.next()
if update_films_by_country:
Bookstack.update_page(VCinemaUtils.JACKNET_WIKI_URL, token_id, token_secret, FILMS_BY_COUNTRY_PAGE_ID, films_by_country_page)
Bookstack.update_page(VCinemaUtils.JACKNET_WIKI_URL, token_id, token_secret, FILMS_BY_COUNTRY_PAGE_ID, markdown=films_by_country_page)
bar.next()
bar.finish()