Skip to content

Commit

Permalink
in thoery, all base functions should work
Browse files Browse the repository at this point in the history
  • Loading branch information
TNTwise committed May 22, 2024
1 parent 5d9f2d6 commit 8d9025d
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 30 deletions.
4 changes: 3 additions & 1 deletion modules/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@ def extractFramesAndAudio(
)

# i need to clean this up lol
#shutil.rmtree(f'rm -rf "{settings.RenderDir}/{videoName}_temp/"')
shutil.rmtree(
os.path.join(settings.RenderDir,f"{videoName}_temp")
)
# Gets the width and height
global height
global width
Expand Down
1 change: 0 additions & 1 deletion src/getLinkVideo/get_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ def gen_youtubedlp_command(self):
"'", ""
) # i need to find where this is called to rename the input file
self.input_file = self.input_file.replace('"', "")
os.system(f"{thisdir}/audio.m4a")
self.main.download_youtube_video_command = f'{thisdir}/bin/yt-dlp_linux -f {self.dict_res_id_fps[self.ui.qualityCombo.currentText()][0]} "{self.ui.plainTextEdit.text()}" -o "{self.input_file}" && {thisdir}/bin/yt-dlp_linux -f 140 "{self.ui.plainTextEdit.text()}" -o {thisdir}/audio.m4a'
self.main.fps = float(
self.dict_res_id_fps[self.ui.qualityCombo.currentText()][1]
Expand Down
48 changes: 29 additions & 19 deletions src/getModels/get_models_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@

def handleCUDAModels(model: str = ""):
if "rife" and "pkl" in model:
os.system(
f'mkdir -p "{thisdir}/models/rife-cuda/{model.replace(".","").replace("pkl","")}" '
os.makedirs(
os.path.join(f"{thisdir}","models","rife-cuda",f"{model.replace('.','').replace('pkl','')}" )
)
os.system(
f'cp "{thisdir}/files/{model}" "{thisdir}/models/rife-cuda/{model.replace(".","").replace("pkl","")}" '
shutil.copy(
os.path.join(f"{thisdir}","files",f"{model}"),
os.path.join(f"{thisdir}","models","rife-cuda",f"{model.replace('.','').replace('pkl','')}")
)


Expand Down Expand Up @@ -61,8 +62,8 @@ def install_modules(self):
rife_install_list = []

settings = Settings()

os.system(f'touch "{thisdir}/models.txt"')
with open(f"{thisdir}/models.txt", "w") as f:
pass
with open(f"{thisdir}/models.txt", "r") as f:
for i in f.readlines():
i = i.replace("\n", "")
Expand Down Expand Up @@ -100,10 +101,14 @@ def install_modules(self):
os.mkdir(f"{settings.ModelDir}/rife/")
except:
pass
os.system(f'chmod +x "{thisdir}/files/rife-ncnn-vulkan"')
os.chmod(
os.path.join(thisdir,"files",i),
0o755
)

os.system(
f'mv -f "{thisdir}/files/rife-ncnn-vulkan" "{settings.ModelDir}/rife/"'
os.rename(
os.path.join(f"{thisdir}","files","rife-ncnn-vulkan"),
os.path.join(f"{thisdir}","models","rife","rife-ncnn-vulkan")
)
if ".zip" in i:
with ZipFile(f"{thisdir}/files/{i}", "r") as zip_ref:
Expand All @@ -122,15 +127,18 @@ def install_modules(self):
original_ai_name = name
original_ai_name_ncnn_vulkan = name

os.system(
f'mv "{thisdir}/files/{name}" "{settings.ModelDir}/{original_ai_name}"'
)
os.system(
f'chmod +x "{settings.ModelDir}/{original_ai_name}/{original_ai_name_ncnn_vulkan}"'
)
os.system(
f'chmod +x "{settings.ModelDir}/{original_ai_name}/upscayl-bin"'
)
try:
os.rename(
os.path.join(thisdir,"files",name),
os.path.join(settings.ModelDir,original_ai_name)
)
os.chmod(
os.path.join(settings.ModelDir,original_ai_name,original_ai_name_ncnn_vulkan),
0o755
)
except:
pass




Expand All @@ -144,7 +152,9 @@ def install_modules(self):
and i in rife.default_models()
and len(os.listdir(f"{settings.ModelDir}/rife/")) > 3
):
os.system(f'rm -rf "{settings.ModelDir}/rife/{i}"')
shutil.rmtree(
os.path.join(f"{settings.ModelDir}","rife",f"{i}")
)
index = self.main.ui.defaultRifeModel.findText(i)

if index != -1:
Expand Down
6 changes: 4 additions & 2 deletions src/getModels/returnModelList.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
thisdir = src.programData.thisdir.thisdir()
import src.programData.checks as checks
import src.programData.return_data as return_data

import shutil

def returnCorrectLinkBasedOnOS(link):
if return_data.returnOperatingSystem() == "Linux":
Expand Down Expand Up @@ -101,7 +101,9 @@ def cudaRifeModels(self, install_modules_dict: dict = {}):
items2.append(item.replace(".pkl", "").replace(".", ""))
for i in os.listdir(f"{thisdir}/models/rife-cuda/"):
if i not in items2:
os.system(f'rm -rf "{thisdir}/models/rife-cuda/{i}"')
shutil.rmtree(
os.path.join(f"{thisdir}","models","rife-cuda",f"{i}")
)

install_modules_dict.update(modelDict)

Expand Down
17 changes: 10 additions & 7 deletions src/getModels/select_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,19 @@
from src.getModels.returnModelList import *

import src.getModels.googleDriveDownload as GDrive

import shutil

def handleCUDAModels(model: str = ""):
if "rife" and "pkl" in model:
os.system(
f'mkdir -p "{thisdir}/models/rife-cuda/{model.replace(".","").replace("pkl","")}" '
os.makedirs(
os.path.join(f"{thisdir}","models","rife-cuda",f"{model.replace('.','').replace('pkl','')}" )
)
os.system(
f'cp "{thisdir}/files/{model}" "{thisdir}/models/rife-cuda/{model.replace(".","").replace("pkl","")}" '
shutil.copy(
os.path.join(f"{thisdir}","files",f"{model}"),
os.path.join(f"{thisdir}","models","rife-cuda",f"{model.replace('.','').replace('pkl','')}")
)


def deleteDownloaded():
for i in os.listdir(f"{thisdir}/files/"):
if os.path.isfile(i):
Expand Down Expand Up @@ -136,8 +138,9 @@ def install_modules(self):
os.path.join(thisdir,"files",i),
0o755
)
os.system(
f'mv "{thisdir}/files/rife-ncnn-vulkan" "{thisdir}/models/rife/"'
os.rename(
os.path.join(f"{thisdir}","files","rife-ncnn-vulkan"),
os.path.join(f"{thisdir}","models","rife","rife-ncnn-vulkan")
)

if ".zip" in i:
Expand Down

0 comments on commit 8d9025d

Please sign in to comment.