lxml based parser for DASH manifests (mpd files)
Project description
mpd-parser
Installation
$ python -m pip install mpd-parser
Usage
Importing
from mpd_parser.parser import Parser
parse from string
with open("path/to/file.mpd", mode="r") as manifest_file:
mpd_string = manifest_file.read()
parsed_mpd = Parser.from_string(mpd_string)
parse from file
input_file = "path/to/file.mpd"
mpd = Parser.from_file(input_file)
convert back to string
mpd_as_xml_string = Parser.to_string(parsed_mpd)
Overview
A utility to parse mpeg dash mpd files quickly This package is heavily inspired by mpegdash package the main difference is that I choose to relay on lxml for parsing, and not the standard xml library.
The decision to implement it with lxml is for two reasons:
- lxml is faster then minidom
- lxml mimics the ElementTree API which is a more pythonic approach to XMLs
mpegdash package has two distinct advantages over this package:
- it does not require third party libraries.
- it uses the classic DOM approach to parsing XML files. it is a well known standard.
Benchmarks
TBA
Example manifests
Taken from https://ottverse.com/free-mpeg-dash-mpd-manifest-example-test-urls/ These are what I used to test and benchmark the package.
Missing unit-tests
- tags
- attribute parsers
- full manifest testing
Contributing
TBA
Build locally
python -m build
Run pylint locally
I try to keep the pylint score above 9.
python -m pylint ./mpd_parser/
TODO
finish working on periods and sub tagsperiodsadapt-setssegment basessegment listssegment templatesasset idsevent streamssubsets
create package locallytest it- complete readme
installationusage- Benchmarks
- contributing
push to githubpush package to pypi- add github actions
pylintpytestbuild packagepush package
- complete unit-tests
- refactor tags to multiple files
- Parsing:
parsing from stringparsing from file- parsing from URL
- save mpd object:
object to string- object to file
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mpd_parser-0.1.4.tar.gz
.
File metadata
- Download URL: mpd_parser-0.1.4.tar.gz
- Upload date:
- Size: 15.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 276436c5295954af9a0819932bcb9409952e6f6cc6e795bbd46de348620e0b0b |
|
MD5 | aadd7b0ebc0d3b2560b5140a46c5c658 |
|
BLAKE2b-256 | f71b42204347364a3423cfcfdaccb5414e745a19eeaf4309059029e6261e5985 |
File details
Details for the file mpd_parser-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: mpd_parser-0.1.4-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0039607097efdf3d8fb515cd3ce65dd66a1b17ef53e2e5d5e6d1d69becbeb60c |
|
MD5 | 5cd31bd0bd2fea3972ef68ce7a513a7b |
|
BLAKE2b-256 | e415e7858a61392952cf90826d07eaf5d0b3142acb9c2c46ec44de5017ffa5b7 |