diff --git a/vcinema_utils/VCinemaUtils.py b/vcinema_utils/VCinemaUtils.py index c002348..c617e85 100644 --- a/vcinema_utils/VCinemaUtils.py +++ b/vcinema_utils/VCinemaUtils.py @@ -19,10 +19,11 @@ def get_viewings_csv_attachment_id(token_id, token_secret): return next((x['id'] for x in attachments if x['uploaded_to'] == page_id and x['name'] == viewings_csv_file_name), None) -def get_vcinema_viewings(token_id, token_secret, combine_repeat_viewings=True): - attachment_id = get_viewings_csv_attachment_id(token_id, token_secret) +def get_vcinema_viewings(token_id, token_secret, viewings_csv=None, combine_repeat_viewings=True): + if viewings_csv is None: + attachment_id = get_viewings_csv_attachment_id(token_id, token_secret) + viewings_csv = Bookstack.get_attachment(JACKNET_WIKI_URL, token_id, token_secret, attachment_id) - viewings_csv = Bookstack.get_attachment(JACKNET_WIKI_URL, token_id, token_secret, attachment_id) viewings_csv = viewings_csv.decode("utf-8") viewings_csv_rows = viewings_csv.strip().split("\n")