From de6b14697325964973a59befd61ff3434aaa7425 Mon Sep 17 00:00:00 2001 From: Jan Gerber Date: Thu, 2 Apr 2015 09:02:27 +0000 Subject: [PATCH] cleanup --- config.jsonc | 10 ++++++++++ data.py | 12 ++++++++---- get_data.py | 3 ++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/config.jsonc b/config.jsonc index e3f82d2..7a8e1ec 100644 --- a/config.jsonc +++ b/config.jsonc @@ -287,6 +287,16 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution. "find": true, "sort": true }, + { + "id": "topic", + "title": "Topic", + "type": ["string"], + "autocomplete": true, + "columnWidth": 120, + "filter": true, + "find": true, + "sort": true + }, { "id": "color", "title": "Color", diff --git a/data.py b/data.py index 46a93a5..c8846a7 100644 --- a/data.py +++ b/data.py @@ -28,6 +28,7 @@ def update_item(d, add_only=False): 'description': 'summary', 'id': 'archive', 'mp4': 'stream', + 'subject': 'topic', }.get(k,k):d[k] for k in d} for k in ('type', 'flv', 'video'): if k in info: @@ -68,12 +69,16 @@ def update_item(d, add_only=False): info['color'] = [{ 'color': 'Color', 'c': 'Color', + 'b': 'B&W', + 'w': 'B&W', 'sepia': 'Sepia', 'tinted': 'Tinted', + 'tinted B&W': 'B&W (tinted)', 'black and white': 'B&W', + 'black & white': 'B&W', 'bw': 'B&W', 'b&w': 'B&W', - }.get(c.lower(), c) for c in info['color'].replace('b/w', 'b&w').split('/')] + }.get(c.lower(), c) for c in info['color'].replace('b/w', 'b&w').replace('B/W', 'B&W').split('/')] i, created = get_item(info['archive']) if add_only and not created: @@ -91,11 +96,10 @@ def update_items(add_only=False): for d in data: update_item(d, add_only) -def update_item_stream(i): - if update_stream(i): +def update_item_stream(i, force=False): + if update_stream(i) or force: for s in i.streams(): s.make_timeline() - i.level = 0 i.save() i.update_timeline() i.make_poster(True) diff --git a/get_data.py b/get_data.py index cdc278e..8e44f9b 100644 --- a/get_data.py +++ b/get_data.py @@ -24,7 +24,8 @@ for e in internetarchive.search.Search('collection:prelinger'): 'title', 'description', 'year', 'publisher', 'addeddate', 'sound', 'creator', 'color', 'credits', 'publisher', - 'sponsor', 'uploader', 'licenseurl', + 'sponsor', 'uploader', 'licenseurl', 'subject', + 'language' #needed? 'date', ):