Skip to content

Commit

Permalink
fix backend
Browse files Browse the repository at this point in the history
  • Loading branch information
TNTwise committed Aug 31, 2024
1 parent 7ca5f1b commit 710be00
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/DownloadDeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
move,
extractTarGZ,
downloadTempDirectory,
downloadFile
)
from .ui.QTcustom import DownloadProgressPopup, DisplayCommandOutputPopup
import os
Expand Down Expand Up @@ -65,8 +66,8 @@ def downloadBackend(self, tag):
tag is unused for now, as still in active development. just downloads the latest backend.
"""
if not os.path.exists(os.path.join(currentDirectory(), "backend")):
backend_url = "https://github.com/tntwise/REAL-Video-Enhancer/archive/refs/heads/2.0.zip"
main_zip = os.path.join(currentDirectory(), "repo.zip")
backend_url = "https://github.com/TNTwise/real-video-enhancer-models/releases/download/flatpak-backends/backend-V2-stable.tar.gz"
main_zip = os.path.join(currentDirectory(), "backend.tar.gz")
main_folder = os.path.join(currentDirectory(), "repo")
orig_backend_folder = os.path.join(
main_folder, "REAL-Video-Enhancer-2.0", "backend"
Expand All @@ -75,14 +76,15 @@ def downloadBackend(self, tag):

printAndLog("Downloading backend")
#urllib.request.urlretrieve(backend_url, main_zip)
DownloadProgressPopup(link=backend_url, downloadLocation=main_zip,title="Downloading Backend")

downloadFile(link=backend_url, downloadLocation=main_zip)
printAndLog("Extracting backend")
shutil.unpack_archive(main_zip, main_folder)
printAndLog("Moving Backend")
move(orig_backend_folder, moved_backed_folder)
printAndLog("Cleaning up")
os.remove(main_zip)
extractTarGZ(main_zip)
#printAndLog("Extracting backend")
#shutil.unpack_archive(main_zip, main_folder)
#printAndLog("Moving Backend")
#move(orig_backend_folder, moved_backed_folder)
#printAndLog("Cleaning up")


def downloadPython(self):
link = "https://github.com/indygreg/python-build-standalone/releases/download/20240814/cpython-3.11.9+20240814-"
Expand Down
11 changes: 11 additions & 0 deletions src/Util.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ def isFlatpak():
with open(os.path.join(cwd, "frontend_log.txt"), "w") as f:
pass

def downloadFile(link,downloadLocation):
response = requests.get(
link,
stream=True,
)
printAndLog("Downloading: " + link)
with open(downloadLocation, "wb") as f:
chunk_size = 1024
for chunk in response.iter_content(chunk_size=chunk_size):
f.write(chunk)

def downloadTempDirectory() -> str:
tmppath = os.path.join(cwd, "temp")
createDirectory(tmppath)
Expand Down

0 comments on commit 710be00

Please sign in to comment.