diff --git a/country_flags.csv b/countries.csv similarity index 100% rename from country_flags.csv rename to countries.csv diff --git a/update_films_by_country.py b/update_films_by_country.py index eb1bc48..1e00617 100644 --- a/update_films_by_country.py +++ b/update_films_by_country.py @@ -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 = "".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 += "" + table = "| Country | Films |\n| - | - |" for country in films_by_country_sorted.keys(): - row = "" - - row += "" - - row += "" - row += "" - - 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 += "
".join(film_links) if bar is not None: bar.next() - table += "" - table += "
CountryFilms
" - row += "{} {}".format(str(country), flags[country] if country in flags.keys() else "") - row += "" - - film_links = ["{}".format(film['imdb_id'], film['title']) - for film in films_by_country_sorted[country]] - - row += "
".join(film_links) - - row += "
" - if bar is not None: bar.finish() diff --git a/update_wiki.py b/update_wiki.py index 50ba5e5..140da39 100644 --- a/update_wiki.py +++ b/update_wiki.py @@ -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()