mpd-parser


Namempd-parser JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/avishaycohen/mpd-parser
Summarylxml based parser for DASH manifests (mpd files)
upload_time2023-03-10 09:40:53
maintainer
docs_urlNone
authorAvishay Cohen
requires_python>=3.8
licenseMIT License Copyright (c) 2022 avishaycohen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords parser dash manifest video files
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # mpd-parser

## Installation
```shell
$ python -m pip install mpd-parser
```

## Usage
### Importing

```python
from mpd_parser.parser import Parser
```
### parse from string
```python
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
```python
input_file = "path/to/file.mpd"
mpd = Parser.from_file(input_file)
```

### convert back to string
```python
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](https://github.com/sangwonl/python-mpegdash) 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:
1. lxml is faster then minidom
2. lxml mimics the ElementTree API which is a more pythonic approach to XMLs

mpegdash package has two distinct advantages over this package:
1. it does not require third party libraries.
2. 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
1. tags
2. attribute parsers
3. full manifest testing

## Contributing
TBA

### Build locally
```shell
python -m build
```
### Run pylint locally
I try to keep the pylint score above 9.
```shell
python -m pylint ./mpd_parser/
```

## TODO
1. ~~finish working on periods and sub tags~~
   1. ~~periods~~
   2. ~~adapt-sets~~
   3. ~~segment bases~~
   4. ~~segment lists~~
   5. ~~segment templates~~
   6. ~~asset ids~~
   7. ~~event streams~~
   8. ~~subsets~~
2. ~~create package locally~~
3. ~~test it~~
4. complete readme
   1. ~~installation~~
   2. ~~usage~~
   3. Benchmarks
   4. contributing
5. ~~push to github~~
6. ~~push package to pypi~~
7. add github actions
   1. ~~pylint~~
   2. ~~pytest~~
   3. ~~build package~~
   4. ~~push package~~
8. complete unit-tests
9. refactor tags to multiple files
10. Parsing:
    1. ~~parsing from string~~
    2. ~~parsing from file~~
    3. parsing from URL
11. save mpd object:
    1. ~~object to string~~
    2. object to file

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/avishaycohen/mpd-parser",
    "name": "mpd-parser",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "parser,DASH,manifest,video,files",
    "author": "Avishay Cohen",
    "author_email": "Avishay Cohen <avishay.c@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/02/7a/c38794071687cb0eb7251351a83c81646f9df4b7bfcfe5b7fe62d63cdb6b/mpd-parser-0.1.2.tar.gz",
    "platform": null,
    "description": "# mpd-parser\n\n## Installation\n```shell\n$ python -m pip install mpd-parser\n```\n\n## Usage\n### Importing\n\n```python\nfrom mpd_parser.parser import Parser\n```\n### parse from string\n```python\nwith open(\"path/to/file.mpd\", mode=\"r\") as manifest_file:\n    mpd_string = manifest_file.read()\n    parsed_mpd = Parser.from_string(mpd_string)\n```\n\n### parse from file\n```python\ninput_file = \"path/to/file.mpd\"\nmpd = Parser.from_file(input_file)\n```\n\n### convert back to string\n```python\nmpd_as_xml_string = Parser.to_string(parsed_mpd)\n```\n\n## Overview\nA utility to parse mpeg dash mpd files quickly\nThis package is heavily inspired by [mpegdash package](https://github.com/sangwonl/python-mpegdash) the main difference is that I choose to relay on lxml for parsing, and not the standard xml library.\n\nThe decision to implement it with lxml is for two reasons:\n1. lxml is faster then minidom\n2. lxml mimics the ElementTree API which is a more pythonic approach to XMLs\n\nmpegdash package has two distinct advantages over this package:\n1. it does not require third party libraries.\n2. it uses the classic DOM approach to parsing XML files. it is a well known standard.\n\n## Benchmarks\nTBA\n\n## Example manifests\nTaken from https://ottverse.com/free-mpeg-dash-mpd-manifest-example-test-urls/\nThese are what I used to test and benchmark the package.\n\n## Missing unit-tests\n1. tags\n2. attribute parsers\n3. full manifest testing\n\n## Contributing\nTBA\n\n### Build locally\n```shell\npython -m build\n```\n### Run pylint locally\nI try to keep the pylint score above 9.\n```shell\npython -m pylint ./mpd_parser/\n```\n\n## TODO\n1. ~~finish working on periods and sub tags~~\n   1. ~~periods~~\n   2. ~~adapt-sets~~\n   3. ~~segment bases~~\n   4. ~~segment lists~~\n   5. ~~segment templates~~\n   6. ~~asset ids~~\n   7. ~~event streams~~\n   8. ~~subsets~~\n2. ~~create package locally~~\n3. ~~test it~~\n4. complete readme\n   1. ~~installation~~\n   2. ~~usage~~\n   3. Benchmarks\n   4. contributing\n5. ~~push to github~~\n6. ~~push package to pypi~~\n7. add github actions\n   1. ~~pylint~~\n   2. ~~pytest~~\n   3. ~~build package~~\n   4. ~~push package~~\n8. complete unit-tests\n9. refactor tags to multiple files\n10. Parsing:\n    1. ~~parsing from string~~\n    2. ~~parsing from file~~\n    3. parsing from URL\n11. save mpd object:\n    1. ~~object to string~~\n    2. object to file\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2022 avishaycohen  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "lxml based parser for DASH manifests (mpd files)",
    "version": "0.1.2",
    "split_keywords": [
        "parser",
        "dash",
        "manifest",
        "video",
        "files"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e2b160f0a452a92e399dba9b5c155da9100141e741422af5494938aee039949e",
                "md5": "c2761304bfc4a80e9f0e8254a3771fb6",
                "sha256": "ed0b8a4e4ab4c9a28ef5fbd32765813d2f3dd895df6b28d4063f7107336f08e9"
            },
            "downloads": -1,
            "filename": "mpd_parser-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c2761304bfc4a80e9f0e8254a3771fb6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 10218,
            "upload_time": "2023-03-10T09:40:52",
            "upload_time_iso_8601": "2023-03-10T09:40:52.018167Z",
            "url": "https://files.pythonhosted.org/packages/e2/b1/60f0a452a92e399dba9b5c155da9100141e741422af5494938aee039949e/mpd_parser-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "027ac38794071687cb0eb7251351a83c81646f9df4b7bfcfe5b7fe62d63cdb6b",
                "md5": "92166010c1197e80d60d42087ac02992",
                "sha256": "f1a8d5677b67260305ebfe1dc36ed928872d0597941b5aee90e0afb6ef5c0371"
            },
            "downloads": -1,
            "filename": "mpd-parser-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "92166010c1197e80d60d42087ac02992",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 13678,
            "upload_time": "2023-03-10T09:40:53",
            "upload_time_iso_8601": "2023-03-10T09:40:53.660582Z",
            "url": "https://files.pythonhosted.org/packages/02/7a/c38794071687cb0eb7251351a83c81646f9df4b7bfcfe5b7fe62d63cdb6b/mpd-parser-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-10 09:40:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "avishaycohen",
    "github_project": "mpd-parser",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "mpd-parser"
}
        
Elapsed time: 0.04305s