fix image upload
This commit is contained in:
parent
46df8c7168
commit
067ac573c7
@ -29,9 +29,8 @@ 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_html = "<img src=\"data:image/png;base64,{}\" />".format(encoded)
|
image = "".format(encoded)
|
||||||
|
page = image + "\n" + film_by_country_table
|
||||||
page = image_html + film_by_country_table
|
|
||||||
|
|
||||||
return page
|
return page
|
||||||
|
|
||||||
@ -54,36 +53,18 @@ def build_table(films_by_country, bar=None):
|
|||||||
|
|
||||||
flags = get_flags_dict()
|
flags = get_flags_dict()
|
||||||
|
|
||||||
table = "<table>"
|
table = "| Country | Films |\n| - | - |"
|
||||||
|
|
||||||
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():
|
||||||
row = "<tr>"
|
table += "\n"
|
||||||
|
table += "{} {}".format(str(country), flags[country] if country in flags.keys() else "")
|
||||||
row += "<td>"
|
table += " | "
|
||||||
row += "{} {}".format(str(country), flags[country] if country in flags.keys() else "")
|
film_links = ["[{}](https://www.imdb.com/title/tt{}/)".format(film['title'], film['imdb_id']) for film in films_by_country_sorted[country]]
|
||||||
row += "</td>"
|
table += "<br>".join(film_links)
|
||||||
|
|
||||||
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()
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ def update_wiki(token_id, token_secret, update_csv=False, update_films_by_year=T
|
|||||||
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, markdown=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, html=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.next()
|
||||||
|
|
||||||
bar.finish()
|
bar.finish()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user