cadebward / hls

A simple and fast library for parsing HLS manifests.
Apache License 2.0
3 stars 6 forks source link

fix: handle `EXT-X-ALLOW-CACHE` tag in hls playlist #7

Closed rajrajhans closed 1 year ago

rajrajhans commented 1 year ago

parsing a playlist with EXT-X-ALLOW-CACHE tag gives the following error:

11:49:34.828 [error] Task #PID<0.4522.0> started from #PID<0.4492.0> terminating
** (MatchError) no match of right hand side value: ["NO"]
    (hls 0.0.7) lib/hls/m3u_line.ex:58: anonymous fn/1 in HLS.M3ULine.parse_attributes/2
    (elixir 1.14.2) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
    (hls 0.0.7) lib/hls/m3u_line.ex:57: HLS.M3ULine.parse_attributes/2
    (hls 0.0.7) lib/hls/m3u_line.ex:36: HLS.M3ULine.build/1
    (elixir 1.14.2) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
    (elixir 1.14.2) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
    (hls 0.0.7) lib/hls.ex:14: HLS.parse/1
     *******
    (elixir 1.14.2) lib/task/supervised.ex:89: Task.Supervised.invoke_mfa/2
    (elixir 1.14.2) lib/task/supervised.ex:34: Task.Supervised.reply/4
    (stdlib 4.1.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Function: #Function<2.60670497/0 in   *******.process_manifest/2>
    Args: []
** (EXIT from #PID<0.2706.0>) shell process exited with reason: an exception was raised:
    ** (MatchError) no match of right hand side value: ["NO"]
        (hls 0.0.7) lib/hls/m3u_line.ex:58: anonymous fn/1 in HLS.M3ULine.parse_attributes/2
        (elixir 1.14.2) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
        (hls 0.0.7) lib/hls/m3u_line.ex:57: HLS.M3ULine.parse_attributes/2
        (hls 0.0.7) lib/hls/m3u_line.ex:36: HLS.M3ULine.build/1
        (elixir 1.14.2) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
        (elixir 1.14.2) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
        (hls 0.0.7) lib/hls.ex:14: HLS.parse/1
        *******
        (elixir 1.14.2) lib/task/supervised.ex:89: Task.Supervised.invoke_mfa/2
        (elixir 1.14.2) lib/task/supervised.ex:34: Task.Supervised.reply/4
        (stdlib 4.1.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3

This minor PR helps fix this error to support playlists that still use the EXT-X-ALLOW-CACHE tag

cadebward commented 1 year ago

Thanks! 0.0.8 released