Repository navigation
Design generic models #1419
Description
As part of expanding site support; we should design an architecture that allows us to best describe streams / downloads, and their audio / video / thumbnail / subtitle assets.
Video and thumbnail assets are usually a single entry for each media key. We probably won't need to support multiple versions of these.
Audio is often presented as multiple formats and we can technically download as many as the file container supports. This lets us create a final file that has a translation audio track, and both original audio and default audio tracks available during playback.
Subtitles are likewise offered in multiple languages and it could be useful to download many of these. We also need to be concerned if they should be embedded or kept external alongside the final video file. Possibly in a dedicated subdirectory with names that partially match the final video file.
YouTube, as an example, has playlists and either streams or videos. The different types of playlists used have various URL templates. Once you have a key for the stream / video / playlist, these can be inserted into the proper template for the asset type that is desired.
Other sites may operate differently, but we expect most will have a unique identifier for each stream / video / playlist.
An additional complication will be format selection. I think a list of profiles that can be reused makes the most sense here.
We should compose these profiles from smaller pieces that can also be reused.
Asset types:
- video
- audio
- subtitle
- thumbnail
Codec:
- supported asset type
- codec name
Subtitle:
- language
- original language
- extension
- codec
- machine generated
Thumbnail:
- extension
- codec
- height
- min
- max
- convert(ed) to
- width
- min
- max
- convert(ed) to
- orientation
- portrait
- landscape
- resized
Container:
- extension
- supported asset type
- number of type supported
- supported codec
Audio:
- language
- default
- original
- bit rate
- frequency
- range compression
- extension
- codec
- machine generated
Video:
- Frames per second
- min
- max
- Codec preference
- acceptable codecs
- ordering priority
- Resolution
- min
- max
- Dynamic Range
- min
- max
- Upscaled
- accept
- deny
- Pre-combined video & audio
- deny
- accept & deconstruct
- accept & preserve
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsTodo
Activity
Codecmodel #1421Containermodel #1423tcely commentedon Mar 15, 2026
Suggestions from Google's AI
URL: https://share.google/aimode/dxu8XXDMOsp7Utxnq
To expand TubeSync's site support, you need a decoupled architecture that separates Source Discovery (finding IDs) from Asset Mapping (matching IDs to streams).
Here is a proposed plan to structure these entities and profiles.
The "Media Manifest" Architecture
Instead of downloading directly, introduce a Manifest layer. When a URL is processed, the system generates a manifest that maps unique identifiers to available streams.
Hierarchical Profile System
To keep profiles reusable and modular, use a "Lego-block" approach:
Execution Strategy
Phase A: The Registry (Metadata)
Implement the data models you listed as a Capability Matrix. When TubeSync hits a new site, it shouldn't just ask "Where is the file?", it should ask "What assets do you have?" and populate the Audio, Video, and Subtitle objects based on your schema.
Phase B: The Selection Engine
Build a resolver that scores available assets.
Phase C: The Post-Processor (Muxing & Storage)
Site-Specific Template Mapping
Since different sites use different URL patterns, use a Provider Template system:
https://www.youtube.com/watch?v={key}https://i.ytimg.com/vi/{key}/maxresdefault.jpghttps://www.youtube.com/playlist?list=PL{playlist-id}The corrections you made solidify the architecture by ensuring the URL templates and metadata schemas are concrete. Separating the "Discovery" (ID extraction) from the "Manifest" (stream mapping) is the right move for scaling beyond YouTube.
To advance this, we should look at how the "Mixer" logic handles conflicts or missing assets.
Refined Logic for the Selection Engine:
Data Model Extension:
For the Site-Specific Templates, consider adding a "Key Extractor" regex per provider. This allows the system to turn a messy URL into that clean
{key}used in your templates.meeb commentedon Mar 16, 2026
Sounds like a good plan to me. Regarding the
{key}stuff and requiring templates per source type I was originally planning to expand source support by just entirely relying onyt-dlp.yt-dlpreturns lists of media items for things like playlist pages for most sources so I was testing to see if we could entirely replace{key}extraction with UUID5'ing the entire URL and using that as a "unique-ness" check for media to download. This would probably need some URL formatting (e.g. parameter ordering [alphabetical?], forced lower-case and truncation of URI fragments etc.).If that worked we wouldn't need to have any site-specific templates at all and it would support whatever
yt-dlpsupported.Subtitlemodel #1453tcely commentedon Apr 15, 2026
Test image:
Thumbnailmodel #1461