WIP: Refactor object model #30
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "model"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The PRV object model (
Program,Rendition,Variant) implementation is a bit annoying:For some aesthetic reasons, the intermediate URLs (or sources) are not embedded in the objects themselves because those are consumed along the way: the URL pointing to the file containing rendition information is "replaced" by that rendition information once we got it. The downside is that we end up dealing with
(objects, sources)tuples and/or parameters making the code less readable.The three structures are inherently interconnected, they actually form a tree structure (programs have renditions, renditions have variants), except they are not (in the code). Again, we end up using
(Program[, Rendition [, Variant]])tuples and/or parameters making the code less readable.By definition renditions is supposed to be a chosen audio/subtitles languages/type combination. Except that, in our implementation, they are not. Mainly because the rendition information we get from API does not actually tell us, it implies it (through the code: VOF-STF, VO-ST[ITA], ...). Conversely, a variant should be a chosen quality for the tracks, and that is not obvious in the model definition (actually, our
Variantlooks a bit too much like what a rendition should be and ourRenditiondoes not carry a lot of information).Addressing those points one by one:
This could be addressed with a bunch more of named tuples, but then we would have to find clever naming and at the end it just adds a lot of code. As the amount of data we are dealing with is ridiculous, we could just grow our data structures, including
sources.Same as above, including tree structure.
Limit the scope of the model to only top-level API functions and having each module (
www,api,hls...) having their "own model" based on the actual data they handle.About the tree structure (point 2), I see two approaches:
Programhas a list ofRendition,Renditiona list ofVariant.Varianthas aRendition,Renditionhas aProgram.Although the second option makes bigger objects and duplicate of the parents for each child, it is the one I favor:
Program, we do not have rendition information yet and therefore would initialize an empty list ofRenditionand only then populate it. This makes the intermediatePrograma false representation: it does have someRenditionbut we just don't know about them yet.RenditionperProgramand exactly oneVariantperRendition. So, again, the benefit of actually dealing with list of children is kind of null.About the semantics of the model (Point 3):
Variantshould carry the information about audio/subtitles languages and types (audio description, hearing impaired, etc...) these can be inferred from the rendition codes (VOF-STF, VO-ST[ITA], ...). Then we do not need to carry the code itself (which, by the way have horrific format) and leave it to the human interface to reconstruct an identifier based on theVariantdata.The main problem is that the code don't always inform about audio languages. But we can temporarily use the
undlanguage code that actually mean undefined. We can then set it to the proper language when building theVariantobject from the HLS program index.Renditionshould then carry the quality information (only applicable to video track for now). Also, we should drop thecodefield and likewise, leave it the the human interface to construct it as needed.About the codes (renditions and variants): I think it make sense to leave that responsibility to the human interface. We may need different types of codes for example:
Okay, the more I think about it, the more I think point 1 and 2 are secondary and may be addressed by a better splitting between our 3 "zones":
www,apiandhlsmodules (their data)__init__top level module API (our data)__main__So I'll first address that splitting and point 3 (semantics) and then see if 1 and 2 are still relevant.
wwwmodule bdc8b7b246apimodule andRendition*model 58b0ba30a3hlsmodule andVariant*model c8aab4c5a3View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.