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)
|
||||
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 = "".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()
|
||||
|
||||
|
@ -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)
|
||||
bar.next()
|
||||
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.finish()
|
||||
|
Loading…
x
Reference in New Issue
Block a user