- getImdbEpisodeId = function(season, episode)
- openSub.actionLabel = "Searching episode id on IMDB"
- setMessage(openSub.actionLabel..": "..progressBarContent(0))
- local IMDBurl = "http://www.imdb.com/title/tt"..openSub.movie.imdbid.."/episodes/_ajax?season="..season
-
- local host, path = parse_url(IMDBurl)
-
- local stream = vlc.stream(IMDBurl)
- local data = ""
-
- while data do
- data = stream:read(65536)
- local id = string.match(data, 'data%-const="tt(%d+)"[^>]+>\r?\n<img[^>]+>\r?\n<div> S'..season..', Ep'..episode)
- return id
- end
- return false
- end,
- getImdbEpisodeIdYQL = function(season, episode)
- openSub.actionLabel = "Searching episode on IMDB"
- setMessage(openSub.actionLabel..": "..progressBarContent(0))
-
- local url = "http://pipes.yahoo.com/pipes/pipe.run?_id=5f525406f2b2b376eeb20b97a216bcb1&_render=json&imdbid="..openSub.movie.imdbid.."&season="..season.."&episode="..episode
- local host, path = parse_url(url)
- local header = {
- "GET "..path.." HTTP/1.1",
- "Host: "..host,
- "User-Agent: "..openSub.conf.userAgentHTTP,
- "",
- ""
- }
- local request = table.concat(header, "\r\n")
- local fd = vlc.net.connect_tcp(host, 80)
- local data = ""
- if fd >= 0 then
- local pollfds = {}
-
- pollfds[fd] = vlc.net.POLLIN
- vlc.net.send(fd, request)
- vlc.net.poll(pollfds)
-
- data = vlc.net.recv(fd, 2048)
- print(data)
- end
-
- setMessage(openSub.actionLabel..": "..progressBarContent(100))
-
- local id = string.match(data, '"content":"(%d+)"')
- return id
- end,
- getImdbEpisodeIdGoogle = function(season, episode, title)
- openSub.actionLabel = "Searching episode on IMDB"
- setMessage(openSub.actionLabel..": "..progressBarContent(0))
-
- local query = 'site:imdb.com tv episode "'..title..'" (#'..season..'.'..episode..')'
- local url = "https://www.google.com/uds/GwebSearch?hl=fr&source=gsc&gss=.com&gl=www.google.com&context=1&key=notsupplied&v=1.0&&q="..vlc.strings.encode_uri_component(query)
- local host, path = parse_url(url)
- local header = {
- "GET "..path.." HTTP/1.1",
- "Host: "..host,
- "User-Agent: "..openSub.conf.userAgentHTTP,
- "",
- ""
- }
- local request = table.concat(header, "\r\n")
- local fd = vlc.net.connect_tcp(host, 80)
- local data = ""
- if fd >= 0 then
- local pollfds = {}
-
- pollfds[fd] = vlc.net.POLLIN
- vlc.net.send(fd, request)
- vlc.net.poll(pollfds)
-
- data = vlc.net.recv(fd, 2048)
- --print(data)
- end
-
- setMessage(openSub.actionLabel..": "..progressBarContent(100))
-
- local id = string.match(data, '"url":"http://www.imdb.com/title/tt(%d+)/"')
- return id
- end,
- loadSubtitles = function(url, fileDir, SubFileName, target)