commit 877ad77fa9b36e31a8347465a402ba983a87ec94 Author: j <0x006A@0x2620.org> Date: Wed Apr 24 19:42:47 2013 +0200 inital commit diff --git a/README b/README new file mode 100644 index 0000000..c57fe8e --- /dev/null +++ b/README @@ -0,0 +1 @@ +to use mosireen.py put it in ~/.ox/client.d/ diff --git a/mosireen.py b/mosireen.py new file mode 100644 index 0000000..657055e --- /dev/null +++ b/mosireen.py @@ -0,0 +1,38 @@ +''' + mosireen.py - pandora_client plugin + + custom parse_path for pandora_client to parse musereen archive paths in the form + + MM_YYYY/DD_MM_YYYY/Location 1/Location 2/Subject 1/Cinematographer/Subject 2/MVI_2036.MOV + +''' +import re + +def example_path(client): + return '\t' + 'MM_YYYY/DD_MM_YYYY/Location 1/Location 2/Subject 1/Shooter/Subject 2/MVI_2036.MOV' + +def parse_path(client, path): + ''' + args: + client - Client instance + path - path without volume prefix + return: + return None if file is ignored, dict with parsed item information otherwise + ''' + reg = re.compile('(\d{2})_(\d{4})/(?P\d+)_(?P\d+)_(?P\d{4})/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/.*') + m = reg.match(path) + if not m: + return None + path_info = m.groupdict() + date = '%s-%s-%s' % (path_info['day'], path_info['month'], path_info['year']) + for key in path_info: + path_info[key] = path_info[key].replace('_', ' ') + return { + 'date': date, + 'location': '%s, %s' % (path_info['location2'], path_info['location1']), + 'title': "%s, %s (%s)" % (path_info['subject1'], path_info['subject2'], date), + 'cinematographer': [path_info['cinematographer']], + 'topic': [path_info['subject1'], path_info['subject2']] + } + +