update get_frame command for new django version, fixes #3155

This commit is contained in:
j 2018-07-29 18:56:01 +01:00
parent fde36c3ae0
commit 13fcb20796

View file

@ -11,13 +11,18 @@ from ... import models
class Command(BaseCommand):
help = 'extract frame and print path'
args = '<id> <height> <position>'
def handle(self, id, height, position, **options):
def add_arguments(self, parser):
parser.add_argument('args', metavar='args', type=str, nargs='*', help='<id> <height> <position>')
def handle(self, id, height, position, **kwargs):
position = float(position)
height = int(height)
with transaction.atomic():
i = models.Item.objects.get(public_id=id)
path = i.frame(position, height)
try:
i = models.Item.objects.get(public_id=id)
path = i.frame(position, height)
except models.Item.DoesNotExist:
path = None
if path:
print(path)