Skip to content

Commit 7f88923

Browse files
Copilotgantoine
andcommitted
Add video-normalized support for ScreenScraper scan.media config
Co-authored-by: gantoine <[email protected]>
1 parent 28d3ec7 commit 7f88923

File tree

6 files changed

+14
-2
lines changed

6 files changed

+14
-2
lines changed

backend/config/config_manager.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ class MetadataMediaType(enum.StrEnum):
7777
LOGO = "logo"
7878
FANART = "fanart"
7979
VIDEO = "video"
80+
VIDEO_NORMALIZED = "video_normalized"
8081
MANUAL = "manual"
8182

8283

backend/handler/metadata/ss_handler.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ class SSMetadataMedia(TypedDict):
118118
marquee_path: str | None
119119
logo_path: str | None
120120
video_path: str | None
121+
video_normalized_path: str | None
121122

122123

123124
class SSMetadata(SSMetadataMedia):
@@ -166,6 +167,7 @@ def extract_media_from_ss_game(rom: Rom, game: SSGame) -> SSMetadataMedia:
166167
marquee_path=None,
167168
logo_path=None,
168169
video_path=None,
170+
video_normalized_path=None,
169171
)
170172

171173
for region in get_preferred_regions():
@@ -294,6 +296,10 @@ def extract_media_from_ss_game(rom: Rom, game: SSGame) -> SSMetadataMedia:
294296
ss_media["video_normalized_url"] = strip_sensitive_query_params(
295297
media["url"], SENSITIVE_KEYS
296298
)
299+
if MetadataMediaType.VIDEO_NORMALIZED in preferred_media_types:
300+
ss_media["video_normalized_path"] = (
301+
f"{fs_resource_handler.get_media_resources_path(rom.platform_id, rom.id, MetadataMediaType.VIDEO_NORMALIZED)}/video-normalized.mp4"
302+
)
297303

298304
return ss_media
299305

examples/config.example.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
# - manual # Manual (enabled by default)
129129
# # Gameplay video
130130
# - video # Video (warning: large file size)
131+
# - video_normalized # Normalized video (smaller file size than video)
131132
# # Media used for batocera gamelist.xml export
132133
# - box2d_back # Back cover art
133134
# - logo # Transparent logo

frontend/src/__generated__/models/RomSSMetadata.ts

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/src/components/Details/Info/MediaCarousel.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ const youtubeVideoId = computed(
2525
2626
const localVideoPath = computed(() => {
2727
return (
28-
props.rom.ss_metadata?.video_path || props.rom.gamelist_metadata?.video_path
28+
props.rom.ss_metadata?.video_path ||
29+
props.rom.ss_metadata?.video_normalized_path ||
30+
props.rom.gamelist_metadata?.video_path
2931
);
3032
});
3133
const screenshots = computed(() => props.rom.merged_screenshots);

frontend/src/composables/useGameAnimation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ export function useGameAnimation({
196196
if (!romsStore.isSimpleRom(rom)) return null;
197197
// Only play video if boxart style is miximage
198198
if (boxartStyle.value !== "miximage_path") return null;
199-
const ssVideo = rom.ss_metadata?.video_path;
199+
const ssVideo =
200+
rom.ss_metadata?.video_path || rom.ss_metadata?.video_normalized_path;
200201
const gamelistVideo = rom.gamelist_metadata?.video_path;
201202
return ssVideo || gamelistVideo || null;
202203
});

0 commit comments

Comments
 (0)