mirror of
https://github.com/RetroGameSets/RGSX.git
synced 2026-03-19 16:26:00 +01:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af42c31476 | ||
|
|
eeea4763f5 | ||
|
|
201d56fff4 | ||
|
|
486c9d0244 | ||
|
|
aed7da8b51 | ||
|
|
93fc4a023d | ||
|
|
b4398b1d82 | ||
|
|
751800026c |
@@ -13,7 +13,7 @@ except Exception:
|
||||
pygame = None # type: ignore
|
||||
|
||||
# Version actuelle de l'application
|
||||
app_version = "2.3.1.1"
|
||||
app_version = "2.3.1.4"
|
||||
|
||||
|
||||
def get_application_root():
|
||||
@@ -98,7 +98,7 @@ GITHUB_RELEASES_URL = f"https://github.com/{GITHUB_REPO}/releases"
|
||||
# URLs pour les mises à jour OTA (Over-The-Air)
|
||||
# Utilise le fichier RGSX_latest.zip qui pointe toujours vers la dernière version
|
||||
OTA_UPDATE_ZIP = f"{GITHUB_RELEASES_URL}/latest/download/RGSX_update_latest.zip"
|
||||
OTA_VERSION_ENDPOINT = "https://github.com/RetroGameSets/RGSX/blob/main/version.json" # Endpoint pour vérifier la version disponible
|
||||
OTA_VERSION_ENDPOINT = "https://raw.githubusercontent.com/RetroGameSets/RGSX/refs/heads/main/version.json" # Endpoint pour vérifier la version disponible
|
||||
|
||||
# URLs legacy (conservées pour compatibilité)
|
||||
OTA_SERVER_URL = "https://retrogamesets.fr/softs/"
|
||||
|
||||
@@ -455,10 +455,15 @@ async def check_for_updates():
|
||||
|
||||
response = requests.get(OTA_VERSION_ENDPOINT, timeout=5)
|
||||
response.raise_for_status()
|
||||
if response.headers.get("content-type") != "application/json":
|
||||
|
||||
# Accepter différents content-types (application/json, text/plain, text/html)
|
||||
content_type = response.headers.get("content-type", "")
|
||||
allowed_types = ["application/json", "text/plain", "text/html"]
|
||||
if not any(allowed in content_type for allowed in allowed_types):
|
||||
raise ValueError(
|
||||
f"Le fichier version.json n'est pas un JSON valide (type de contenu : {response.headers.get('content-type')})"
|
||||
f"Le fichier version.json n'est pas un JSON valide (type de contenu : {content_type})"
|
||||
)
|
||||
|
||||
version_data = response.json()
|
||||
latest_version = version_data.get("version")
|
||||
logger.debug(f"Version distante : {latest_version}, version locale : {config.app_version}")
|
||||
|
||||
@@ -1105,6 +1105,16 @@ def _handle_special_platforms(dest_dir, archive_path, before_dirs, iso_before=No
|
||||
if not success:
|
||||
return False, error_msg
|
||||
|
||||
# ScummVM: organisation en dossiers + fichier .scummvm
|
||||
scummvm_dir = os.path.join(config.ROMS_FOLDER, "scummvm")
|
||||
if dest_dir == scummvm_dir:
|
||||
expected_base = os.path.splitext(os.path.basename(archive_path))[0]
|
||||
# Utiliser before_items si fourni, sinon before_dirs pour rétro-compatibilité
|
||||
items_before = before_items if before_items is not None else before_dirs
|
||||
success, error_msg = handle_scummvm(dest_dir, items_before, extracted_basename=expected_base)
|
||||
if not success:
|
||||
return False, error_msg
|
||||
|
||||
return True, None
|
||||
|
||||
def extract_zip(zip_path, dest_dir, url):
|
||||
@@ -1688,6 +1698,88 @@ def handle_dos(dest_dir, before_items, extracted_basename=None):
|
||||
return False, error_msg
|
||||
|
||||
|
||||
def handle_scummvm(dest_dir, before_items, extracted_basename=None):
|
||||
"""Gère l'organisation spécifique des jeux ScummVM extraits.
|
||||
|
||||
- Crée un sous-dossier avec le nom du jeu (sans extension)
|
||||
- Extrait/déplace le contenu du ZIP dans ce dossier
|
||||
- Crée un fichier .scummvm vide avec le même nom
|
||||
|
||||
Exemple: Freddi_fish_1.zip -> dossier Freddi_fish_1/ + fichier Freddi_fish_1.scummvm
|
||||
|
||||
Args:
|
||||
dest_dir: Dossier de destination (scummvm)
|
||||
before_items: Set des éléments présents avant extraction
|
||||
extracted_basename: Nom de base du ZIP extrait (sans extension)
|
||||
"""
|
||||
logger.debug(f"Traitement spécifique ScummVM dans: {dest_dir}")
|
||||
time.sleep(2) # Petite latence post-extraction
|
||||
|
||||
try:
|
||||
# Déterminer les nouveaux éléments extraits
|
||||
after_items = set(os.listdir(dest_dir))
|
||||
except Exception:
|
||||
after_items = set()
|
||||
|
||||
ignore_names = {"scummvm", "images", "videos", "manuals", "media"}
|
||||
# Filtrer les nouveaux éléments (fichiers ou dossiers)
|
||||
new_items = [item for item in (after_items - before_items)
|
||||
if item not in ignore_names and not item.endswith('.scummvm')]
|
||||
|
||||
if not new_items:
|
||||
logger.warning("Aucun nouveau contenu ScummVM détecté après extraction")
|
||||
return True, None
|
||||
|
||||
if not extracted_basename:
|
||||
logger.warning("Nom de base du ZIP non fourni pour le traitement ScummVM")
|
||||
return True, None
|
||||
|
||||
# Nom du dossier et du fichier .scummvm
|
||||
game_folder_name = extracted_basename
|
||||
game_folder_path = os.path.join(dest_dir, game_folder_name)
|
||||
scummvm_file_path = os.path.join(game_folder_path, f"{game_folder_name}.scummvm")
|
||||
|
||||
try:
|
||||
# Créer le dossier du jeu s'il n'existe pas
|
||||
if os.path.exists(game_folder_path):
|
||||
logger.warning(f"Le dossier {game_folder_path} existe déjà, il sera utilisé")
|
||||
else:
|
||||
os.makedirs(game_folder_path, exist_ok=True)
|
||||
logger.debug(f"Dossier créé: {game_folder_path}")
|
||||
|
||||
# Déplacer tous les nouveaux éléments dans le dossier du jeu
|
||||
for item in new_items:
|
||||
src_path = os.path.join(dest_dir, item)
|
||||
dst_path = os.path.join(game_folder_path, item)
|
||||
|
||||
try:
|
||||
if os.path.isdir(src_path):
|
||||
shutil.move(src_path, dst_path)
|
||||
else:
|
||||
shutil.move(src_path, dst_path)
|
||||
logger.debug(f"Déplacé: {item} -> {game_folder_name}/{item}")
|
||||
except Exception as e:
|
||||
logger.error(f"Erreur déplacement {item}: {e}")
|
||||
return False, f"Erreur lors du déplacement de {item}: {str(e)}"
|
||||
|
||||
# Créer le fichier .scummvm vide dans le sous-dossier
|
||||
try:
|
||||
with open(scummvm_file_path, 'w', encoding='utf-8') as f:
|
||||
pass # Fichier vide
|
||||
logger.info(f"Fichier .scummvm créé: {scummvm_file_path}")
|
||||
except Exception as e:
|
||||
logger.error(f"Erreur création fichier .scummvm: {e}")
|
||||
return False, f"Erreur lors de la création du fichier .scummvm: {str(e)}"
|
||||
|
||||
logger.info(f"Contenu ScummVM organisé avec succès: dossier {game_folder_name}/ avec fichier {game_folder_name}.scummvm à l'intérieur")
|
||||
return True, None
|
||||
|
||||
except Exception as e:
|
||||
error_msg = f"Erreur lors de l'organisation ScummVM dans {game_folder_path}: {str(e)}"
|
||||
logger.error(error_msg)
|
||||
return False, error_msg
|
||||
|
||||
|
||||
def handle_xbox(dest_dir, iso_files, url=None):
|
||||
"""Gère la conversion des fichiers Xbox extraits et met à jour l'UI (Converting)."""
|
||||
logger.debug(f"Traitement spécifique Xbox dans: {dest_dir}")
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"version": "2.3.1.1"
|
||||
"version": "2.3.1.4"
|
||||
}
|
||||
Reference in New Issue
Block a user