2022-03-25 22:19:40 +00:00
|
|
|
from collections import OrderedDict
|
|
|
|
import string
|
|
|
|
|
|
|
|
from vcinema_utils import VCinemaUtils
|
|
|
|
|
|
|
|
# Page ID of https://wiki.jacknet.io/books/vcinema/page/references
|
2022-04-15 17:22:04 +01:00
|
|
|
PAGE_ID = 62
|
2022-03-25 22:19:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
def get_films_by_reference(viewings):
|
|
|
|
viewings_filtered_by_keyword = VCinemaUtils.filter_viewings(viewings, "keywords")
|
|
|
|
viewings_filtered_by_reference_keyword = {k: v for k, v in viewings_filtered_by_keyword.items() if k.startswith("reference-to")}
|
|
|
|
|
|
|
|
return viewings_filtered_by_reference_keyword
|
|
|
|
|
|
|
|
|
2022-04-03 22:27:49 +01:00
|
|
|
def build_page(films_by_reference_keyword):
|
|
|
|
reference_keywords_sorted = OrderedDict(sorted(films_by_reference_keyword.items(), key=lambda t: t[0]))
|
2022-03-25 22:19:40 +00:00
|
|
|
|
2022-04-08 22:01:58 +01:00
|
|
|
table = "| Referenced | Films |\n| - | - |"
|
2022-03-25 22:19:40 +00:00
|
|
|
|
|
|
|
for year in reference_keywords_sorted.keys():
|
2022-04-08 22:01:58 +01:00
|
|
|
table += "\n"
|
2022-03-25 22:19:40 +00:00
|
|
|
|
2022-04-08 22:01:58 +01:00
|
|
|
row_data = []
|
|
|
|
row_data.append(str(string.capwords(year[13:].replace("-", " "))))
|
|
|
|
row_data.append(VCinemaUtils.get_film_list(reference_keywords_sorted[year]))
|
|
|
|
|
|
|
|
table += " | ".join(row_data)
|
|
|
|
|
|
|
|
return table
|