From 08c56d5ab32ec29ed70edd0e871d7324f3878618 Mon Sep 17 00:00:00 2001
From: Yuval Adam <_@yuv.al>
Date: Sat, 16 Jun 2018 12:45:28 +0300
Subject: Skip non-HTTP streams
---
smil.lua | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
(limited to 'smil.lua')
diff --git a/smil.lua b/smil.lua
index 8fb7910..030e19b 100644
--- a/smil.lua
+++ b/smil.lua
@@ -4,18 +4,21 @@ local options = require 'mp.options'
mp.add_hook("on_load" or "on_load_fail", 50, function ()
local url = mp.get_property("stream-open-filename", "")
- msg.warn("Attempting to fetch SMIL")
- msg.error(url)
- res = utils.subprocess({
- args = {"curl", "-s", url}
- })
- body = res["stdout"]
- smilurl = string.match(body, '(.*)')
+ if not (string.match(url, '^http') == nil) then
+ msg.warn("Attempting to fetch SMIL")
+ msg.error(url)
- if not (smilurl == nil) then
- msg.warn("Found smilurl, playing")
- msg.warn(smilurl)
- mp.set_property("stream-open-filename", smilurl)
+ res = utils.subprocess({
+ args = {"curl", "-s", url}
+ })
+ body = res["stdout"]
+ smilurl = string.match(body, '(.*)')
+
+ if not (smilurl == nil) then
+ msg.warn("Found smilurl, playing")
+ msg.warn(smilurl)
+ mp.set_property("stream-open-filename", smilurl)
+ end
end
end)
--
cgit v1.3.1