From ecfb2ff28c3317ae3d4197408cc3f21dd477e4ab Mon Sep 17 00:00:00 2001 From: j Date: Sun, 1 Jun 2008 22:27:03 +0200 Subject: [PATCH] fix json view, add img_extension --- oxdbarchive/extract.py | 2 ++ oxdbarchive/json.py | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/oxdbarchive/extract.py b/oxdbarchive/extract.py index 5c2cf82..dc5cbd5 100644 --- a/oxdbarchive/extract.py +++ b/oxdbarchive/extract.py @@ -11,6 +11,8 @@ import time from subtitles import time2ms +img_extension="jpg" + def extract_flash_ng(movie_file, flash_file, inpoint, outpoint, width=128, height=96, offset = 0): ext = movie_file.split('.')[-1] if ext in ('sub', 'srt'): diff --git a/oxdbarchive/json.py b/oxdbarchive/json.py index c1f0aa3..edf1c35 100644 --- a/oxdbarchive/json.py +++ b/oxdbarchive/json.py @@ -18,9 +18,12 @@ def jsonify_ArchiveFile(obj): result = jsonify_sqlobject( obj ) #FIXME, possibly do something with the date values # date, date_added, modDate, pubDate - for key in ('date_added', 'modDate', 'pubDate', 'date'): - result[key] = time.mktime(getattr(obj, key).timetuple()) - - for key in ('id', 'archiveID', 'subtitle_meta_id'): + _key_map= { + 'published': 'pubDate', + 'modified': 'modDate', + } + for key in ('date_added', 'published', 'modified', 'date'): + result[_key_map.get(key, key)] = time.mktime(getattr(obj, key).timetuple()) + for key in ('id', 'subtitle_meta_id'): result.pop(key) return result