From 09ed00eb11da29574d1345f63c61068f250a7bf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Garc=C3=ADa=20Crespo?= Date: Fri, 1 Nov 2024 06:12:58 +0000 Subject: [PATCH] Remove unnecessary fields from CommandLinker --- src/MCPClient/lib/clientScripts/normalize.py | 6 +++--- src/MCPClient/lib/clientScripts/transcoder.py | 18 +++++++----------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/MCPClient/lib/clientScripts/normalize.py b/src/MCPClient/lib/clientScripts/normalize.py index 67d20858ae..b3c9f61358 100755 --- a/src/MCPClient/lib/clientScripts/normalize.py +++ b/src/MCPClient/lib/clientScripts/normalize.py @@ -573,8 +573,8 @@ def main(job: Job, opts: NormalizeArgs, counter: DeferredFPRuleCounter) -> int: if ( exitstatus != 0 and opts.purpose in ("access", "thumbnail") - and cl.commandObject.output_location - and (not os.path.isfile(cl.commandObject.output_location)) + and cl.output_location + and (not os.path.isfile(cl.output_location)) ): # Fall back to default rule try: @@ -614,7 +614,7 @@ def main(job: Job, opts: NormalizeArgs, counter: DeferredFPRuleCounter) -> int: # Store thumbnails locally for use during AIP searches # TODO is this still needed, with the storage service? if "thumbnail" in opts.purpose: - thumbnail_filepath = cl.commandObject.output_location + thumbnail_filepath = cl.output_location thumbnail_storage_dir = os.path.join( mcpclient_settings.SHARED_DIRECTORY, "www", "thumbnails", opts.sip_uuid ) diff --git a/src/MCPClient/lib/clientScripts/transcoder.py b/src/MCPClient/lib/clientScripts/transcoder.py index d4ad2621bc..354f270e27 100755 --- a/src/MCPClient/lib/clientScripts/transcoder.py +++ b/src/MCPClient/lib/clientScripts/transcoder.py @@ -112,26 +112,22 @@ def __init__( self, job, fprule, command, replacement_dict, opts, on_success, counter ): self.fprule = fprule - self.command = command - self.replacement_dict = replacement_dict - self.opts = opts - self.on_success = on_success - self.commandObject = Command( - job, self.command, replacement_dict, self.on_success, opts - ) + self.cmd = Command(job, command, replacement_dict, on_success, opts) self.counter = counter def __str__(self): - return ( - f"[Command Linker] FPRule: {self.fprule.uuid} Command: {self.commandObject}" - ) + return f"[Command Linker] FPRule: {self.fprule.uuid} Command: {self.cmd}" + + @property + def output_location(self): + return self.cmd.output_location def execute(self): """Execute the command, and track the success statistics. Returns 0 on success, non-0 on failure.""" self.counter.record_attempt(self.fprule) - ret = self.commandObject.execute() + ret = self.cmd.execute() if ret: self.counter.record_failure(self.fprule) else: