fix mosireen plugin
This commit is contained in:
parent
877ad77fa9
commit
5ff1f8811b
1 changed files with 27 additions and 13 deletions
40
mosireen.py
40
mosireen.py
|
@ -3,13 +3,14 @@
|
|||
|
||||
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
|
||||
YYYY/MM_YYYY/DD_MM_YYYY/Location 1/Location 2/Subject 1/Cinematographer/Subject 2(optional)/MVI_2036.MOV
|
||||
|
||||
'''
|
||||
import re
|
||||
import ox
|
||||
|
||||
def example_path(client):
|
||||
return '\t' + 'MM_YYYY/DD_MM_YYYY/Location 1/Location 2/Subject 1/Shooter/Subject 2/MVI_2036.MOV'
|
||||
return '\t' + 'YYYY/MM_YYYY/DD_MM_YYYY/Location 1/Location 2/Subject 1/Shooter/Subject 2(optional)/MVI_2036.MOV'
|
||||
|
||||
def parse_path(client, path):
|
||||
'''
|
||||
|
@ -19,20 +20,33 @@ def parse_path(client, path):
|
|||
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)
|
||||
m = re.compile('^(\d{4})/(\d{2})_(\d{4})/(?P<day>\d+)_(?P<month>\d+)_(?P<year>\d{4})/(?P<location1>.+?)/(?P<location2>.+?)/(?P<subject1>.+?)/(?P<shooter>.+?)/((?P<subject2>.+?)/|).*').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 {
|
||||
info = m.groupdict()
|
||||
date = '%s-%s-%s' % (info['year'], info['month'], info['day'])
|
||||
for key in info:
|
||||
if info[key]:
|
||||
info[key] = info[key].replace('_', ' ')
|
||||
|
||||
topic = [info['subject1']]
|
||||
if info['subject2']:
|
||||
topic.append(info['subject2'])
|
||||
title = "%s, %s (%s)" % (info['subject1'], info['subject2'], date)
|
||||
else:
|
||||
title = "%s (%s)" % (info['subject1'], date)
|
||||
title = "%s %s" % (title, info['shooter'])
|
||||
|
||||
r = {
|
||||
'cinematographer': [info['shooter']],
|
||||
'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']]
|
||||
'location': '%s, %s' % (info['location2'], info['location1']),
|
||||
'title': title,
|
||||
'topic': topic
|
||||
}
|
||||
_info = ox.movie.parse_path(path)
|
||||
for key in ('extension', 'type'):
|
||||
r[key] = _info[key]
|
||||
return r
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue