This uses the extract-flat mode of YoutubeDL, which skips parsing
individual items within a playlist. We define a dedicated MRL scheme
to track a YoutubeDL playlist item, and parse it only when the item is
actually opened.
This has two benefits:
1) Extracting a playlist is dramatically faster.
2) Expiring media URL can be played even if the playlist is long.
This does *not* solve the remaining problem that expiring URLs cannot
be saved and replayed later.
This script generates a JSON playlist from a given URL, providing a
simple serial format that can be read and parsed by another process.
The JSON schema is the same as YoutubeDL's.
There are in principles two other alternative ways to access it:
1) Calling the YoutubeDL module directly in-process through CPython.
This poses a number of problems:
- CPython must be loaded by the main executable. Python modules will
fail to resolve their CPython symbols otherwise.
- Multiple CPython interpreters are still very immature; GIL behaves
weirdly. CPython is really not meant for multithread.
- The GIL prevents concurrent uses (that's the whole point of it).
- CPython network I/O cannot be interrupted by VLC interruptions, so
the calling thread may get stuck inside CPython.
- A build-time dependency on CPython is added.
2) Calling the YouTubeDL executable directly. This is impractical
because logging infos get interleaved on the standard output
alongside the proper output data. Worse yet, there are no obvious
ways to separate (flat) playlist extraction and item parsing
(which becomes necessary in a later patch in the series).
3) Using a playlist format already supported by VLC (as done in
previous versions of the patchest). This causes loss of potentially
useful information.