示例#1
0
    def test_bulk_move_tedx(self):
        """Move videos with primary audio set and 0 subtitles.

        """
        team2 = TeamFactory(admin=self.admin,
                            name="TEDx Import",
                            slug="tedxtalks-import")
        audio_codes = ['en', 'fr', 'de', 'hu', 'en']
        for lc in audio_codes:
            v = VideoFactory(primary_audio_language_code=lc)
            tv = TeamVideoFactory(team=team2, video=v)
            metadata_manager.update_metadata(tv.video.pk)
        management.call_command('update_index', interactive=False)
        management.call_command('index_team_videos', team2.slug)
        self.videos_tab.log_in(self.admin.username, 'password')
        self.videos_tab.open_videos_tab(team2.slug)
        self.videos_tab.open_bulk_move()
        self.videos_tab.primary_audio_filter(setting='set')
        self.videos_tab.sub_lang_filter("any", has=False)
        self.videos_tab.update_filters()

        vid = self.videos_tab.first_video_listed()
        self.logger.info(vid)
        self.videos_tab.bulk_select()
        self.videos_tab.bulk_team(self.team.name)
        self.videos_tab.submit_bulk_move()

        management.call_command('update_index', interactive=False)
        self.videos_tab.open_videos_tab(self.team.slug)
        self.assertTrue(self.videos_tab.video_present(vid))
示例#2
0
 def handle(self, *args, **kwargs):
     print 'Run update_metadata command'
     targets = Video.objects.all()
     percent_printed = 0
     num = targets.count()
     count = 0
     print "%s videos to go " % num
     must_return = False
     for x in targets.iterator():
         try:
             update_metadata(x.pk)
             percent =  (((count * 1.0) / num) * 100)
             count +=1          
             if int(percent) > percent_printed:
                 percent_printed = int(percent)
                 print "Done %2s %%" % (percent_printed)
         except (KeyboardInterrupt, SystemExit):
             must_return = True
         except:
             print "failed for pk %s"  % x.pk
             logger.exception("metadata import")
         if must_return:
             print "stopped at %s" % count
             return
         sleep(0.2)
示例#3
0
def video_changed_tasks(video_pk, new_version_id=None):
    from videos import metadata_manager
    from videos.models import Video
    from teams.models import TeamVideo, BillingRecord

    metadata_manager.update_metadata(video_pk)
    if new_version_id is not None:
        send_new_version_notification(new_version_id)
        try:
            BillingRecord.objects.insert_record(
                SubtitleVersion.objects.get(pk=new_version_id))
        except Exception, e:
            logger.error("Could not add billing record", extra={
                "version_pk": new_version_id,
                "exception": str(e)})
示例#4
0
def video_changed_tasks(video_pk, new_version_id=None, skip_third_party_sync=False):
    from videos import metadata_manager
    from videos.models import Video

    from teams.models import TeamVideo, BillingRecord
    metadata_manager.update_metadata(video_pk)
    if new_version_id is not None:
        send_new_version_notification(new_version_id)
        if not skip_third_party_sync:
            _update_captions_in_original_service(new_version_id)
        try:
            BillingRecord.objects.insert_record(
                SubtitleVersion.objects.get(pk=new_version_id))
        except Exception, e:
            celery_logger.error("Could not add billing record", extra={
                "version_pk": new_version_id,
                "exception": str(e)})
示例#5
0
def video_changed_tasks(video_pk, new_version_id=None):
    from videos import metadata_manager
    from videos.models import Video
    from teams.models import TeamVideo

    metadata_manager.update_metadata(video_pk)
    if new_version_id is not None:
        _send_notification(new_version_id)
        _check_alarm(new_version_id)
        _detect_language(new_version_id)

    video = Video.objects.get(pk=video_pk)
    if video.teamvideo_set.count() > 0:
        tv_search_index = site.get_index(TeamVideo)
        tv_search_index.backend.update(tv_search_index,
                                       list(video.teamvideo_set.all()))

    video.update_search_index()
示例#6
0
def video_changed_tasks(video_pk, new_version_id=None):
    from videos import metadata_manager
    from videos.models import Video
    from teams.models import TeamVideo
    
    metadata_manager.update_metadata(video_pk)
    if new_version_id is not None:
        _send_notification(new_version_id)
        _check_alarm(new_version_id)
        _detect_language(new_version_id)

    video = Video.objects.get(pk=video_pk)
    if video.teamvideo_set.count() > 0:
        tv_search_index = site.get_index(TeamVideo)
        tv_search_index.backend.update(
            tv_search_index,
            list(video.teamvideo_set.all()))
    
    video.update_search_index()