globocom / globocom/m3u8

if EXT-X-KEY:METHOD=NONE, get TypeError: __init__() takes at least 4 arguments (3 given)

Open
#58 12 comments 0 reactions 0 assignees View on GitHub
feature
Dominant language
Python
Stars
2.3k
Forks
496
PR merge metrics
No merged PRs in 30d

Description

in model.py > Class Segment() > **init**() for the following line:

``` python
self.key = Key(base_uri=base_uri,**key) if key else None
```

if a segment has "#EXT-X-KEY:METHOD=NONE", it is missing the uri parameter needed for class Key(), its init function:

``` python
def __init__(self, method, uri, base_uri, iv=None, keyformat=None, keyformatversions=None):
```

I believe uri should also be an optional parameter according to this documentation:

```
URI

The value is a quoted-string containing a URI that specifies how to
obtain the key. This attribute is REQUIRED unless the METHOD is
NONE.
```

http://tools.ietf.org/html/draft-pantos-http-live-streaming-16#section-4.3.2.4

The fix would be the following code for Key().**init**() where uri=None is the main different making it optional:

``` python
def __init__(self, method, base_uri, uri=None, iv=None, keyformat=None, keyformatversions=None):
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in model.py at Segment.__init__ and Key.__init__, then inspect existing Key callers for the constructor's argument order. Reproduce parsing an EXT-X-KEY:METHOD=NONE playlist and verify it creates a segment without a key URI or a TypeError, then run the project's existing tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.