Compare commits
7 Commits
e9a5b0ee51
...
82e847cd2a
Author | SHA1 | Date | |
---|---|---|---|
![]() |
82e847cd2a | ||
![]() |
8ba89ea288 | ||
![]() |
632542c139 | ||
![]() |
70d4f84679 | ||
![]() |
79a0c255cf | ||
![]() |
3f420b061a | ||
![]() |
d64621aa73 |
@ -30,6 +30,6 @@ class MarkdownTable:
|
||||
|
||||
for row in self.rows:
|
||||
table += "\n"
|
||||
table += " | ".join(row)
|
||||
table += " | ".join(map(str, row))
|
||||
|
||||
return table
|
||||
|
@ -132,11 +132,11 @@ def get_film_list(films):
|
||||
|
||||
|
||||
def generate_imdb_film_link(film):
|
||||
return generate_markdown_link(film['title'], generate_imdb_url(film['imdb_id']))
|
||||
return MarkdownUtils.generate_markdown_link(film['title'], generate_imdb_url(film['imdb_id']))
|
||||
|
||||
|
||||
def generate_wikipedia_page_link(page_title):
|
||||
return generate_markdown_link(page_title, generate_wikipedia_url(page_title))
|
||||
return MarkdownUtils.generate_markdown_link(page_title, generate_wikipedia_url(page_title))
|
||||
|
||||
|
||||
def generate_imdb_url(imdb_id):
|
||||
|
@ -38,7 +38,7 @@ def build_page(films_by_country):
|
||||
png_data = draw_map(country_counter)
|
||||
encoded = base64.b64encode(png_data).decode("utf-8")
|
||||
image = "".format(encoded)
|
||||
page = image + "\n" + table
|
||||
page = image + "\n" + str(table)
|
||||
|
||||
return page
|
||||
|
||||
@ -64,17 +64,12 @@ def build_table(films_by_country):
|
||||
table = MarkdownUtils.MarkdownTable(["Country", "Films"])
|
||||
|
||||
for country, films in films_by_country_sorted.items():
|
||||
table += "\n"
|
||||
|
||||
row_data = []
|
||||
|
||||
country_label = country
|
||||
if country in flags.keys():
|
||||
country_label += " "
|
||||
country_label += flags[country]
|
||||
country += " " + flags[country]
|
||||
|
||||
row_data.append(country_label)
|
||||
row_data.append(VCinemaUtils.get_film_list(films))
|
||||
films = VCinemaUtils.get_film_list(films)
|
||||
|
||||
row_data = [country, films]
|
||||
|
||||
table.add_row(row_data)
|
||||
|
||||
|
@ -76,16 +76,11 @@ def build_page(films_by_reference):
|
||||
table = MarkdownUtils.MarkdownTable(["Referenced", "Films"])
|
||||
|
||||
for reference, referenced in films_by_reference.items():
|
||||
table += "\n"
|
||||
reference = MarkdownUtils.generate_markdown_link(reference, referenced["url"])
|
||||
films = VCinemaUtils.get_film_list(referenced["films"])
|
||||
|
||||
row_data = []
|
||||
row_data = [reference, films]
|
||||
|
||||
reference_url = referenced["url"]
|
||||
referenced_films = referenced["films"]
|
||||
table.add_row(row_data)
|
||||
|
||||
row_data.append(VCinemaUtils.generate_markdown_link(reference, reference_url))
|
||||
row_data.append(VCinemaUtils.get_film_list(referenced_films))
|
||||
|
||||
table += " | ".join(row_data)
|
||||
|
||||
return table
|
||||
return str(table)
|
||||
|
@ -20,12 +20,14 @@ def update_page(token_id, token_secret, films_by_year):
|
||||
|
||||
|
||||
def build_page(films_by_year):
|
||||
films_by_year_sorted = OrderedDict(sorted(films_by_year.items(), key=lambda t: t[0], reverse=True))
|
||||
films_by_year = OrderedDict(sorted(films_by_year.items(), key=lambda t: t[0], reverse=True))
|
||||
|
||||
table = MarkdownUtils.MarkdownTable(["Year", "Films"])
|
||||
|
||||
for year in films_by_year_sorted.keys():
|
||||
row_data = [str(year), VCinemaUtils.get_film_list(films_by_year_sorted[year])]
|
||||
for year in films_by_year.keys():
|
||||
films = VCinemaUtils.get_film_list(films_by_year[year])
|
||||
|
||||
row_data = [year, films]
|
||||
table.add_row(row_data)
|
||||
|
||||
return table
|
||||
return str(table)
|
||||
|
@ -64,11 +64,8 @@ def build_page(hidden_themes):
|
||||
table = MarkdownUtils.MarkdownTable(["Date", "Films", "Hidden Themes"])
|
||||
|
||||
for date, data in hidden_themes.items():
|
||||
table += "\n"
|
||||
films = VCinemaUtils.get_film_list(data['viewings'])
|
||||
|
||||
row_data = []
|
||||
row_data.append(str(date))
|
||||
row_data.append(VCinemaUtils.get_film_list(data['viewings']))
|
||||
if 'hidden_themes' in data and data['hidden_themes'] != {}:
|
||||
hidden_theme_labels = []
|
||||
|
||||
@ -78,10 +75,11 @@ def build_page(hidden_themes):
|
||||
else:
|
||||
hidden_theme_labels.append("<i>{} ({}%)</i>".format(hidden_theme, round(data['hidden_themes'][hidden_theme] * 100)))
|
||||
|
||||
row_data.append("<br>".join(hidden_theme_labels))
|
||||
hidden_themes = "<br>".join(hidden_theme_labels)
|
||||
else:
|
||||
row_data.append("N/A")
|
||||
hidden_themes = "N/A"
|
||||
|
||||
row_data = [date, films, hidden_themes]
|
||||
table.add_row(row_data)
|
||||
|
||||
return table
|
||||
return str(table)
|
||||
|
@ -70,13 +70,12 @@ def build_page(keyword_data, minimum_score=1.0):
|
||||
table = MarkdownUtils.MarkdownTable(["Keyword", "Number of VCinema Films", "Total IMDb entries", "Score"])
|
||||
|
||||
for keyword, data in keyword_data.items():
|
||||
table += "\n"
|
||||
number_of_vcinema_films = len(data['vcinema_films'])
|
||||
number_of_imdb_films = data['total']
|
||||
keyword_score = round(data['score'], 3)
|
||||
|
||||
row_data = [keyword, number_of_vcinema_films, number_of_imdb_films, keyword_score]
|
||||
|
||||
row_data = []
|
||||
row_data.append(str(keyword))
|
||||
row_data.append(str(len(data['vcinema_films'])))
|
||||
row_data.append(str(data['total']))
|
||||
row_data.append(str(round(data['score'], 3)))
|
||||
table.add_row(row_data)
|
||||
|
||||
return table
|
||||
|
Loading…
x
Reference in New Issue
Block a user