-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3361b33
commit b5ec106
Showing
7 changed files
with
194 additions
and
320 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,77 @@ | ||
# pydash2hls | ||
[](https://www.gnu.org/licenses/gpl-3.0) | ||
[](https://github.com/hyugogirubato/pydash2hls/releases) | ||
 | ||
# PyDash2HLS | ||
|
||
Python library to convert DASH file to HLS. | ||
[](https://github.com/hyugogirubato/PyDash2HLS/blob/master/LICENSE) | ||
[](https://github.com/hyugogirubato/pydash2hls/releases) | ||
[](https://pypi.org/project/pydash2hls) | ||
|
||
# Usage | ||
PyDash2HLS is a Python library for converting DASH (Dynamic Adaptive Streaming over HTTP) manifest files to HLS (HTTP | ||
Live Streaming) format. | ||
|
||
### Basic Usage | ||
## Installation | ||
|
||
```python | ||
>>> from pydash2hls import Converter | ||
>>> converter = Converter.from_local('manifest.mpd') | ||
>>> converter = Converter.from_remote(method='GET', url='https://...') # Recommended option | ||
>>> profiles = converter.profile | ||
>>> hls_content = converter.build_hls(profile_id=profiles[0]['id']) | ||
>>> with open('index.m3u8', mode='w', encoding='utf-8') as f: | ||
... f.write(hls_content) | ||
... f.close() | ||
``` | ||
You can install PyDash2HLS using pip: | ||
|
||
# Installation | ||
````shell | ||
pip install pydash2hls | ||
```` | ||
|
||
## Usage | ||
|
||
### Converter Initialization | ||
|
||
To initialize the Converter class, you can use the following methods: | ||
|
||
#### Initialization from a Remote URL | ||
|
||
````python | ||
from pydash2hls import Converter | ||
|
||
# Initialize Converter from a remote URL | ||
url = "http://example.com/manifest.mpd" | ||
converter = Converter.from_remote(url) | ||
```` | ||
|
||
#### Initialization from a Local File | ||
|
||
````python | ||
from pydash2hls import Converter | ||
from pathlib import Path | ||
|
||
# Initialize Converter from a local file | ||
file_path = Path("path/to/manifest.mpd") | ||
converter = Converter.from_local(file_path) | ||
```` | ||
|
||
### Building HLS Manifest | ||
|
||
To build an HLS manifest for a specific profile, you can use the `build_hls()` method: | ||
|
||
````python | ||
# Build HLS manifest for a profile | ||
profile_id = "profile1" | ||
hls_manifest = converter.build_hls(profile_id) | ||
```` | ||
|
||
### Getting Media URLs | ||
|
||
To retrieve a list of media URLs for a specific profile, you can use the `media_urls()` method: | ||
|
||
````python | ||
# Get media URLs for a profile | ||
profile_id = "profile1" | ||
media_urls = converter.media_urls(profile_id) | ||
```` | ||
|
||
### Exceptions | ||
|
||
The following exceptions can be raised by PyDash2HLS: | ||
|
||
- `InvalidPath`: Raised when the file path is invalid. | ||
- `InvalidFileContent`: Raised when the contents of the file are not in DASH format or are incompatible. | ||
- `InvalidProfile`: Raised when the selected profile is invalid. | ||
- `MissingRemoteUrl`: Raised when a remote file URL is required but not provided. | ||
|
||
### License | ||
|
||
This project is licensed under the [GPL v3 License](LICENSE). | ||
|
||
To install, you can either clone the repository and run `python setup.py install` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from pydash2hls.converter import * | ||
from .converter import * | ||
|
||
__version__ = "2.0.1" | ||
__version__ = "2.1.0" |
Oops, something went wrong.