[videogames] Save lrtl files in zip file on import
All checks were successful
build & deploy / test (push) Successful in 2m0s
build & deploy / build-and-deploy (push) Successful in 31s

This commit is contained in:
2026-05-22 12:09:15 -04:00
parent d3146433f2
commit 4e059683b0
2 changed files with 67 additions and 42 deletions

View File

@ -419,14 +419,16 @@ class RetroarchImport(BaseFileImportMixin):
if self.lrtl_file:
import tempfile
import os
import zipfile
tmpdir = tempfile.mkdtemp()
try:
src_path = self.lrtl_file.path
basename = self.original_filename or os.path.basename(src_path)
dst = os.path.join(tmpdir, basename)
with open(dst, "wb") as f:
zip_path = os.path.join(tmpdir, "archive.zip")
with open(zip_path, "wb") as f:
f.write(self.lrtl_file.read())
with zipfile.ZipFile(zip_path, "r") as zf:
zf.extractall(tmpdir)
os.unlink(zip_path)
scrobbles = retroarch.import_retroarch_lrtl_files(
tmpdir + "/",
self.user.id,