summaryrefslogtreecommitdiff
path: root/smil.lua
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2018-06-16 12:45:28 +0300
committerYuval Adam <_@yuv.al>2018-06-16 12:45:28 +0300
commit08c56d5ab32ec29ed70edd0e871d7324f3878618 (patch)
tree29f8218b067cdb47ab595248939e0933e95d8522 /smil.lua
parent3c5ad441658e2f98112c8decfe05bb0b4b738265 (diff)
Skip non-HTTP streamsHEADmaster
Diffstat (limited to 'smil.lua')
-rw-r--r--smil.lua25
1 files changed, 14 insertions, 11 deletions
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, '<SmilURL name="default">(.*)</SmilURL>')
+ 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, '<SmilURL name="default">(.*)</SmilURL>')
+
+ if not (smilurl == nil) then
+ msg.warn("Found smilurl, playing")
+ msg.warn(smilurl)
+ mp.set_property("stream-open-filename", smilurl)
+ end
end
end)