completely rewrite CLI & finish plugin support
This commit is contained in:
14
bin/engines/ss/config.json
Normal file
14
bin/engines/ss/config.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"abbr":"SS",
|
||||
"displayName":"Real-ESGRAN",
|
||||
"lastUsedFilePath":"sc",
|
||||
"fileNameBeginning":"ig",
|
||||
"cliModeOptions": {
|
||||
"av3":{ "displayName": "realesr-animevideov3", "default": true },
|
||||
"x4plus":{ "displayName": "realesrgan-x4plus-anime", "default": false }
|
||||
},
|
||||
"pluginCreator": "Janis Hutz",
|
||||
"pluginCreatorLink": "https://janishutz.com",
|
||||
"engineLink": "",
|
||||
"supports": [ "upscaling" ]
|
||||
}
|
||||
38
bin/engines/ss/ss.py
Normal file
38
bin/engines/ss/ss.py
Normal file
@@ -0,0 +1,38 @@
|
||||
import os
|
||||
import subprocess
|
||||
import multiprocessing
|
||||
import time
|
||||
import sys
|
||||
|
||||
class Scaler:
|
||||
def __init__(self):
|
||||
self.os_type = sys.platform
|
||||
self.command = ""
|
||||
self.tmppath = ""
|
||||
self.videometa = {}
|
||||
|
||||
def singleScaler ( self, input_path, output_path, scalefactor, threads, mode ):
|
||||
if self.os_type == 'linux':
|
||||
self.command = f'wine ./bin/lib/FidelityFX_CLI.exe -Scale {scalefactor} {scalefactor} {input_path} {output_path} -n { mode }'
|
||||
elif self.os_type == 'win32':
|
||||
self.command = f'realesrgan-ncnn-vulkan -i {input_path} -o {output_path} -s {scalefactor} -j {threads}:{threads}:{threads} -n { mode }'
|
||||
else:
|
||||
print( 'OS CURRENTLY UNSUPPORTED!' )
|
||||
return False
|
||||
|
||||
os.system( self.command )
|
||||
print( '\n\n==>Photo upscaled' );
|
||||
|
||||
def videoScaler ( self, tmppath, threads, scalefactor, sharpening, filetype, mode ):
|
||||
print( '\n\n==> Preparing to upscale videos <==\n\n==> You will see a lot of numbers flying by showing the progress of the upscaling of each individual image.\n==> This process might take a long time, depending on the length of the video.\n\n')
|
||||
time.sleep( 2 );
|
||||
|
||||
try:
|
||||
os.mkdir( f'{tmppath}sc' )
|
||||
except FileExistsError:
|
||||
pass
|
||||
if ( self.os_type == 'win32' ):
|
||||
self.command = f'realesrgan-ncnn-vulkan -i {tmppath} -o {tmppath}sc -s {scalefactor} -j {threads}:{threads}:{threads} -n {mode}'
|
||||
elif ( self.os_type == 'linux' ):
|
||||
self.command = f'wine ./bin/lib/realesrgan-ncnn-vulkan.exe -i {tmppath} -o {tmppath}sc -s {scalefactor} -j {threads}:{threads}:{threads} -n {mode}'
|
||||
os.system( self.command );
|
||||
Reference in New Issue
Block a user