make media_id an optional argument
This commit is contained in:
parent
11a99d787f
commit
842ba30529
@ -32,12 +32,13 @@ def reprocess_parser_setup(subparser):
|
|||||||
'--type', '-t',
|
'--type', '-t',
|
||||||
help="The type of media to be reprocessed such as 'video' or 'image'")
|
help="The type of media to be reprocessed such as 'video' or 'image'")
|
||||||
subparser.add_argument(
|
subparser.add_argument(
|
||||||
'media_id',
|
'--media_id',
|
||||||
nargs='*',
|
nargs='*',
|
||||||
help="The media_entry id(s) you wish to reprocess.")
|
help="The media_entry id(s) you wish to reprocess.")
|
||||||
|
|
||||||
|
|
||||||
def _set_media_type(args):
|
def _set_media_type(args):
|
||||||
|
if args[0].media_id:
|
||||||
if len(args[0].media_id) == 1:
|
if len(args[0].media_id) == 1:
|
||||||
media_type = MediaEntry.query.filter_by(id=args[0].media_id[0])\
|
media_type = MediaEntry.query.filter_by(id=args[0].media_id[0])\
|
||||||
.first().media_type.split('.')[-1]
|
.first().media_type.split('.')[-1]
|
||||||
@ -99,6 +100,7 @@ def _run_reprocessing(args):
|
|||||||
|
|
||||||
|
|
||||||
def _set_media_state(args):
|
def _set_media_state(args):
|
||||||
|
if args[0].media_id:
|
||||||
if len(args[0].media_id) == 1:
|
if len(args[0].media_id) == 1:
|
||||||
args[0].state = MediaEntry.query.filter_by(id=args[0].media_id[0])\
|
args[0].state = MediaEntry.query.filter_by(id=args[0].media_id[0])\
|
||||||
.first().state
|
.first().state
|
||||||
@ -116,7 +118,7 @@ def _set_media_state(args):
|
|||||||
|
|
||||||
args[0].state = media_states[0]
|
args[0].state = media_states[0]
|
||||||
|
|
||||||
elif not args[0].state:
|
if not args[0].state:
|
||||||
args[0].state = 'processed'
|
args[0].state = 'processed'
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user