Commit Graph

76 Commits

Author SHA1 Message Date
cd24696367 Fix space issue in sequence counter 2023-01-11 18:10:52 +01:00
ecba66d27a Implement basic naming options 2023-01-11 09:08:32 +01:00
d4616f6298 Update README 2023-01-09 19:48:59 +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
b13d4186b0 Add content-type check for HLS responses 2023-01-09 05:07:04 +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
aa6a6e4a30 Remove obsolete tests 2023-01-08 20:02:54 +01:00
eac65aaa1c Fix renditions audio/subtitles objects
Due to faulty syntax the `provides_accessibility` field was None/True
instead of False/True
2023-01-07 12:28:34 +01:00
87f833d655 Add docopt-ng to dependencies in README 2023-01-06 10:06:29 +01:00
914f711670 Merge pull request 'Fix #24 and #25' (#26) from vtt2srt into stable
Reviewed-on: #26
2023-01-06 00:24:56 +00:00
96f411cca0 Fix #24 and #25
Remove dependency to `webvtt-py` which was both too much and not enough
for our use case.
Implement a basic WebVTT to SRT converter according to ArteTV's usage of
WebVTT features.
2023-01-06 01:17:55 +01:00
8d216215dd Merge pull request 'docopt-ng' (#22) from docopt-ng into stable
Reviewed-on: #22
2023-01-03 08:45:46 +00:00
831d62d1fd Update README 2022-12-29 11:14:23 +01:00
464cf85680 Rename command line argument holder 2022-12-29 11:09:28 +01:00
381cbd7a36 Fix bub in version label building 2022-12-29 11:00:48 +01:00
4eac1fa86d Fix bub in version label building 2022-12-29 10:57:15 +01:00
b057bab44b Implement CLI parsing using docopt-ng library 2022-12-29 10:54:45 +01:00
3ec2961a85 Merge pull request 'refactoring' (#21) from barbadev2 into stable
Reviewed-on: #21
2022-12-29 07:58:48 +00:00
e4cba27bdd Update README to reflect changes 2022-12-29 08:49:45 +01:00
e1bed8b1be Provide programmatic access #20 2022-12-29 08:49:45 +01:00
07ef013ce3 Rename error handling
- move errors in a `error` module
- rename the module base error from `Error` to `ModuleError`
- fix some error handling in `__main__`
2022-12-29 08:49:45 +01:00
db0a954497 Refactor code to use the model types
- Rename variables and function to reflect model names.
- Convert infrastructure data (JSON, M3U8) to model types.
- Change algorithms to produce/consume `Source` model, in particular
  using generator functions to build a list of `Source`s rather than the
  opaque `rendition => variant => urls` mapping (this will make #7 very
  straight forward).
- Download all master playlists after API call before selecting
  rendition/variants.

Motivation for the last point:

We use to offer rendition choosing right after the API call, before we
download the appropriate master playlist to figure out the available
variants.

The problem with that is that ArteTV's codes for the renditions (given
by the API) do not necessarily include complete languages information
(if it is not French or German), for instance a original audio track in
Portuguese would show as `VOEU-` (as in "EUropean"). The actual mention
of the Portuguese would only show up in the master playlist.

So, the new implementation actually downloads all master playlists
straight after the API call. This is a bit wasteful, but I figured it
was necessary to provide quality interaction with the user.

Bonus? Now when we first prompt the user for rendition choice, we
actually already know the available variants available, maybe we make
use of that fact in the future...
2022-12-29 08:43:20 +01:00
4fa5e1953e Create the data model types
A bunch of data structures to be used instead of the types used by the
infrastructures, i.e. JSON for API and M3U8 for the HLS.

It should provide a stronger decoupling of the modules and pave the way
for #7 and #8.

Implementation uses `namedtuple`s as they are transparent to test for
equality and are natively hashable (can be used in `set`s or as keys to
`dict`s) which is useful for deduping for instance.
2022-12-27 07:55:36 +01:00
305d8ab679 Refactor website URL parsing
Lighter implementation and using `target_id` instead of `program_id`,
preparing for #7
2022-12-27 07:52:35 +01:00
4c518993ef Change error handling
Creation of a `common.Error` exception whose string representation is
taken from its docstring.

Creation of a `common.UnexpectedError` to serve as base for exceptions
raised while checking assumptions on requests and responses.

The later are handled by displaying a message inviting user to submit
the error to us, so we can correct our assumptions.
2022-12-22 17:43:42 +01:00
88ffe31a94 Use requests library instead of urllib
Enables by default:
- gzip compression
- request pooling
2022-12-20 23:46:44 +01:00
458d4cbb6d Add sample files 2022-12-20 10:11:18 +01:00
1eb4d8557d Spell check 2022-12-20 09:48:57 +01:00
b938dc38c6 Merge branch 'WIP--CLI-argumentsv2#1' into stable 2022-12-19 00:33:02 +01:00
28bd775817 📄 📝 docstring and licence at top of test package init module 2022-12-19 00:32:23 +01:00
196f88aebb Merge branch 'stable' of git.afpy.org:fcode/delarte into stable 2022-12-19 00:28:51 +01:00
dacf9533d6 Fix HLS protocol terminology in the code #12
- versions => renditions
- resolutions => variants
- ranges and/or chunks => segments
- version index => master playlist
- other index => media playlist url

For now, the CLI has not been updated with this terminology, only the
code.
2022-12-18 16:27:04 +01:00
52420213cd 📝 add more doc for CLI help string 2022-12-18 15:41:10 +01:00
e6741594b6 📄 add licence comments top 2022-12-18 15:41:10 +01:00
87f2e55a6f 💡 french translating docstrings 2022-12-18 15:41:10 +01:00
bcf0ba98ad 🐛 💡 fixed bad help sentence for resolution argument 2022-12-18 15:41:10 +01:00
beb0d99c1a 🚸 remove flags from script prototype
🩹 naming: not "languages", "version"
2022-12-18 15:41:10 +01:00
aab1308698 🚸 add documentation for user to arguments parser with -h flag 2022-12-18 15:41:10 +01:00
d39db7a501 📝 change readme doc on usage 2022-12-18 15:41:10 +01:00
7d6f132999 🚚 rename modules and cli parser Class 2022-12-18 15:41:10 +01:00
00f06ea5ba ♻️ wrapped parser functions in a Parser object 2022-12-18 15:41:10 +01:00
8997dc46ec add tests for cli parser behaviour 2022-12-18 15:41:10 +01:00
8720a8d47d 🩹 use argparse library for parsing CLI arguments 2022-12-18 15:41:10 +01:00
14b9c1bb11 Adds the tests directory 2022-12-14 13:55:56 +01:00
bd1339e02e Merge pull request '#12 Fix HLS terminology' (#15) from 12-hls-terminology into stable
Reviewed-on: #15
2022-12-13 16:19:40 +00:00
2894cdd8c8 Fix HLS protocol terminology in the code #12
- versions => renditions
- resolutions => variants
- ranges and/or chunks => segments
- version index => master playlist
- other index => media playlist url

For now, the CLI has not been updated with this terminology, only the
code.
2022-12-13 13:28:28 +01:00
8d018b3ce5 Merge pull request 'Fix issue #13 - split code in multiple modules' (#14) from 13-code-split into stable
Reviewed-on: #14
2022-12-13 07:58:17 +00: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
9f79687088 Merge pull request 'Fix issue #6' (#10) from 6-ffmpeg-error into stable
Reviewed-on: #10
2022-12-13 04:40:39 +00:00