Add SRF / SRG SSR adapter (Swiss public broadcasting) - #7
Open
achterbahn wants to merge 1 commit into
Open
Conversation
Adds support for Swiss public broadcasting (SRF) video links — both share URL formats, plain URNs, and plain UUIDs — as well as the SRG SSR sister channels RTS, RTR, RSI and SWI. Changes ------- * core/model/adapters/srf.class.php (NEW) - SrfVideo extends VideoboxAdapter - resolves all input forms to a canonical urn:srf:video:UUID - getPlayerLink() → https://www.srf.ch/play/embed?urn=… - getThumb() fetches the image from the SRG SSR Integration Layer API - sister-channel detection by domain (rts.ch, rtr.ch, rsi.ch, swissinfo.ch) - static SrfVideo::matches() for the processor snippet * elements/snippets/snippet.srf.php (NEW) - thin processor wrapper, registered as "SRF" in the adapter pipeline * _build/data/transport.snippets.adapters.php - registers SRF as the first adapter (checked before YouTube/Vimeo) * _build/data/properties/properties.videobox.php - default processors list now: "SRF, Twitch, YouTube, Vimeo, SoundCloud, HTML5" - default player dimensions updated to 960×540 (16:9) * model/videobox/videobox.class.php - removed hardcoded $_GET['dev'] debug paths in loadAssets() - added null-check for overrides.min.css before file_get_contents * _build/build.transport.php - pre-defines URL constants required for CLI execution - removed FILE_RESOLVE_OPTIONS constant (not available in MODX 2.8.x) - package version set to 6.1.0-pl * CHANGELOG.md / README.md updated Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for SRF Play (Swiss Radio and Television) video links, along with the other SRG SSR channels (RTS, RTR, RSI, SWI), following the existing adapter architecture.
New files
core/components/videobox/model/adapters/srf.class.php—SrfVideoadapter classcore/components/videobox/elements/snippets/snippet.srf.php— processor snippet registered asSRFModified files
_build/data/transport.snippets.adapters.php— registersSRFas the first adapter in the pipeline_build/data/properties/properties.videobox.php— addsSRFto the defaultprocessorslist; updates default player dimensions to 960×540 (16:9)core/components/videobox/model/videobox/videobox.class.php— removes hardcoded$_GET['dev']debug server paths fromloadAssets(); adds null-check before readingoverrides.min.css_build/build.transport.php— pre-defines URL constants needed for CLI execution; removesFILE_RESOLVE_OPTIONS(not available in MODX 2.8.x); version bumped to6.1.0-plCHANGELOG.md/README.md— updatedSRF adapter details
The
SrfVideoadapter handles all four input forms:https://www.srf.ch/play/tv/-/video/-?urn=urn:srf:video:UUIDhttps://www.srf.ch/play/embed?urn=urn:srf:video:UUIDhttps://www.srf.ch/play/tv/redirect/detail/UUIDhttps://www.srf.ch/play/embed?urn=urn:srf:video:UUIDurn:srf:video:UUIDhttps://www.srf.ch/play/embed?urn=urn:srf:video:UUIDUUID(plain)https://www.srf.ch/play/embed?urn=urn:srf:video:UUIDSister-channel detection is automatic by domain — the same URL patterns on
rts.ch,rtr.ch,rsi.ch, andswissinfo.chare handled with their respective channel URNs and embed endpoints.Thumbnails are fetched from the SRG SSR Integration Layer API (
il.srgssr.ch), with a fallback to thenobg_videoplaceholder if the API is unreachable.Usage
Test plan
?urn=query parameter resolves correctlynobg_videoplaceholder when API unreachableSRFsnippet listed first in Adapters category after installphp _build/build.transport.php🤖 Generated with Claude Code