مجهول

تغييرات

من ويكي أضِف
أنشأ الصفحة ب'<pre> ''' mawred.py - pandora_client plugin custom parse_path for pandora_client to parse mawred archive paths in the form YYYY/Event/Day/MVI_2036.MOV '''...'
<pre>
'''
mawred.py - pandora_client plugin

custom parse_path for pandora_client to parse mawred archive paths in the form

YYYY/Event/Day/MVI_2036.MOV

'''
import re
import ox

def example_path(client):
return '\t' + 'YYYY/Event/Day/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
'''
m = re.compile('^(?P<year>\d{4})/(?P<event>.+?)/(?P<day>.+?)/.*').match(path)
if not m:
return None
info = m.groupdict()
date = '%s' % (info['year'])
for key in info:
if info[key]:
info[key] = info[key].replace('_', ' ')

event = [info['event']]
title = "%s, %s %s" % ( info['event'],info['day'],info['year'])

r = {
'year': date,
'title': title,
'topic': event
}
_info = ox.movie.parse_path(path)
for key in ('extension', 'type'):
r[key] = _info[key]
return r


</pre>
بيروقراطيون، checkuser، smwadministrator، smwcurator، staff، إداريون، تقنيون
2٬074

تعديل