diff --git a/configure.ac b/configure.ac index cead7db89..542e38872 100644 --- a/configure.ac +++ b/configure.ac @@ -316,6 +316,7 @@ data/pictures/backgrounds/Makefile data/pictures/screensaver/Makefile data/scripts/Makefile data/themes/Makefile +data/webtv/Makefile data/y-web/Makefile data/y-web/images/Makefile data/y-web/info/Makefile diff --git a/data/Makefile.am b/data/Makefile.am index 6c1c0e1cd..5c1b89d24 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -10,6 +10,7 @@ SUBDIRS = \ pictures \ scripts \ themes \ + webtv \ y-web if BOXTYPE_TRIPLE diff --git a/data/webtv/Makefile.am b/data/webtv/Makefile.am new file mode 100644 index 000000000..f55df6a7c --- /dev/null +++ b/data/webtv/Makefile.am @@ -0,0 +1,9 @@ +installdir = $(WEBTVDIR) + +install_DATA = \ + filmon.lua \ + filmon.xml \ + hdporntv.lua \ + hdporntv.xml \ + yt_live.lua \ + yt_live.xml diff --git a/data/webtv/filmon.lua b/data/webtv/filmon.lua new file mode 100644 index 000000000..61d118c7b --- /dev/null +++ b/data/webtv/filmon.lua @@ -0,0 +1,73 @@ +local n = neutrino(0, 0, SCREEN.X_RES, SCREEN.Y_RES); +n:checkVersion(1, 31); + +json = require "json" + +if #arg < 1 then return nil end +local _url = arg[1] +local ret = {} +local Curl = nil + +function getdata(Url) + if Url == nil then return nil end + if Curl == nil then + Curl = curl.new() + end + local ret, data = Curl:download{ url=Url, A="Mozilla/5.0"} + if ret == CURL.OK then + return data + else + return nil + end +end + +function getVideoData(url) + if url == nil then return 0 end + local data = getdata('http://www.filmon.com/tv/channel/info/' .. url) + if data == nil then return 0 end + + local data = json:decode(data) + if data==nil then return 0 end + data = data['data'] + if data==nil then return 0 end + + local title=data['title'] + if title==nil then name='nil' end + title=title .. ' - filmon' + + data = data['streams'] + if data==nil then return 0 end + + local highurl=nil + local lowurl=nil + local quality=nil + local surl=nil + for i,stream in ipairs(data) do + quality=stream['quality'] + surl=stream['url'] + if (quality=='high')or(quality=='HD') then + if (stream['watch-timeout']>=3600)and(surl:find('mustbeasubscriber')==nil) then + highurl = surl + end + elseif (quality=='low')or(quality=='SD') then + lowurl = surl + end + end + local count=0 + if highurl ~= nil then + --if lowurl ~= nil then highurl=lowurl:gsub('low.stream','high.stream') end + count = 1 + ret[1]={ url = highurl, band = "1500000", name = title, res1 = "854", res2 = "480" } + end + if lowurl ~= nil then + count = count+1 + ret[count]={ url = lowurl, band = "500000", name = title, res1 = "576", res2 = "322" } + end + return count +end + +if (getVideoData(_url) > 0) then + return json:encode(ret) +end + +return nil diff --git a/data/webtv/filmon.xml b/data/webtv/filmon.xml new file mode 100644 index 000000000..f57c54f3c --- /dev/null +++ b/data/webtv/filmon.xml @@ -0,0 +1,919 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/webtv/hdporntv.lua b/data/webtv/hdporntv.lua new file mode 100644 index 000000000..f23ff397b --- /dev/null +++ b/data/webtv/hdporntv.lua @@ -0,0 +1,66 @@ + +local n = neutrino(0, 0, SCREEN.X_RES, SCREEN.Y_RES); +M = misc.new(); M:checkVersion(1, 31) +json = require "json" + +if #arg < 1 then return nil end +local _url = arg[1] +local ret = {} +local Curl = nil + +function getdata(Url) + if Url == nil then return nil end + if Curl == nil then + Curl = curl.new() + end + local ret, data = Curl:download{ url=Url, ipv4=true, A="Mozilla/5.0 (Linux; Android 5.1.1; Nexus 4 Build/LMY48M)"} + if ret == CURL.OK then + return data + else + return nil + end +end + +function getVideoData(url) + local data = getdata(url) + local count = 0 + if data then + local title = data:match("(.-)") + local newname = url:match('tv/(.-)%.html') + local url_m3u8 = data:match('stream":%s+[\'"](.-%.m3u8)[\'"]') + if url_m3u8 then + entry = {} + entry['url'] = url_m3u8 + entry['band'] = "1" + entry['res1'] = "1" + entry['res2'] = "1" + entry['name'] = "xx" + local infodata = getdata(url_m3u8) + if infodata then + local band,res1,res2 = infodata:match('BANDWIDTH=(%d+),RESOLUTION=(%d+)x(%d+)') + if band and res1 and res2 then + entry['band'] = band + entry['res1'] = res1 + entry['res2'] = res2 + end + end + if newname then + entry['name'] = newname + end + if title then + entry['name'] = title + end + count = 1 + ret[count] = {} + ret[count] = entry + end + return count + end + return 0 +end + +if (getVideoData(_url) > 0) then + return json:encode(ret) +end + +return "" diff --git a/data/webtv/hdporntv.xml b/data/webtv/hdporntv.xml new file mode 100644 index 000000000..d2b12d5d8 --- /dev/null +++ b/data/webtv/hdporntv.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/data/webtv/yt_live.lua b/data/webtv/yt_live.lua new file mode 100644 index 000000000..74da6c7ff --- /dev/null +++ b/data/webtv/yt_live.lua @@ -0,0 +1,61 @@ + +json = require "json" + +if #arg < 1 then return nil end +local _url = arg[1] +local ret = {} +local Curl = nil + +function getdata(Url) + if Url == nil then return nil end + if Curl == nil then + Curl = curl.new() + end + local ret, data = Curl:download{ url=Url, A="Mozilla/5.0"} + if ret == CURL.OK then + return data + else + return nil + end +end + +function getVideoData(url) + if url == nil then return 0 end + local data = getdata(url) + if data then + local m3u_url = data:match('hlsvp.:.(https:\\.-m3u8)') + local newname = data:match('(.-)') + if m3u_url == nil then return 0 end + m3u_url = m3u_url:gsub("\\", "") + local videodata = getdata(m3u_url) + local url = "" + local band = "" + local res1 = "" + local res2 = "" + local count = 0 + for band, res1, res2, url in videodata:gmatch('#EXT.X.STREAM.INF.BANDWIDTH=(%d+).-RESOLUTION=(%d+)x(%d+).-(http.-)\n') do + if url ~= nil then + entry = {} + entry['url'] = url + entry['band'] = band + entry['res1'] = res1 + entry['res2'] = res2 + entry['name'] = "" + if newname then + entry['name'] = newname + end + count = count + 1 + ret[count] = {} + ret[count] = entry + end + end + return count + end + return 0 +end + +if (getVideoData(_url) > 0) then + return json:encode(ret) +end + +return "" diff --git a/data/webtv/yt_live.xml b/data/webtv/yt_live.xml new file mode 100644 index 000000000..50184397e --- /dev/null +++ b/data/webtv/yt_live.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + +