Ejemplo n.º 1
0
def update_video_index(sender, instance=None, created=False, **kwargs):
    if TEST_SETTINGS or ES_URL is None:
        return
    if instance.is_draft is False and instance.encoding_in_progress is False:
        index_es(instance)
    else:
        delete_es(instance)
Ejemplo n.º 2
0
 def manage_es(self, video_id):
     try:
         video = Video.objects.get(pk=video_id)
         if video.is_draft is False:
             index_es(video)
             self.stdout.write(
                 self.style.SUCCESS('Successfully index Video "%s"' %
                                    video_id))
         else:
             delete_es(video)
     except Video.DoesNotExist:
         self.stdout.write(
             self.style.ERROR('Video "%s" does not exist' % video_id))
Ejemplo n.º 3
0
 def handle(self, *args, **options):
     translation.activate(settings.LANGUAGE_CODE)
     if options['all']:
         delete_index_es()
         create_index_es()
         for video in VIDEOS:
             index_es(video)
     elif options['video_id']:
         for video_id in options['video_id']:
             self.manage_es(video_id)
     else:
         self.stdout.write(
             self.style.ERROR(
                 "****** Warning: you must give some arguments: %s ******" %
                 self.args))
     translation.deactivate()
Ejemplo n.º 4
0
 def handle(self, *args, **options):
     translation.activate(settings.LANGUAGE_CODE)
     if options["all"]:
         delete_index_es()
         time.sleep(10)
         create_index_es()
         time.sleep(10)
         iteration = 0
         for video in VIDEOS:
             if iteration % 1000 == 0:
                 time.sleep(10)
             iteration += 1
             index_es(video)
     elif options["video_id"]:
         for video_id in options["video_id"]:
             self.manage_es(video_id)
     else:
         self.stdout.write(
             self.style.ERROR(
                 "****** Warning: you must give some arguments: %s ******" %
                 self.args))
     translation.deactivate()
Ejemplo n.º 5
0
def update_video_index(sender, instance=None, created=False, **kwargs):
    if instance.is_draft is False and instance.encoding_in_progress is False:
        index_es(instance)
    else:
        delete_es(instance)
Ejemplo n.º 6
0
def index_video(video):
    if video.is_draft is False and video.encoding_in_progress is False:
        index_es(video)
    else:
        delete_es(video)