add first scripts
This commit is contained in:
parent
72c4e5864e
commit
00b3f49063
|
@ -0,0 +1,40 @@
|
|||
import argparse
|
||||
from datetime import datetime
|
||||
import json
|
||||
from progress.bar import IncrementalBar
|
||||
|
||||
from vcinema_utils import VCinemaUtils
|
||||
|
||||
|
||||
def get_new_years(token_id, token_secret, year):
|
||||
print("Getting viewings")
|
||||
viewings = VCinemaUtils.get_vcinema_viewings(token_id, token_secret)
|
||||
|
||||
with IncrementalBar('Retrieving movie data', max=len(viewings), suffix='%(percent).1f%% - %(eta)ds remaining', check_tty=False) as bar:
|
||||
VCinemaUtils.add_imdb_data_to_viewings(viewings, ["countries"], bar)
|
||||
|
||||
viewings_before_year = VCinemaUtils.get_viewings_before_date(viewings, datetime(day=31, month=12, year=year-1))
|
||||
viewings_end_of_year = VCinemaUtils.get_viewings_before_date(viewings, datetime(day=31, month=12, year=year))
|
||||
|
||||
viewings_before_year_filtered_by_year = VCinemaUtils.filter_viewings(viewings_before_year, "countries")
|
||||
viewings_end_of_year_filtered_by_year = VCinemaUtils.filter_viewings(viewings_end_of_year, "countries")
|
||||
|
||||
years_before = set(list(viewings_before_year_filtered_by_year.keys()))
|
||||
years_after = set(list(viewings_end_of_year_filtered_by_year.keys()))
|
||||
|
||||
years_diff = years_after - years_before
|
||||
|
||||
print(years_diff)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description='Update wiki pages.')
|
||||
|
||||
parser.add_argument('year', type=int)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
with open('../token.json') as json_file:
|
||||
token = json.load(json_file)
|
||||
|
||||
get_new_years(token['token_id'], token['token_secret'], args.year)
|
|
@ -0,0 +1,40 @@
|
|||
import argparse
|
||||
from datetime import datetime
|
||||
import json
|
||||
from progress.bar import IncrementalBar
|
||||
|
||||
from vcinema_utils import VCinemaUtils
|
||||
|
||||
|
||||
def get_new_years(token_id, token_secret, year):
|
||||
print("Getting viewings")
|
||||
viewings = VCinemaUtils.get_vcinema_viewings(token_id, token_secret)
|
||||
|
||||
with IncrementalBar('Retrieving movie data', max=len(viewings), suffix='%(percent).1f%% - %(eta)ds remaining', check_tty=False) as bar:
|
||||
VCinemaUtils.add_imdb_data_to_viewings(viewings, ["year"], bar)
|
||||
|
||||
viewings_before_year = VCinemaUtils.get_viewings_before_date(viewings, datetime(day=31, month=12, year=year-1))
|
||||
viewings_end_of_year = VCinemaUtils.get_viewings_before_date(viewings, datetime(day=31, month=12, year=year))
|
||||
|
||||
viewings_before_year_filtered_by_year = VCinemaUtils.filter_viewings(viewings_before_year, "year")
|
||||
viewings_end_of_year_filtered_by_year = VCinemaUtils.filter_viewings(viewings_end_of_year, "year")
|
||||
|
||||
years_before = set(list(viewings_before_year_filtered_by_year.keys()))
|
||||
years_after = set(list(viewings_end_of_year_filtered_by_year.keys()))
|
||||
|
||||
years_diff = years_after - years_before
|
||||
|
||||
print(years_diff)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description='Update wiki pages.')
|
||||
|
||||
parser.add_argument('year', type=int)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
with open('../token.json') as json_file:
|
||||
token = json.load(json_file)
|
||||
|
||||
get_new_years(token['token_id'], token['token_secret'], args.year)
|
Loading…
Reference in New Issue