generate maps by running total
This commit is contained in:
parent
1e970b4fb5
commit
79ff5c76ec
@ -2,6 +2,7 @@ from wiki_pages import FilmsByCountry
|
||||
from vcinema_utils import VCinemaUtils
|
||||
|
||||
import argparse
|
||||
from collections import OrderedDict
|
||||
from progress.bar import IncrementalBar
|
||||
|
||||
|
||||
@ -15,13 +16,21 @@ def generate_map_timelapse(token_id, token_secret):
|
||||
|
||||
date_viewings = VCinemaUtils.filter_viewings(viewings, "date_watched")
|
||||
|
||||
date_viewings = OrderedDict(sorted(date_viewings.items(), key=lambda t: t[0]))
|
||||
|
||||
running_country_counts = {}
|
||||
|
||||
for date, viewings in date_viewings.items():
|
||||
date_viewings_countries = VCinemaUtils.filter_viewings(viewings, "countries")
|
||||
|
||||
print(date_viewings_countries)
|
||||
for country in date_viewings_countries:
|
||||
if country in running_country_counts.keys():
|
||||
running_country_counts[country] += date_viewings_countries[country]
|
||||
else:
|
||||
running_country_counts[country] = date_viewings_countries[country]
|
||||
|
||||
with open("map-{}.png".format(date), "wb") as f:
|
||||
f.write(FilmsByCountry.draw_map(date_viewings_countries, file_name="map-{}.svg".format(date)))
|
||||
f.write(FilmsByCountry.draw_map(running_country_counts, file_name="map-{}.svg".format(date)))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
x
Reference in New Issue
Block a user