Update update_wiki.py
This commit is contained in:
parent
08c22b1277
commit
732b32f39b
@ -1,5 +1,5 @@
|
|||||||
from wiki_pages import FilmsByCountry, FilmsByReference, FilmsByYear, HiddenThemes, KeywordScores, ViewingsCsv
|
from wiki_pages import FilmsByCountry, FilmsByReference, FilmsByYear, HiddenThemes, KeywordScores, ViewingsCsv
|
||||||
from vcinema_utils import VCinemaUtils
|
from vcinema_utils.VCinemaUtils import *
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
@ -12,7 +12,7 @@ def update_wiki(token_id, token_secret, update_csv, pages):
|
|||||||
ViewingsCsv.update_viewings_csv(token_id, token_secret)
|
ViewingsCsv.update_viewings_csv(token_id, token_secret)
|
||||||
|
|
||||||
print("Getting viewings")
|
print("Getting viewings")
|
||||||
viewings = VCinemaUtils.get_vcinema_viewings(token_id, token_secret)
|
films = get_vcinema_films(token_id, token_secret)
|
||||||
|
|
||||||
update_films_by_year = 'years' in pages
|
update_films_by_year = 'years' in pages
|
||||||
update_films_by_country = 'countries' in pages
|
update_films_by_country = 'countries' in pages
|
||||||
@ -30,26 +30,26 @@ def update_wiki(token_id, token_secret, update_csv, pages):
|
|||||||
if update_film_references or update_hidden_themes or update_keyword_scores:
|
if update_film_references or update_hidden_themes or update_keyword_scores:
|
||||||
data_fields.append("keywords")
|
data_fields.append("keywords")
|
||||||
|
|
||||||
viewing_count = len(viewings)
|
films_count = len(films)
|
||||||
with IncrementalBar('Retrieving movie data', max=viewing_count, suffix='%(percent).1f%% - %(eta)ds remaining', check_tty=False) as bar:
|
with IncrementalBar('Retrieving movie data', max=films_count, suffix='%(percent).1f%% - %(eta)ds remaining', check_tty=False) as bar:
|
||||||
VCinemaUtils.add_imdb_data_to_viewings(viewings, data_fields, bar)
|
add_imdb_data_to_films(films, data_fields, bar)
|
||||||
|
|
||||||
print("Processing viewing data")
|
print("Processing viewing data")
|
||||||
|
|
||||||
if update_films_by_year:
|
if update_films_by_year:
|
||||||
films_by_year = FilmsByYear.get_films_by_year(viewings)
|
films_by_year = FilmsByYear.get_films_by_year(films)
|
||||||
FilmsByYear.update_page(token_id, token_secret, films_by_year)
|
FilmsByYear.update_page(token_id, token_secret, films_by_year)
|
||||||
if update_films_by_country:
|
if update_films_by_country:
|
||||||
films_by_country = FilmsByCountry.get_films_by_country(viewings)
|
films_by_country = FilmsByCountry.get_films_by_country(films)
|
||||||
FilmsByCountry.update_page(token_id, token_secret, films_by_country)
|
FilmsByCountry.update_page(token_id, token_secret, films_by_country)
|
||||||
if update_film_references:
|
if update_film_references:
|
||||||
films_by_reference = FilmsByReference.get_films_by_reference(viewings)
|
films_by_reference = FilmsByReference.get_films_by_reference(films)
|
||||||
FilmsByReference.update_page(token_id, token_secret, films_by_reference)
|
FilmsByReference.update_page(token_id, token_secret, films_by_reference)
|
||||||
if update_hidden_themes:
|
if update_hidden_themes:
|
||||||
hidden_themes = HiddenThemes.get_hidden_themes(viewings, token_id, token_secret)
|
hidden_themes = HiddenThemes.get_hidden_themes(films, token_id, token_secret)
|
||||||
HiddenThemes.update_page(token_id, token_secret, hidden_themes)
|
HiddenThemes.update_page(token_id, token_secret, hidden_themes)
|
||||||
if update_keyword_scores:
|
if update_keyword_scores:
|
||||||
keyword_scores = KeywordScores.get_keyword_scores(viewings)
|
keyword_scores = KeywordScores.get_keyword_scores(films)
|
||||||
KeywordScores.update_page(token_id, token_secret, keyword_scores)
|
KeywordScores.update_page(token_id, token_secret, keyword_scores)
|
||||||
|
|
||||||
print("Done!")
|
print("Done!")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user