Beispiel #1
0
def update_one_team_video(team_video_id):
    from teams.models import TeamVideo, TeamVideoLanguage
    try:
        team_video = TeamVideo.objects.get(id=team_video_id)
    except TeamVideo.DoesNotExist:
        return

    team_video.update_team_video_language_pairs()
    TeamVideoLanguage.update(team_video)
Beispiel #2
0
 def _clear_langs(self, requested_langs):
     available_languages = self._get_all_available_languages()
     for l in requested_langs:
         if l in available_languages:
             print 'Update language %s ...' % l
             for tv in TeamVideo.objects.all():
                 TeamVideoLanguage.update_for_language(tv, l)
         else:
             print 'Language %s does not exist in settings' % l
Beispiel #3
0
def update_one_team_video(team_video_id):
    from teams.models import TeamVideo, TeamVideoLanguage
    try:
        team_video = TeamVideo.objects.get(id=team_video_id)
    except TeamVideo.DoesNotExist:
        return
    
    team_video.update_team_video_language_pairs()
    TeamVideoLanguage.update(team_video)
 def _clear_langs(self, requested_langs):
     available_languages = self._get_all_available_languages()
     for l in requested_langs:
         if l in available_languages:
             print "Update language %s ..." % l
             for tv in TeamVideo.objects.all():
                 TeamVideoLanguage.update_for_language(tv, l)
         else:
             print "Language %s does not exist in settings" % l
    def handle(self, *langs, **kwargs):
        available_languages = [item[0] for item in settings.ALL_LANGUAGES]

        for l in langs:
            if l in available_languages:
                print 'Update language %s ...' % l
                for tv in TeamVideo.objects.all():
                    TeamVideoLanguage.update(tv, l)

            else:
                print 'Language %s does not exist in settings' % l
 def handle(self, *langs, **kwargs):
     available_languages = [item[0] for item in settings.ALL_LANGUAGES]
     
     for l in langs:
         if l in available_languages:
             print 'Update language %s ...' % l  
             for tv in TeamVideo.objects.all():
                 TeamVideoLanguage.update(tv, l)
                 
         else:
             print 'Language %s does not exist in settings' % l
Beispiel #7
0
 def test_team_video_delete(self):
     #this test can fail only on MySQL
     team = Team.objects.get(pk=1)
     tv = team.teamvideo_set.exclude(video__subtitlelanguage__language='')[:1].get()
     TeamVideoLanguage.update(tv)
     self.assertNotEqual(tv.languages.count(), 0)
     tv.delete()
     try:
         TeamVideo.objects.get(pk=tv.pk)
         self.fail()
     except TeamVideo.DoesNotExist:
         pass
Beispiel #8
0
def update_team_video_for_sl(sl_id):
    from videos.models import SubtitleLanguage
    from teams.models import TeamVideoLanguage

    try:
        sl = SubtitleLanguage.objects.get(id=sl_id)
    except SubtitleLanguage.DoesNotExist:
        #if language does not exist - ignore updating
        return

    for tv in sl.video.teamvideo_set.all():
        tv.update_team_video_language_pairs_for_sl(sl)
        TeamVideoLanguage.update_for_language(tv, sl.language)
Beispiel #9
0
def update_team_video_for_sl(sl_id):
    from videos.models import SubtitleLanguage
    from teams.models import TeamVideoLanguage
    
    try:
        sl = SubtitleLanguage.objects.get(id=sl_id)
    except SubtitleLanguage.DoesNotExist:
        #if language does not exist - ignore updating
        return
        
    for tv in sl.video.teamvideo_set.all():
        tv.update_team_video_language_pairs_for_sl(sl)
        TeamVideoLanguage.update_for_language(tv, sl.language)
 def handle(self, *slugs, **kwargs):
     if kwargs['all_teams']:
         targets = Team.objects.all()
     else:
         targets = Team.objects.filter(slug__in=slugs)
     count = 0
     
     percent_printed = 0
     num = targets.count()
     print "%s teams to go " % num
     for team in targets.iterator():
         print "Updating team %s" % team.slug
         for tv in team.teamvideo_set.all():
             tv.update_team_video_language_pairs()
             TeamVideoLanguage.update(tv)
         percent = "%.2f %%" % (((count * 1.0) / num) * 100)
         if percent > percent_printed:
             percent_printed = percent
             print "Done %s%%" % (percent)
    def handle(self, *slugs, **kwargs):
        if kwargs['all_teams']:
            targets = Team.objects.all()
        else:
            targets = Team.objects.filter(slug__in=slugs)
        count = 0

        percent_printed = 0
        num = targets.count()
        print "%s teams to go " % num
        for team in targets.iterator():
            print "Updating team %s" % team.slug
            for tv in team.teamvideo_set.all():
                tv.update_team_video_language_pairs()
                TeamVideoLanguage.update(tv)
            percent = "%.2f %%" % (((count * 1.0) / num) * 100)
            if percent > percent_printed:
                percent_printed = percent
                print "Done %s%%" % (percent)
Beispiel #12
0
def _recalculate_team_detail_metadata(video):
    team_videos = TeamVideo.objects.filter(video=video)
    for team_video in team_videos:
        team_video.update_team_video_language_pairs()
        TeamVideoLanguage.update(team_video)
Beispiel #13
0
def _recalculate_team_detail_metadata(video):
    team_videos = TeamVideo.objects.filter(video=video)
    for team_video in team_videos:
        team_video.update_team_video_language_pairs()
        TeamVideoLanguage.update(team_video)