added file argument to video resizer and added ascii resizer
This commit is contained in:
parent
35d6a95008
commit
698c7a8bc6
@ -189,6 +189,52 @@ class InitialProcessor(CommonAsciiProcessor):
|
|||||||
self.delete_queue_file()
|
self.delete_queue_file()
|
||||||
|
|
||||||
|
|
||||||
|
class Resizer(CommonAsciiProcessor):
|
||||||
|
"""
|
||||||
|
Resizing process steps for processed media
|
||||||
|
"""
|
||||||
|
name = 'resize'
|
||||||
|
description = 'Resize thumbnail'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def media_is_eligible(cls, entry=None, state=None):
|
||||||
|
"""
|
||||||
|
Determine if this media type is eligible for processing
|
||||||
|
"""
|
||||||
|
if not state:
|
||||||
|
state = entry.state
|
||||||
|
return state in 'processed'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def generate_parser(cls):
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
description=cls.description,
|
||||||
|
prog=cls.name)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'--thumb_size',
|
||||||
|
nargs=2,
|
||||||
|
metavar=('max_width', 'max_height'),
|
||||||
|
type=int)
|
||||||
|
|
||||||
|
# Needed for gmg reprocess thumbs to work
|
||||||
|
parser.add_argument(
|
||||||
|
'file',
|
||||||
|
nargs='?',
|
||||||
|
default='thumb')
|
||||||
|
|
||||||
|
return parser
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def args_to_request(cls, args):
|
||||||
|
return request_from_args(
|
||||||
|
args, ['size', 'file'])
|
||||||
|
|
||||||
|
def process(self, thumb_size=None, file=None):
|
||||||
|
self.common_setup()
|
||||||
|
self.generate_thumb(thumb_size=thumb_size)
|
||||||
|
|
||||||
|
|
||||||
class AsciiProcessingManager(ProcessingManager):
|
class AsciiProcessingManager(ProcessingManager):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(self.__class__, self).__init__()
|
super(self.__class__, self).__init__()
|
||||||
|
@ -309,14 +309,20 @@ class Resizer(CommonVideoProcessor):
|
|||||||
metavar=('max_width', 'max_height'),
|
metavar=('max_width', 'max_height'),
|
||||||
type=int)
|
type=int)
|
||||||
|
|
||||||
|
# Needed for gmg reprocess thumbs to work
|
||||||
|
parser.add_argument(
|
||||||
|
'file',
|
||||||
|
nargs='?',
|
||||||
|
default='thumb')
|
||||||
|
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def args_to_request(cls, args):
|
def args_to_request(cls, args):
|
||||||
return request_from_args(
|
return request_from_args(
|
||||||
args, ['thumb_size'])
|
args, ['thumb_size', 'file'])
|
||||||
|
|
||||||
def process(self, thumb_size=None):
|
def process(self, thumb_size=None, file=None):
|
||||||
self.common_setup()
|
self.common_setup()
|
||||||
self.generate_thumb(thumb_size=thumb_size)
|
self.generate_thumb(thumb_size=thumb_size)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user