handler can see colocated folders

This commit is contained in:
Georges-Antoine Assi
2025-12-14 13:18:24 -05:00
parent 511fb903a1
commit 9584ba9a37
2 changed files with 96 additions and 36 deletions

View File

@@ -1,3 +1,4 @@
import glob
import os
import uuid
from pathlib import Path
@@ -164,6 +165,37 @@ def extract_media_from_gamelist_rom(
)
gamelist_media["video_url"] = f"file://{str(video_path_path)}"
media_map = {
"image_url": "images",
"box2d_url": "covers",
"box2d_back_url": "backcovers",
"box3d_url": "3dboxes",
"fanart_url": "fanart",
"manual_url": "manuals",
"marquee_url": "marquees",
"miximage_url": "miximages",
"physical_url": "physicalmedia",
"screenshot_url": "screenshots",
"title_screen_url": "titlescreens",
"thumbnail_url": "thumbnails",
"video_url": "videos",
}
path_elem = game.find("path")
if path_elem is not None and path_elem.text:
rom_basename = os.path.basename(path_elem.text)
for media_type, folder_name in media_map.items():
if gamelist_media[media_type]:
continue
search_path = os.path.join(
platform_dir, folder_name, f"{os.path.splitext(rom_basename)[0]}.*"
)
found_files = glob.glob(search_path)
print("found_files", search_path, found_files)
if found_files:
gamelist_media[media_type] = f"file://{str(found_files[0])}"
return gamelist_media
@@ -376,8 +408,10 @@ class GamelistHandler(MetadataHandler):
# Choose which cover style to use
cover_url = rom_metadata["box2d_url"] or rom_metadata["image_url"]
print("URL_COVER", cover_url)
if cover_url:
rom_data["url_cover"] = cover_url
print("URL_COVER", cover_url)
# Grab the manual
manual_url = rom_metadata["manual_url"]
@@ -433,7 +467,7 @@ class GamelistHandler(MetadataHandler):
if gamelist_metadata:
rom_specific_paths = populate_rom_specific_paths(gamelist_metadata, rom)
# trunk-ignore(mypy/call-arg)
gamelist_metadata.update(**rom_specific_paths)
gamelist_metadata.update(**rom_specific_paths) # type: ignore
matched_rom["gamelist_metadata"] = gamelist_metadata
return matched_rom

View File

@@ -2,48 +2,74 @@
# Rename this file to `config.yml`, copy it to a `config` folder, and mount that folder as per the docker-compose.example.yml
# Only uncomment the lines you want to use/modify, or add new ones where needed
exclude:
# Exclude platforms to be scanned
platforms: [] # ['my_excluded_platform_1', 'my_excluded_platform_2']
# exclude:
# # Exclude platforms to be scanned
# platforms:
# - excluded_folder_a
# - excluded_folder_b
# Exclude roms or parts of roms to be scanned
roms:
# Single file games section.
# Will not apply to files that are in sub-folders (multi-disc roms, games with updates, DLC, patches, etc.)
single_file:
# Exclude all files with certain extensions to be scanned
extensions: [] # ['xml', 'txt']
# # Exclude roms or parts of roms to be scanned
# roms:
# # Single file games section.
# # Will not apply to files that are in sub-folders (multi-disc roms, games with updates, DLC, patches, etc.)
# single_file:
# # Exclude all files with certain extensions to be scanned
# extensions:
# - xml
# - txt
# Exclude matched file names to be scanned.
# Supports unix filename pattern matching
# Can also exclude files by extension
names: [] # ['info.txt', '._*', '*.nfo']
# # Exclude matched file names to be scanned
# # Supports unix filename pattern matching
# names:
# - 'info.txt'
# - '._*'
# - '*.nfo'
# Multi files games section
# Will apply to files that are in sub-folders (multi-disc roms, games with updates, DLC, patches, etc.)
multi_file:
# Exclude matched 'folder' names to be scanned (RomM identifies folders as multi file games)
names: [] # ['my_multi_file_game', 'DLC']
# # Multi files games section
# # Will apply to files that are in sub-folders (multi-disc roms, games with updates, DLC, patches, etc.)
# multi_file:
# # Exclude matched 'folder' names to be scanned (RomM identifies folders as multi file games)
# # Common ES-DE media folders are listed below
# names:
# - 3dboxes
# - backcovers
# - covers
# - fanart
# - manuals
# - marquees
# - miximages
# - physicalmedia
# - screenshots
# - titlescreens
# - videos
# - downloaded_media
# - media
# Exclude files within sub-folders.
parts:
# Exclude matched file names to be scanned from multi file roms
# Keep in mind that RomM doesn't scan folders inside multi files games,
# so there is no need to exclude folders from inside of multi files games.
names: [] # ['data.xml', '._*'] # Supports unix filename pattern matching
# # Exclude files within sub-folders.
# parts:
# # Exclude matched file names to be scanned from multi file roms
# # Keep in mind that RomM doesn't scan folders inside multi files games,
# # so there is no need to exclude folders from inside of multi files games.
# names:
# - 'data.xml'
# - '._*' # Supports unix filename pattern matching
# Exclude all files with certain extensions to be scanned from multi file roms
extensions: [] # ['xml', 'txt']
# # Exclude all files with certain extensions to be scanned from multi file roms
# extensions:
# - xml
# - txt
system:
# Asociate different platform names to your current file system platform names
# [your custom platform folder name]: [RomM platform name]
# In this example if you have a 'gc' folder, RomM will treat it like the 'ngc' folder and if you have a 'psx' folder, RomM will treat it like the 'ps' folder
platforms: {} # { gc: 'ngc', psx: 'ps' }
# Asociate one platform to it's main version
versions: {} # { naomi: 'arcade' }
# system:
# # Asociate different platform names to your current file system platform names
# # [your custom platform folder name]: [RomM platform name]
# # In this example if you have a 'gc' folder, RomM will treat it like the 'ngc' folder
# platforms:
# - gc: ngc
# - ps1: psx
# # Asociate one platform to it's main version (IGDB only)
# versions:
# - naomi: arcade
# The folder name where your roms are located
# filesystem: