inital commit
This commit is contained in:
commit
877ad77fa9
2 changed files with 39 additions and 0 deletions
1
README
Normal file
1
README
Normal file
|
@ -0,0 +1 @@
|
|||
to use mosireen.py put it in ~/.ox/client.d/
|
38
mosireen.py
Normal file
38
mosireen.py
Normal file
|
@ -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<day>\d+)_(?P<month>\d+)_(?P<year>\d{4})/(?P<location1>.+)/(?P<location2>.+)/(?P<subject1>.+)/(?P<cinematographer>.+)/(?P<subject2>.+)/.*')
|
||||
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']]
|
||||
}
|
||||
|
||||
|
Loading…
Reference in a new issue