Skip to content

Commit

Permalink
continue not break
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Houseknecht committed Oct 25, 2017
1 parent f5416e9 commit c46434c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions galaxy/main/celerytasks/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,39 +493,39 @@ def update_role_videos(import_task, role, videos=None):
if not isinstance(video, dict) or set(video.keys()) < {'url', 'title'}:
add_message(import_task, u"ERROR", u"Expecting each item in video_links to be a dictionary with "
u"'url' and 'title' keys")
break
continue

google_match = google_re.match(video['url'])
vimeo_match = vimeo_re.match(video['url'])
youtube_match = youtube_re.match(video['url'])
if not google_match and not vimeo_match and not youtube_match:
add_message(import_task, u"ERROR", u"Format of URL %s not recognized. Expected it be a shared link "
u"from Vimeo, YouTube, or Google Drive." % video['url'])
break
continue
if google_match:
try:
file_id = google_match.group(1)
video['embed_url'] = "https://drive.google.com/file/d/%s/preview" % file_id
except IndexError:
add_message(import_task, u"ERROR", u"Failed to get file_id from video_link URL %s. Is the URL "
u"a shared link from Google Drive?" % video['url'])
break
continue
elif vimeo_match:
try:
file_id = vimeo_match.group(1)
video['embed_url'] = "https://player.vimeo.com/video/" + file_id
except IndexError:
add_message(import_task, u"ERROR", u"Failed to get file_id from video_link URL %s. Is the URL "
u"a shared link from Vimeo?" % video['url'])
break
continue
elif youtube_match:
try:
file_id = youtube_match.group(1)
video['embed_url'] = "https://www.youtube.com/embed/" + file_id
except IndexError:
add_message(import_task, u"ERROR", u"Failed to get file_id from video_link URL %s. Is the URL "
u"a shared link from YouTube?" % video['url'])
break
continue

role.videos.update_or_create(url=video['embed_url'], defaults={'description': video['title']})

Expand Down

0 comments on commit c46434c

Please sign in to comment.