From 0a1325c98d60d8b183f70c071f9a7c60985ee1e0 Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 27 Jun 2022 00:18:03 +0100 Subject: [PATCH] revert changes --- update_wiki.py | 35 ++++++++++++++++++----------------- wiki_pages/ActorScores.py | 26 -------------------------- 2 files changed, 18 insertions(+), 43 deletions(-) delete mode 100644 wiki_pages/ActorScores.py diff --git a/update_wiki.py b/update_wiki.py index 5c252f1..2078645 100644 --- a/update_wiki.py +++ b/update_wiki.py @@ -37,24 +37,25 @@ def update_wiki(token_id, token_secret, update_csv, pages): update_page_count = sum([update_films_by_year, update_films_by_country, update_film_references, update_hidden_themes, update_keyword_scores]) - with IncrementalBar('Processing viewing data', max=update_page_count, suffix='%(percent).1f%% - %(eta)ds remaining', check_tty=False) as bar: - if update_films_by_year: - films_by_year = FilmsByYear.get_films_by_year(viewings) - bar.next() - if update_films_by_country: - films_by_country = FilmsByCountry.get_films_by_country(viewings) - bar.next() - if update_film_references: - films_by_reference = FilmsByReference.get_films_by_reference(viewings) - bar.next() - if update_hidden_themes: - hidden_themes = HiddenThemes.get_hidden_themes(viewings, token_id, token_secret) - bar.next() - if update_keyword_scores: - keyword_scores = KeywordScores.get_keyword_scores(viewings) - bar.next() + print("Processing viewing data") - bar.finish() + if update_films_by_year: + films_by_year = FilmsByYear.get_films_by_year(viewings) + FilmsByYear.update_page(token_id, token_secret, films_by_year) + if update_films_by_country: + films_by_country = FilmsByCountry.get_films_by_country(viewings) + FilmsByCountry.update_page(token_id, token_secret, films_by_country) + if update_film_references: + films_by_reference = FilmsByReference.get_films_by_reference(viewings) + FilmsByReference.update_page(token_id, token_secret, films_by_reference) + if update_hidden_themes: + hidden_themes = HiddenThemes.get_hidden_themes(viewings, token_id, token_secret) + HiddenThemes.update_page(token_id, token_secret, hidden_themes) + if update_keyword_scores: + keyword_scores = KeywordScores.get_keyword_scores(viewings) + KeywordScores.update_page(token_id, token_secret, keyword_scores) + + print("Done!") with IncrementalBar('Updating pages', max=update_page_count, check_tty=False) as bar: if update_films_by_year: diff --git a/wiki_pages/ActorScores.py b/wiki_pages/ActorScores.py deleted file mode 100644 index 4869867..0000000 --- a/wiki_pages/ActorScores.py +++ /dev/null @@ -1,26 +0,0 @@ -from collections import Counter, OrderedDict -import warnings - -from vcinema_utils import VCinemaUtils - -warnings.filterwarnings("ignore") - - -def get_actor_scores(viewings): - for viewing_ind in range(len(viewings)): - viewing = viewings[viewing_ind] - - cast_list = [] - - for cast_member in viewing['cast']: - cast_member_name = (cast_member['name'], cast_member.currentRole) - cast_list.append(cast_member_name) - - viewings[viewing_ind]['cast'] = cast_list - - viewings_filtered_by_cast_member = VCinemaUtils.filter_viewings(viewings, "cast") - - viewings_filtered_by_cast_member = OrderedDict(sorted(viewings_filtered_by_cast_member.items(), key=lambda t: len(t[1]), reverse=True)) - - return viewings_filtered_by_cast_member -