From e084766e690617a5d5a6a9ecb0e13da13fe76380 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 9 Nov 2014 14:10:51 +0000 Subject: [PATCH] add mange command to restart encodes after crash or ctl restart --- .../management/commands/continue_encoding.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 pandora/archive/management/commands/continue_encoding.py diff --git a/pandora/archive/management/commands/continue_encoding.py b/pandora/archive/management/commands/continue_encoding.py new file mode 100644 index 00000000..d2f0f75b --- /dev/null +++ b/pandora/archive/management/commands/continue_encoding.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# vi:si:et:sw=4:sts=4:ts=4 +from optparse import make_option + +from django.core.management.base import BaseCommand + +import app.monkey_patch +from ... import models + + +class Command(BaseCommand): + """ + """ + help = 'reinject files into encoding queue' + args = '' + + def handle(self, **options): + for f in models.File.objects.filter(encoding=True): + if f.streams.all().count(): + f.process_stream() + elif f.data: + f.extract_stream()