removed the use of shlex.join for better backwards compatibility

This commit is contained in:
K4YT3X 2020-09-10 16:15:05 -04:00
parent 04562dcaa1
commit 107d31e5dc
7 changed files with 11 additions and 18 deletions

View File

@ -15,7 +15,6 @@ import argparse
import os
import pathlib
import platform
import shlex
import subprocess
import threading
@ -129,6 +128,6 @@ class WrapperMain:
# return the Popen object of the new process created
self.print_lock.acquire()
Avalon.debug_info(f'[upscaler] Subprocess {os.getpid()} executing: {shlex.join(execute)}')
Avalon.debug_info(f'[upscaler] Subprocess {os.getpid()} executing: {" ".join(execute)}')
self.print_lock.release()
return subprocess.Popen(execute)

View File

@ -12,7 +12,6 @@ Description: This class handles all FFmpeg related operations.
# built-in imports
import json
import pathlib
import shlex
import subprocess
# third-party imports
@ -58,7 +57,7 @@ class Ffmpeg:
# turn elements into str
execute = [str(e) for e in execute]
Avalon.debug_info(f'Executing: {shlex.join(execute)}')
Avalon.debug_info(f'Executing: {" ".join(execute)}')
# initialize dictionary to store pixel formats
pixel_formats = {}
@ -66,7 +65,7 @@ class Ffmpeg:
# record all pixel formats into dictionary
for line in subprocess.run(execute, check=True, stdout=subprocess.PIPE).stdout.decode().split('\n'):
try:
pixel_formats[' '.join(line.split()).split()[1]] = int(' '.join(line.split()).split()[3])
pixel_formats[" ".join(line.split()).split()[1]] = int(" ".join(line.split()).split()[3])
except (IndexError, ValueError):
pass
@ -103,7 +102,7 @@ class Ffmpeg:
# turn elements into str
execute = [str(e) for e in execute]
Avalon.debug_info(f'Executing: {shlex.join(execute)}')
Avalon.debug_info(f'Executing: {" ".join(execute)}')
return int(subprocess.run(execute, check=True, stdout=subprocess.PIPE).stdout.decode().strip())
def probe_file_info(self, input_video):
@ -136,7 +135,7 @@ class Ffmpeg:
# turn elements into str
execute = [str(e) for e in execute]
Avalon.debug_info(f'Executing: {shlex.join(execute)}')
Avalon.debug_info(f'Executing: {" ".join(execute)}')
json_str = subprocess.run(execute, check=True, stdout=subprocess.PIPE).stdout
return json.loads(json_str.decode('utf-8'))
@ -316,5 +315,5 @@ class Ffmpeg:
def _execute(self, execute):
# turn all list elements into string to avoid errors
execute = [str(e) for e in execute]
Avalon.debug_info(f'Executing: {shlex.join(execute)}')
Avalon.debug_info(f'Executing: {" ".join(execute)}')
return subprocess.Popen(execute)

View File

@ -15,7 +15,6 @@ import argparse
import os
import pathlib
import platform
import shlex
import subprocess
import threading
@ -104,6 +103,6 @@ class WrapperMain:
# return the Popen object of the new process created
self.print_lock.acquire()
Avalon.debug_info(f'[upscaler] Subprocess {os.getpid()} executing: {shlex.join(execute)}')
Avalon.debug_info(f'[upscaler] Subprocess {os.getpid()} executing: {" ".join(execute)}')
self.print_lock.release()
return subprocess.Popen(execute)

View File

@ -15,7 +15,6 @@ import argparse
import os
import pathlib
import platform
import shlex
import subprocess
import threading
@ -105,6 +104,6 @@ class WrapperMain:
# return the Popen object of the new process created
self.print_lock.acquire()
Avalon.debug_info(f'[upscaler] Subprocess {os.getpid()} executing: {shlex.join(execute)}')
Avalon.debug_info(f'[upscaler] Subprocess {os.getpid()} executing: {" ".join(execute)}')
self.print_lock.release()
return subprocess.Popen(execute)

View File

@ -14,7 +14,6 @@ for waifu2x-caffe.
import argparse
import os
import pathlib
import shlex
import subprocess
import threading
@ -108,6 +107,6 @@ class WrapperMain:
# return the Popen object of the new process created
self.print_lock.acquire()
Avalon.debug_info(f'[upscaler] Subprocess {os.getpid()} executing: {shlex.join(execute)}')
Avalon.debug_info(f'[upscaler] Subprocess {os.getpid()} executing: {" ".join(execute)}')
self.print_lock.release()
return subprocess.Popen(execute)

View File

@ -14,7 +14,6 @@ for waifu2x-converter-cpp.
import argparse
import os
import pathlib
import shlex
import subprocess
import threading
@ -121,6 +120,6 @@ class WrapperMain:
# return the Popen object of the new process created
self.print_lock.acquire()
Avalon.debug_info(f'[upscaler] Subprocess {os.getpid()} executing: {shlex.join(execute)}')
Avalon.debug_info(f'[upscaler] Subprocess {os.getpid()} executing: {" ".join(execute)}')
self.print_lock.release()
return subprocess.Popen(execute)

View File

@ -18,7 +18,6 @@ import argparse
import os
import pathlib
import platform
import shlex
import subprocess
import threading
@ -108,6 +107,6 @@ class WrapperMain:
# return the Popen object of the new process created
self.print_lock.acquire()
Avalon.debug_info(f'[upscaler] Subprocess {os.getpid()} executing: {shlex.join(execute)}')
Avalon.debug_info(f'[upscaler] Subprocess {os.getpid()} executing: {" ".join(execute)}')
self.print_lock.release()
return subprocess.Popen(execute)