summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/python/import_cals.py9
-rw-r--r--config/reddit-import.json6
2 files changed, 12 insertions, 3 deletions
diff --git a/app/python/import_cals.py b/app/python/import_cals.py
index a08bfb2..f9e7fbd 100644
--- a/app/python/import_cals.py
+++ b/app/python/import_cals.py
@@ -65,10 +65,15 @@ def update_calendar(cal, session):
db_cal.website, cal['website'], db_cal.uid)
db_cal.website = cal['website']
+ cal['category'] = CONFIG['category_mapping'][cal['category']] \
+ if ('category_mapping' in CONFIG \
+ and cal['category'] in CONFIG['category_mapping']) \
+ else cal['category']
+
# informational only
if db_cal.category.name != cal['category']:
- print 'Calendar category changed: %s -> %s (%s)' % (
- db_cal.category.name, cal['category'], db_cal.uid)
+ print 'Calendar category changed: %s -> %s (%s, %s)' % (
+ db_cal.category.name, cal['category'], db_cal.name, db_cal.uid)
def get_imported_calendars(cells, ical_markdown):
diff --git a/config/reddit-import.json b/config/reddit-import.json
index f15bd77..0f72515 100644
--- a/config/reddit-import.json
+++ b/config/reddit-import.json
@@ -2,5 +2,9 @@
"cache": "cache/list.md",
"cache_time": 86400,
"reddit_url": "https://www.reddit.com/r/MotorsportsCalendar/wiki/index.json",
- "user_agent": "/u/emkael"
+ "user_agent": "/u/emkael",
+ "category_mapping": {
+ "GT": "Grand Touring",
+ "Touring": "Touring Car"
+ }
}