Added optional arguments title and user to create_recording(), to make it possible to affect those attributes.
- Legacy-Id: 14966
This commit is contained in:
parent
e33afadcb7
commit
0ef66ae9e2
|
@ -177,7 +177,7 @@ def get_or_create_recording_document(url,session):
|
||||||
except ObjectDoesNotExist:
|
except ObjectDoesNotExist:
|
||||||
return create_recording(session,url)
|
return create_recording(session,url)
|
||||||
|
|
||||||
def create_recording(session,url):
|
def create_recording(session, url, title=None, user=None):
|
||||||
'''
|
'''
|
||||||
Creates the Document type=recording, setting external_url and creating
|
Creates the Document type=recording, setting external_url and creating
|
||||||
NewRevisionDocEvent
|
NewRevisionDocEvent
|
||||||
|
@ -185,10 +185,11 @@ def create_recording(session,url):
|
||||||
sequence = get_next_sequence(session.group,session.meeting,'recording')
|
sequence = get_next_sequence(session.group,session.meeting,'recording')
|
||||||
name = 'recording-{}-{}-{}'.format(session.meeting.number,session.group.acronym,sequence)
|
name = 'recording-{}-{}-{}'.format(session.meeting.number,session.group.acronym,sequence)
|
||||||
time = session.official_timeslotassignment().timeslot.time.strftime('%Y-%m-%d %H:%M')
|
time = session.official_timeslotassignment().timeslot.time.strftime('%Y-%m-%d %H:%M')
|
||||||
if url.endswith('mp3'):
|
if not title:
|
||||||
title = 'Audio recording for {}'.format(time)
|
if url.endswith('mp3'):
|
||||||
else:
|
title = 'Audio recording for {}'.format(time)
|
||||||
title = 'Video recording for {}'.format(time)
|
else:
|
||||||
|
title = 'Video recording for {}'.format(time)
|
||||||
|
|
||||||
doc = Document.objects.create(name=name,
|
doc = Document.objects.create(name=name,
|
||||||
title=title,
|
title=title,
|
||||||
|
@ -202,7 +203,7 @@ def create_recording(session,url):
|
||||||
|
|
||||||
# create DocEvent
|
# create DocEvent
|
||||||
NewRevisionDocEvent.objects.create(type='new_revision',
|
NewRevisionDocEvent.objects.create(type='new_revision',
|
||||||
by=Person.objects.get(name='(System)'),
|
by=user or Person.objects.get(name='(System)'),
|
||||||
doc=doc,
|
doc=doc,
|
||||||
rev=doc.rev,
|
rev=doc.rev,
|
||||||
desc='New revision available',
|
desc='New revision available',
|
||||||
|
|
Loading…
Reference in a new issue