diff options
Diffstat (limited to 'smil.lua')
| -rw-r--r-- | smil.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/smil.lua b/smil.lua new file mode 100644 index 0000000..8fb7910 --- /dev/null +++ b/smil.lua @@ -0,0 +1,21 @@ +local utils = require 'mp.utils' +local msg = require 'mp.msg' +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 (smilurl == nil) then + msg.warn("Found smilurl, playing") + msg.warn(smilurl) + mp.set_property("stream-open-filename", smilurl) + end +end) |
