From 329948c68e751f555421153b936103fbf9286c65 Mon Sep 17 00:00:00 2001
From: Rich Wareham <rjw57@cam.ac.uk>
Date: Tue, 27 Nov 2018 12:20:36 +0000
Subject: [PATCH 1/2] fix logging of troublesome rows

The row is a dictionary not a list so doing ','.join(row) will give the
puzzling result of printing out the header row :).
---
 opencastcsvschedule/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/opencastcsvschedule/__init__.py b/opencastcsvschedule/__init__.py
index 0ef4750..d3bd795 100644
--- a/opencastcsvschedule/__init__.py
+++ b/opencastcsvschedule/__init__.py
@@ -125,7 +125,7 @@ def schedule_events(input_fobj, base_url, user, password):
             response.raise_for_status()
         except Exception as e:
             logging.error('Error posting event')
-            logging.error('Row was: %s', ','.join(row))
+            logging.error('Row was: %r', row)
             logging.exception(e)
 
 
-- 
GitLab


From d743550343ef095f4109457c853f9561f9fd6836 Mon Sep 17 00:00:00 2001
From: Rich Wareham <rjw57@cam.ac.uk>
Date: Tue, 27 Nov 2018 12:25:05 +0000
Subject: [PATCH 2/2] go back to specifying start and end times for events

Empirically, specifying start and duration only causes an internal
server error. Go back to start and end for the moment.
---
 opencastcsvschedule/__init__.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/opencastcsvschedule/__init__.py b/opencastcsvschedule/__init__.py
index d3bd795..0002a20 100644
--- a/opencastcsvschedule/__init__.py
+++ b/opencastcsvschedule/__init__.py
@@ -158,10 +158,9 @@ def oc_metadata(row):
 
 def oc_sched(row):
     """Create opencast schedule for an event"""
-    duration = _parse_date(row["stopTime"]) - _parse_date(row["startTime"])
     sched = {"agent_id": row["location"],
              "start": row["startTime"],
-             "duration": 1000 * int(duration.total_seconds()),
+             "end": row["stopTime"],
              "inputs": ["default"]}
     return sched
 
-- 
GitLab