Skip to content

Commit

Permalink
Release v2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hyugogirubato committed Jun 3, 2023
1 parent 3361b33 commit b5ec106
Show file tree
Hide file tree
Showing 7 changed files with 194 additions and 320 deletions.
101 changes: 0 additions & 101 deletions .gitignore

This file was deleted.

23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

90 changes: 71 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,77 @@
# pydash2hls
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Release](https://img.shields.io/github/release-date/hyugogirubato/pydash2hls?style=plastic)](https://github.com/hyugogirubato/pydash2hls/releases)
![Total Downloads](https://img.shields.io/github/downloads/hyugogirubato/pydash2hls/total.svg?style=plastic)
# PyDash2HLS

Python library to convert DASH file to HLS.
[![License](https://img.shields.io/github/license/hyugogirubato/PyDash2HLS)](https://github.com/hyugogirubato/PyDash2HLS/blob/master/LICENSE)
[![Release](https://img.shields.io/github/release-date/hyugogirubato/pydash2hls)](https://github.com/hyugogirubato/pydash2hls/releases)
[![Latest Version](https://img.shields.io/pypi/v/pydash2hls)](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`
4 changes: 2 additions & 2 deletions pydash2hls/__init__.py
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"
Loading

0 comments on commit b5ec106

Please sign in to comment.