Commit Graph

16 Commits

Author SHA1 Message Date
a108135141 Use urllib3 instead of requests
We were not (and probably wont be ) using any worthwhile `requests`
features (beside `raise_for_status()`) and the `timeout` session
parameter propagation vs adapter plugging "thing" in requests just
annoys me deeply (not that kind of "... Human (TM)")
2023-02-13 09:35:33 +01:00
f36d45fb5e Enable interrupt/resume of MP4 streams
- skipping the processing of an existing target output file
- skipping the download of an existing target stream file
- resume the download of an existing target stream temporary file
  using a HTTP range request
2023-01-25 08:53:25 +01:00
56c1e8468a Split program/rendition/variant/target operations
Significant rewrite after model modification: introducing `*Sources`
objects that encapsulate metadata and fetch information (urls,
protocols). The API (#20) is organized as pipe elements with sources
being what flows through the pipe.
    1. fetch program sources
    2. fetch rendition sources
    3. fetch variant sources
    4. fetch targets
    5. process (download+mux) targets
Some user selection filter or modifiers could then be applied at any
step of the pipe. Our __main__.py is an implementation of that scheme.

Implied modifications include:
 - Later failure on unsupported protocols, used to be in `api`, now in
   `hls`. This offers the possibility to filter and/or support them
   later.
 - Give up honoring the http ranges for mp4 download, stream-download
   them by fixed chunk instead.
 - Cleaning up of the `hls` module moving the main download function to
   __init__ and specific (mp4/vtt) download functions to a new
   `download` module.

On the side modifications include:
 - The progress handler showing downloading rates.
 - The naming utilities providing rendition and variant code insertion.
 - Download parts to working directories and skip unnecessary
   re-downloads on failure.

This was a big change for a single commit... too big of a change maybe.
2023-01-24 08:27:37 +01:00
639a8063a5 Get program information from page content
Changes the way the program information is figured out. From URL parsing
to page content parsing.
A massive JSON object is shipped within the HTML of the page, that's
were we get what we need from.

Side effects:
 - drop `slug` from the program's info
 - drop `slug` naming option
 - no `Program` / `ProgramMeta` distinction

Includes some JSON samples.
2023-01-14 19:51:02 +01:00
ecba66d27a Implement basic naming options 2023-01-11 09:08:32 +01:00
4667dbfca1 Refactor models and API
Change/add/rename model's data structures in order to provide a more
useful API #20, introducing new structures:
- `Sources`: summarizing program, renditions and variants found
  at a given ArteTV page URL
- `Target`: summarizing all required data for a download

And new functions:
- `fetch_sources()` to build the `Sources` from a URL
- `iter_[renditions|variants]()` describe the available options for the
  `Sources`
- `select_[renditions|variants]()` to narrow down the desired options
  for the `Sources`
- `compile_sources` to compute such a `Target` from `Sources`
- `download_target` to download such a `Target`

Finally, this should make the playlist handling #7 easier (I know, I've
said that before)
2023-01-09 19:30:46 +01:00
5674b4aa0d Fix terminology and harmful language #12
Master playlists become program indexes
Media playlists become track indexes
2023-01-08 20:40:49 +01:00
81913a6f24 Cleanup package API #20
Move all error definitions to `error` module
In `__init__`
  - Remove imports from global scope
  - Import all from `model` module
  - Import all from `error` module
Refactor: `fetch_sources()` to take the URL as argument
Coding style: import definitions from `error` and `model`
2023-01-08 20:04:18 +01:00
e1bed8b1be Provide programmatic access #20 2022-12-29 08:49:45 +01:00
1eb4d8557d Spell check 2022-12-20 09:48:57 +01:00
6b8f2232c4 Fix issue #13 - split code in multiple modules
Implemented modules:
 - api: deals with ArteTV JSON API
 - hls: deals with HLS protocol
 - muxing: deals with the stream multiplexing
 - naming: deals with output file naming
 - www: deals with ArteTV web interface
2022-12-13 07:29:59 +01:00
be4363a339 Fix issue #6 on FFMPEG header error
Handle the audio and video channel downloading to temporary files prior
to calling ffmpeg.

Although it might not be necessary, the download is made by "chunks" as
it would be by a client/player.

Downloading progress feedback is printed to the terminal.
2022-12-11 16:09:11 +01:00
a404dd1da4 Get rid of gitlab references 2022-12-09 21:14:57 +01:00
f9c20e2149 Match signature for version & resolution functions 2022-12-09 20:52:55 +01:00
9593619c68 Setup the execution arch 2022-12-09 00:34:15 +01:00
f22fe297c5 Packaging with flit 2022-12-08 22:39:46 +01:00