Compare commits

..

No commits in common. "067ac573c74b7a799acbccabe365cd310b9ad9d4" and "c5445fb8e06ab9568882b32d25ad7938593ad138" have entirely different histories.

3 changed files with 29 additions and 10 deletions

View File

@ -29,8 +29,9 @@ def build_page(films_by_country):
country_counter = Counter(films_by_country) country_counter = Counter(films_by_country)
png_data = draw_map(country_counter) png_data = draw_map(country_counter)
encoded = base64.b64encode(png_data).decode("utf-8") encoded = base64.b64encode(png_data).decode("utf-8")
image = "![](data:image/png;base64,{})".format(encoded) image_html = "<img src=\"data:image/png;base64,{}\" />".format(encoded)
page = image + "\n" + film_by_country_table
page = image_html + film_by_country_table
return page return page
@ -53,18 +54,36 @@ def build_table(films_by_country, bar=None):
flags = get_flags_dict() flags = get_flags_dict()
table = "| Country | Films |\n| - | - |" table = "<table>"
table += "<thead><tr><th>Country</th><th>Films</th></tr>"
table += "<tbody>"
for country in films_by_country_sorted.keys(): for country in films_by_country_sorted.keys():
table += "\n" row = "<tr>"
table += "{} {}".format(str(country), flags[country] if country in flags.keys() else "")
table += " | " row += "<td>"
film_links = ["[{}](https://www.imdb.com/title/tt{}/)".format(film['title'], film['imdb_id']) for film in films_by_country_sorted[country]] row += "{} {}".format(str(country), flags[country] if country in flags.keys() else "")
table += "<br>".join(film_links) 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
if bar is not None: if bar is not None:
bar.next() bar.next()
table += "</tbody>"
table += "</table>"
if bar is not None: if bar is not None:
bar.finish() 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: with IncrementalBar('Updating pages', max=update_page_count, check_tty=False) as bar:
if update_films_by_year: if update_films_by_year:
Bookstack.update_page(VCinemaUtils.JACKNET_WIKI_URL, token_id, token_secret, FILMS_BY_YEAR_PAGE_ID, markdown=films_by_year_page) Bookstack.update_page(VCinemaUtils.JACKNET_WIKI_URL, token_id, token_secret, FILMS_BY_YEAR_PAGE_ID, films_by_year_page)
bar.next() bar.next()
if update_films_by_country: if update_films_by_country:
Bookstack.update_page(VCinemaUtils.JACKNET_WIKI_URL, token_id, token_secret, FILMS_BY_COUNTRY_PAGE_ID, markdown=films_by_country_page) Bookstack.update_page(VCinemaUtils.JACKNET_WIKI_URL, token_id, token_secret, FILMS_BY_COUNTRY_PAGE_ID, films_by_country_page)
bar.next() bar.next()
bar.finish() bar.finish()