prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  plugins.btv: No playable streams found
  ### Checklist
  
  - [X] This is a [plugin issue](https://streamlink.github.io/plugins.html) and not [a different kind of issue](https://github.com/streamlink/streamlink/issues/new/choose)
  - [X] [I have read the contribution guidelines](https://github.com/streamlink/streamlink/blob/master/CONTRIBUTING.md#contributing-to-streamlink)
  - [X] [I have checked the list of open and recently closed plugin issues](https://github.com/streamlink/streamlink/issues?q=is%3Aissue+label%3A%22plugin+issue%22)
  - [X] [I have checked the commit log of the master branch](https://github.com/streamlink/streamlink/commits/master)
  
  ### Streamlink version
  
  Your Streamlink version (6.4.2+1.g7e722ec1) is up to date!
  
  ### Description
  
  The plug-in does not display video. It displays errors shown in the logs below.
  
  
  ### Debug log
  
  ```text
  streamlink --loglevel=debug "https://btvplus.bg/live/" best
  [cli][debug] OS:         Linux-6.2.0-35-generic-x86_64-with-glibc2.35
  [cli][debug] Python:     3.10.12
  [cli][debug] OpenSSL:    OpenSSL 3.0.2 15 Mar 2022
  [cli][debug] Streamlink: 6.4.2+1.g7e722ec1
  [cli][debug] Dependencies:
  [cli][debug]  certifi: 2023.5.7
  [cli][debug]  isodate: 0.6.1
  [cli][debug]  lxml: 4.8.0
  [cli][debug]  pycountry: 20.7.3
  [cli][debug]  pycryptodome: 3.17
  [cli][debug]  PySocks: 1.7.1
  [cli][debug]  requests: 2.31.0
  [cli][debug]  trio: 0.22.2
  [cli][debug]  trio-websocket: 0.10.3
  [cli][debug]  typing-extensions: 4.7.1
  [cli][debug]  urllib3: 1.26.16
  [cli][debug]  websocket-client: 1.2.3
  [cli][debug] Arguments:
  [cli][debug]  url=https://btvplus.bg/live/
  [cli][debug]  stream=['best']
  [cli][debug]  --loglevel=debug
  [cli][info] Found matching plugin btv for URL https://btvplus.bg/live/
  [cli][info] Available streams: live (worst, best)
  [cli][info] Opening stream: live (hls)
  [cli][info] Starting player: /usr/bin/vlc
  [stream.hls][debug] Reloading playlist
  [cli][debug] Pre-buffering 8192 bytes
  [stream.hls][error] Attempted to play a variant playlist, use 'hls://https://cdn.bweb.bg/live/PhRBlmfjy0uVGxaj1_BMiw/1701627017/61065646.m3u8' instead
  [stream.segmented][debug] Closing worker thread
  [stream.segmented][debug] Closing writer thread
  [cli][error] Try 1/1: Could not open stream <HLSStream ['hls', 'https://cdn.bweb.bg/live/PhRBlmfjy0uVGxaj1_BMiw/1701627017/61065646.m3u8']> (No data returned from stream)
  error: Could not open stream <HLSStream ['hls', 'https://cdn.bweb.bg/live/PhRBlmfjy0uVGxaj1_BMiw/1701627017/61065646.m3u8']>, tried 1 times, exiting
  [cli][info] Closing currently open stream...
  ```
  
  
  </issue>
  <code>
  [start of src/streamlink/plugins/btv.py]
  1 """
  2 $description A privately owned Bulgarian live TV channel.
  3 $url btvplus.bg
  4 $type live
  5 $region Bulgaria
  6 """
  7 
  8 import logging
  9 import re
  10 
  11 from streamlink.plugin import Plugin, pluginmatcher
  12 from streamlink.plugin.api import validate
  13 from streamlink.stream.hls import HLSStream
  14 
  15 
  16 log = logging.getLogger(__name__)
  17 
  18 
  19 @pluginmatcher(re.compile(
  20     r"https?://(?:www\.)?btvplus\.bg/live/?",
  21 ))
  22 class BTV(Plugin):
  23     URL_API = "https://btvplus.bg/lbin/v3/btvplus/player_config.php"
  24 
  25     def _get_streams(self):
  26         media_id = self.session.http.get(self.url, schema=validate.Schema(
  27             re.compile(r"media_id=(\d+)"),
  28             validate.any(None, validate.get(1)),
  29         ))
  30         if media_id is None:
  31             return
  32 
  33         stream_url = self.session.http.get(
  34             self.URL_API,
  35             params={
  36                 "media_id": media_id,
  37             },
  38             schema=validate.Schema(
  39                 validate.any(
  40                     validate.all(
  41                         validate.regex(re.compile(r"geo_blocked_stream")),
  42                         validate.get(0),
  43                     ),
  44                     validate.all(
  45                         validate.parse_json(),
  46                         {
  47                             "status": "ok",
  48                             "info": {
  49                                 "file": validate.url(path=validate.endswith(".m3u8")),
  50                             },
  51                         },
  52                         validate.get(("info", "file")),
  53                     ),
  54                 ),
  55             ),
  56         )
  57         if not stream_url:
  58             return
  59 
  60         if stream_url == "geo_blocked_stream":
  61             log.error("The content is not available in your region")
  62             return
  63 
  64         return {"live": HLSStream(self.session, stream_url)}
  65 
  66 
  67 __plugin__ = BTV
  68
  [end of src/streamlink/plugins/btv.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/src/streamlink/plugins/btv.py b/src/streamlink/plugins/btv.py
  --- a/src/streamlink/plugins/btv.py
  +++ b/src/streamlink/plugins/btv.py
  @@ -61,7 +61,7 @@
               log.error("The content is not available in your region")
               return
   
  -        return {"live": HLSStream(self.session, stream_url)}
  +        return HLSStream.parse_variant_playlist(self.session, stream_url)
   
   
   __plugin__ = BTV
  
verification_info: {"golden_diff": "diff --git a/src/streamlink/plugins/btv.py b/src/streamlink/plugins/btv.py\n--- a/src/streamlink/plugins/btv.py\n+++ b/src/streamlink/plugins/btv.py\n@@ -61,7 +61,7 @@\n             log.error(\"The content is not available in your region\")\n             return\n \n-        return {\"live\": HLSStream(self.session, stream_url)}\n+        return HLSStream.parse_variant_playlist(self.session, stream_url)\n \n \n __plugin__ = BTV\n", "issue": "plugins.btv: No playable streams found\n### Checklist\n\n- [X] This is a [plugin issue](https://streamlink.github.io/plugins.html) and not [a different kind of issue](https://github.com/streamlink/streamlink/issues/new/choose)\n- [X] [I have read the contribution guidelines](https://github.com/streamlink/streamlink/blob/master/CONTRIBUTING.md#contributing-to-streamlink)\n- [X] [I have checked the list of open and recently closed plugin issues](https://github.com/streamlink/streamlink/issues?q=is%3Aissue+label%3A%22plugin+issue%22)\n- [X] [I have checked the commit log of the master branch](https://github.com/streamlink/streamlink/commits/master)\n\n### Streamlink version\n\nYour Streamlink version (6.4.2+1.g7e722ec1) is up to date!\n\n### Description\n\nThe plug-in does not display video. It displays errors shown in the logs below.\r\n\n\n### Debug log\n\n```text\nstreamlink --loglevel=debug \"https://btvplus.bg/live/\" best\r\n[cli][debug] OS:         Linux-6.2.0-35-generic-x86_64-with-glibc2.35\r\n[cli][debug] Python:     3.10.12\r\n[cli][debug] OpenSSL:    OpenSSL 3.0.2 15 Mar 2022\r\n[cli][debug] Streamlink: 6.4.2+1.g7e722ec1\r\n[cli][debug] Dependencies:\r\n[cli][debug]  certifi: 2023.5.7\r\n[cli][debug]  isodate: 0.6.1\r\n[cli][debug]  lxml: 4.8.0\r\n[cli][debug]  pycountry: 20.7.3\r\n[cli][debug]  pycryptodome: 3.17\r\n[cli][debug]  PySocks: 1.7.1\r\n[cli][debug]  requests: 2.31.0\r\n[cli][debug]  trio: 0.22.2\r\n[cli][debug]  trio-websocket: 0.10.3\r\n[cli][debug]  typing-extensions: 4.7.1\r\n[cli][debug]  urllib3: 1.26.16\r\n[cli][debug]  websocket-client: 1.2.3\r\n[cli][debug] Arguments:\r\n[cli][debug]  url=https://btvplus.bg/live/\r\n[cli][debug]  stream=['best']\r\n[cli][debug]  --loglevel=debug\r\n[cli][info] Found matching plugin btv for URL https://btvplus.bg/live/\r\n[cli][info] Available streams: live (worst, best)\r\n[cli][info] Opening stream: live (hls)\r\n[cli][info] Starting player: /usr/bin/vlc\r\n[stream.hls][debug] Reloading playlist\r\n[cli][debug] Pre-buffering 8192 bytes\r\n[stream.hls][error] Attempted to play a variant playlist, use 'hls://https://cdn.bweb.bg/live/PhRBlmfjy0uVGxaj1_BMiw/1701627017/61065646.m3u8' instead\r\n[stream.segmented][debug] Closing worker thread\r\n[stream.segmented][debug] Closing writer thread\r\n[cli][error] Try 1/1: Could not open stream <HLSStream ['hls', 'https://cdn.bweb.bg/live/PhRBlmfjy0uVGxaj1_BMiw/1701627017/61065646.m3u8']> (No data returned from stream)\r\nerror: Could not open stream <HLSStream ['hls', 'https://cdn.bweb.bg/live/PhRBlmfjy0uVGxaj1_BMiw/1701627017/61065646.m3u8']>, tried 1 times, exiting\r\n[cli][info] Closing currently open stream...\n```\n\n", "before_files": [{"content": "\"\"\"\n$description A privately owned Bulgarian live TV channel.\n$url btvplus.bg\n$type live\n$region Bulgaria\n\"\"\"\n\nimport logging\nimport re\n\nfrom streamlink.plugin import Plugin, pluginmatcher\nfrom streamlink.plugin.api import validate\nfrom streamlink.stream.hls import HLSStream\n\n\nlog = logging.getLogger(__name__)\n\n\n@pluginmatcher(re.compile(\n    r\"https?://(?:www\\.)?btvplus\\.bg/live/?\",\n))\nclass BTV(Plugin):\n    URL_API = \"https://btvplus.bg/lbin/v3/btvplus/player_config.php\"\n\n    def _get_streams(self):\n        media_id = self.session.http.get(self.url, schema=validate.Schema(\n            re.compile(r\"media_id=(\\d+)\"),\n            validate.any(None, validate.get(1)),\n        ))\n        if media_id is None:\n            return\n\n        stream_url = self.session.http.get(\n            self.URL_API,\n            params={\n                \"media_id\": media_id,\n            },\n            schema=validate.Schema(\n                validate.any(\n                    validate.all(\n                        validate.regex(re.compile(r\"geo_blocked_stream\")),\n                        validate.get(0),\n                    ),\n                    validate.all(\n                        validate.parse_json(),\n                        {\n                            \"status\": \"ok\",\n                            \"info\": {\n                                \"file\": validate.url(path=validate.endswith(\".m3u8\")),\n                            },\n                        },\n                        validate.get((\"info\", \"file\")),\n                    ),\n                ),\n            ),\n        )\n        if not stream_url:\n            return\n\n        if stream_url == \"geo_blocked_stream\":\n            log.error(\"The content is not available in your region\")\n            return\n\n        return {\"live\": HLSStream(self.session, stream_url)}\n\n\n__plugin__ = BTV\n", "path": "src/streamlink/plugins/btv.py"}]}