diff --git a/generate_map_timelapse.py b/generate_map_timelapse.py index 74abed0..0f0599c 100644 --- a/generate_map_timelapse.py +++ b/generate_map_timelapse.py @@ -10,7 +10,7 @@ from PIL import Image, ImageFont, ImageDraw, ImageFont import io -def generate_map_timelapse(token_id, token_secret): +def generate_map_timelapse(token_id, token_secret, filename): print("Getting viewings") viewings = VCinemaUtils.get_vcinema_viewings(token_id, token_secret, combine_repeat_viewings=False) @@ -25,7 +25,7 @@ def generate_map_timelapse(token_id, token_secret): running_country_counts = {} print(len(date_viewings.keys())) - with imageio.get_writer('test.gif', mode='I', duration=0.1) as writer: + with imageio.get_writer(filename, mode='I', duration=0.1) as writer: for date, viewings in date_viewings.items(): date_viewings_countries = VCinemaUtils.filter_viewings(viewings, "countries") @@ -52,16 +52,17 @@ def generate_map_timelapse(token_id, token_secret): print("optimizing") - optimize("test.gif") + optimize(filename) print("done") if __name__ == '__main__': - parser = argparse.ArgumentParser(description='Update wiki pages.') + parser = argparse.ArgumentParser(description='Create timelapse gif of vcinema countries') parser.add_argument('token_id', help='API token ID.') parser.add_argument('token_secret', help='API token secret.') + parser.add_argument('filename', help='Name of output gif') args = parser.parse_args() - generate_map_timelapse(args.token_id, args.token_secret) + generate_map_timelapse(args.token_id, args.token_secret, args.filename)