allow viewings csv input in get_vcinema_viewings

This commit is contained in:
Sarah 2022-03-12 12:16:13 +00:00
parent cd4b392573
commit b9a4ee9530

View File

@ -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")