refactor
This commit is contained in:
parent
0f59b2cd67
commit
9c1e4caf68
|
@ -21,10 +21,12 @@ def get_films_by_reference(viewings):
|
|||
films_by_reference[reference]["films"].append(viewing)
|
||||
break
|
||||
else:
|
||||
referenced = keyword[13:].replace("-", " ")
|
||||
keyword = keyword[13:]
|
||||
|
||||
if referenced.startswith("a "):
|
||||
referenced = referenced[2:]
|
||||
if keyword.startswith("a-"):
|
||||
keyword = keyword[2:]
|
||||
|
||||
referenced = keyword.replace("-", " ")
|
||||
|
||||
try:
|
||||
searches = wikipedia.search(referenced, suggestion=False)
|
||||
|
@ -63,11 +65,11 @@ def update_page(token_id, token_secret, films_by_reference_keyword):
|
|||
|
||||
|
||||
def build_page(films_by_reference):
|
||||
films_by_reference_sorted = OrderedDict(sorted(films_by_reference.items(), key=lambda t: t[0]))
|
||||
films_by_reference = OrderedDict(sorted(films_by_reference.items(), key=lambda t: t[0]))
|
||||
|
||||
table = "| Referenced | Films |\n| - | - |"
|
||||
|
||||
for reference, referenced in films_by_reference_sorted.items():
|
||||
for reference, referenced in films_by_reference.items():
|
||||
table += "\n"
|
||||
|
||||
row_data = []
|
||||
|
|
Loading…
Reference in New Issue