Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
Merge pull request #447 from peterbe/not-hd-again-if-not-originally-hd
Browse files Browse the repository at this point in the history
fixes bug 1194855 - Resubmit video edits in on-HD if necessary
  • Loading branch information
Nolski committed Aug 14, 2015
2 parents cbb3506 + 5fd4b65 commit 21a3615
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
13 changes: 12 additions & 1 deletion airmozilla/popcorn/renderer.py
Expand Up @@ -86,10 +86,21 @@ def render_edit(edit_id, verbose=False):
webhook_url = build_absolute_url(reverse('popcorn:vidly_webhook'))
token_protection = event.privacy != Event.PRIVACY_PUBLIC

# if the original submission was *without* HD stick to that
hd = True
if 'vid.ly' in event.template.name.lower():
submissions = (
VidlySubmission.objects
.filter(event=event)
.order_by('submission_time')
)
for submission in submissions[:1]:
hd = submission.hd

tag, error = vidly.add_media(
url=video_url,
token_protection=token_protection,
hd=True,
hd=hd,
notify_url=webhook_url,
)

Expand Down
18 changes: 16 additions & 2 deletions airmozilla/popcorn/tests/test_renderer.py
Expand Up @@ -67,6 +67,16 @@ def generate_url_mock(expires_in, query_auth):
p_key.side_effect = make_mock_key

event = Event.objects.get(title='Test event')
event.template.name = 'Vid.ly Template'
event.template.save()

VidlySubmission.objects.create(
event=event,
tag='abc123',
url='http://s3.com/file.mpg',
hd=True,
token_protection=False
)

edit = PopcornEdit.objects.create(
event=event,
Expand All @@ -77,9 +87,13 @@ def generate_url_mock(expires_in, query_auth):

render_edit(edit.id)

vidly_submission = VidlySubmission.objects.get(
event=event,
assert VidlySubmission.objects.filter(event=event).count() == 2
vidly_submission, = (
VidlySubmission.objects
.filter(event=event)
.order_by('-submission_time')[:1]
)
assert vidly_submission.tag != 'abc123' # the original was 'abc123'

edit = PopcornEdit.objects.get(id=edit.id)

Expand Down

0 comments on commit 21a3615

Please sign in to comment.