Skip to content

Commit

Permalink
Feature/update original fork (#4)
Browse files Browse the repository at this point in the history
* Add UTCTiming support

* Add messageData attribute to Event

* Add method to output mpd as a string, and associated test (sangwonl#22)

* Add method to output mpd as a string, and associated test

* Add debugging option in test to see whats happening on Python2.6

* provide own xml prettyprint work round bug in minidom 2.6

* import xml_utils correctly

* Rename xml_utils to something more sensible

* Fix sangwonl#24 - support elements which only contain basic text contents

* Fix sangwonl#25 - use correct case for xsboolean (sangwonl#26)

* Set release version to 0.2.0

change repository for maintenance

* Update README.md

* Fix travis and readme as restructuredtext

* Support non-standard label attribute

Fix sangwonl#32

* clarifies profile vs profiles (sangwonl#37)

* clarifies profile vs profiles

* added profiles attribute to an AdaptationSet

* moved AdaptationSet @profiles for mergability

* Added @selectionPriority to AdaptationSet (sangwonl#35)

* added selection priority to AdaptationSet

* added selectionPriority to first AdaptationSet for identity test

* Add KID attribute to the Descriptor class (sangwonl#38)

Added the KID attribute to the Descriptor class to identify KID in the manifests of DRM encrypted content.

* Improve ignored files and folders (sangwonl#42)

This has the previous ignores and the common ones provided by GitHub.

I also added in the JetBrains project settings ignore.

* Dont use a Bare except on urllib import (sangwonl#43)

* Replace single char re alternation with char class (sangwonl#44)

* Use ImportError, Swap unittest import order (sangwonl#46)

These are swapped since unittest2 is intended to be used if you're on Python 2. More people will be using Python 3 at this point so it's best to import the Python 3 module and if unable to, it will use the backport.

Most people will be using Python 3 so this will also speed things up somewhat as one less unnecessary (almost expected) try catch will be prevented.

* Optimize README (sangwonl#51)

This change cleans up the Markdown to follow typical markdown linting rules (think of it as following PEP 8 for Markdown).

I also added a License Badge, and a section at the bottom.

* Prettyprinter clean up, typos, redundancy (sangwonl#45)

* Prettyprinter clean up, typos, redundancy

Spacing, Unnecessary Lines, Typos, Unnecessary characters, missing r'' for regex strings and unnecessary character escaping.

* Fix typo in prettyprinter

* Use GitHub Actions CI (sangwonl#50)

* Create Build Status GitHub Actions CI

* Create Release Packager GitHub Actions CI

* Use GitHub Actions CI Build Status Badge

* Use 2.7,3.x versions for Build Status

 2.6 and 2.8 isn't available. The Build Status Badge will assume 2.6+ is works if this passes. I don't think there's any smoother solution without diving into dodgy 3rd party GitHub actions.

* add install requirements

* update install requires

* using temporary if/else for requirements

* parsing datetimes

Co-authored-by: davemevans <dave.evans@m2amedia.tv>
Co-authored-by: Sangwon Lee <gamzabaw@gmail.com>
Co-authored-by: David Evans <5390145+davemevans@users.noreply.github.com>
Co-authored-by: bvc3at <thecapslockman@ya.ru>
Co-authored-by: thenewguy <wgordonw1@gmail.com>
Co-authored-by: Jayapraveen AR <jayapraveen.ar.2015.cse@rajalakshmi.edu.in>
Co-authored-by: PHOENiX <pragma.exe@gmail.com>
Co-authored-by: PHOENiX <rlaphoenix@pm.me>
Co-authored-by: Pedro Martin <p.martin@tvup.media>
  • Loading branch information
10 people committed Aug 17, 2021
1 parent 549681c commit dc409f5
Show file tree
Hide file tree
Showing 17 changed files with 540 additions and 98 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/build-status.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Build Status

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
# <=2.6 and 2.8 isn't available: https://github.com/actions/python-versions/blob/main/versions-manifest.json
python-version: ['2.7', '3.x']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build flake8
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Build
run: |
python -m build
31 changes: 31 additions & 0 deletions .github/workflows/release-packager.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Release Packager

on:
release:
types: [created]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m build
twine upload dist/*
121 changes: 119 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,121 @@
*.py[co]
# python-mpegdash specific
*.sw[op]
*.ropeproject
tests/mpd-samples/output.mpd

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# JetBrains project settings
.idea

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
language: python
python:
- "2.6"
- "2.7"
- "3.3"
- "3.4"
- "3.5"
script: python setup.py test
100 changes: 62 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,69 @@
[![Build Status](https://travis-ci.org/caststack/python-mpegdash.svg?branch=master)](https://travis-ci.org/caststack/python-mpegdash)

# python-mpegdash
MPEG-DASH MPD(Media Presentation Description) Parser
compatible with Python2.6+ and Python3

## Install
$ pip install mpegdash
MPEG-DASH MPD (Media Presentation Description) Parser compatible with Python 2.6+ and Python 3.

[![Build Status](https://img.shields.io/github/workflow/status/sangwonl/python-mpegdash/Build%20Status?label=Python%202.7%2B%20builds)](https://github.com/sangwonl/python-mpegdash/actions?query=workflow%3A%22Build+Status%22)
[![License](https://img.shields.io/github/license/sangwonl/python-mpegdash?style=flat)](https://github.com/sangwonl/python-mpegdash/blob/master/LICENSE)

* * *

## Installation

```bash
$ pip install mpegdash
```

* * *

## Test
$ python -m unittest discover
$ python3 -m unittest discover

```bash
$ python -m unittest discover
$ python3 -m unittest discover
```

* * *

## Usage
from mpegdash.parser import MPEGDASHParser

# Parse from file path
mpd_path = './tests/mpd-samples/sample-001.mpd'
mpd = MPEGDASHParser.parse(mpd_path)

# Parse from url
mpd_url = 'http://yt-dash-mse-test.commondatastorage.googleapis.com/media/motion-20120802-manifest.mpd'
mpd = MPEGDASHParser.parse(mpd_url)

# Parse from string
mpd_string = '''
<MPD xmlns="urn:mpeg:DASH:schema:MPD:2011" mediaPresentationDuration="PT0H1M52.43S" minBufferTime="PT1.5S"
profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" type="static">
<Period duration="PT0H1M52.43S" start="PT0S">
<AdaptationSet>
<ContentComponent contentType="video" id="1" />
<Representation bandwidth="4190760" codecs="avc1.640028" height="1080" id="1" mimeType="video/mp4" width="1920">
<BaseURL>motion-20120802-89.mp4</BaseURL>
<SegmentBase indexRange="674-981">
<Initialization range="0-673" />
</SegmentBase>
</Representation>
</AdaptationSet>
</Period>
</MPD>
'''
mpd = MPEGDASHParser.parse(mpd_string)

# Write to xml file
MPEGDASHParser.write(mpd, './tests/mpd-samples/output.mpd')

```py
from mpegdash.parser import MPEGDASHParser

# Parse from file path
mpd_path = './tests/mpd-samples/sample-001.mpd'
mpd = MPEGDASHParser.parse(mpd_path)

# Parse from url
mpd_url = 'http://yt-dash-mse-test.commondatastorage.googleapis.com/media/motion-20120802-manifest.mpd'
mpd = MPEGDASHParser.parse(mpd_url)

# Parse from string
mpd_string = '''
<MPD xmlns="urn:mpeg:DASH:schema:MPD:2011" mediaPresentationDuration="PT0H1M52.43S" minBufferTime="PT1.5S"
profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" type="static">
<Period duration="PT0H1M52.43S" start="PT0S">
<AdaptationSet>
<ContentComponent contentType="video" id="1" />
<Representation bandwidth="4190760" codecs="avc1.640028" height="1080" id="1" mimeType="video/mp4" width="1920">
<BaseURL>motion-20120802-89.mp4</BaseURL>
<SegmentBase indexRange="674-981">
<Initialization range="0-673" />
</SegmentBase>
</Representation>
</AdaptationSet>
</Period>
</MPD>
'''
mpd = MPEGDASHParser.parse(mpd_string)

# Write to xml file
MPEGDASHParser.write(mpd, './tests/mpd-samples/output.mpd')
```

* * *

## License

This project is released under the MIT license.
Please read and agree to the license before use, it can be found in the [LICENSE](LICENSE) file.
Loading

0 comments on commit dc409f5

Please sign in to comment.