forked from 0x2620/pandora
update get_frame command for new django version, fixes #3155
This commit is contained in:
parent
fde36c3ae0
commit
13fcb20796
1 changed files with 9 additions and 4 deletions
|
@ -11,13 +11,18 @@ from ... import models
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = 'extract frame and print path'
|
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)
|
position = float(position)
|
||||||
height = int(height)
|
height = int(height)
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
|
try:
|
||||||
i = models.Item.objects.get(public_id=id)
|
i = models.Item.objects.get(public_id=id)
|
||||||
path = i.frame(position, height)
|
path = i.frame(position, height)
|
||||||
|
except models.Item.DoesNotExist:
|
||||||
|
path = None
|
||||||
if path:
|
if path:
|
||||||
print(path)
|
print(path)
|
||||||
|
|
Loading…
Reference in a new issue