From 86ec04bec4f819dfd53cb4a5b515963d1e374619 Mon Sep 17 00:00:00 2001 From: Stephen Romansky Date: Wed, 17 Dec 2014 22:05:51 -0700 Subject: [PATCH] Update csv import plugin to support presentation fields Fix #675 --- src/freeseer/framework/database.py | 27 +++++++++++++------ src/freeseer/plugins/importer/csv_importer.py | 5 +++- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/freeseer/framework/database.py b/src/freeseer/framework/database.py index 57d17ed8..d6debf5d 100644 --- a/src/freeseer/framework/database.py +++ b/src/freeseer/framework/database.py @@ -384,14 +384,25 @@ def add_talks_from_csv(self, fname): if presentations: for presentation in presentations: - talk = Presentation(presentation["Title"], - presentation["Speaker"], - presentation["Abstract"], # Description - presentation["Level"], - presentation["Event"], - presentation["Room"], - presentation["Time"], - presentation["Time"]) + if presentation['Time'] != '': + talk = Presentation(presentation["Title"], + presentation["Speaker"], + presentation["Abstract"], # Description + presentation["Level"], + presentation["Event"], + presentation["Room"], + presentation["Time"], + presentation["Time"]) # Presentation using legacy time field + else: + talk = Presentation(presentation["Title"], + presentation["Speaker"], + presentation["Abstract"], # Description + presentation["Level"], + presentation["Event"], + presentation["Room"], + presentation["Date"], + presentation["StartTime"], + presentation["EndTime"]) self.insert_presentation(talk) else: diff --git a/src/freeseer/plugins/importer/csv_importer.py b/src/freeseer/plugins/importer/csv_importer.py index 9c367a41..1c0979d8 100644 --- a/src/freeseer/plugins/importer/csv_importer.py +++ b/src/freeseer/plugins/importer/csv_importer.py @@ -63,7 +63,10 @@ def get_presentations(self, fname): 'Level': unicode(row.get('Level', ''), 'utf-8'), 'Event': unicode(row.get('Event', ''), 'utf-8'), 'Room': unicode(row.get('Room', ''), 'utf-8'), - 'Time': unicode(row.get('Time', ''), 'utf-8') + 'Time': unicode(row.get('Time', ''), 'utf-8'), # Legacy csv time field + 'Date': unicode(row.get('Date', ''), 'utf-8'), + 'StartTime': unicode(row.get('StartTime', ''), 'utf-8'), + 'EndTime': unicode(row.get('EndTime', ''), 'utf-8') } presentations.append(talk)