now using youtube-dl itself to call ffmpeg

This commit is contained in:
silvernode 2013-07-26 18:53:45 -05:00
parent ffead88967
commit b0a076561b

View File

@ -81,20 +81,20 @@ function set_dir()
end end
function ytDl(x) function ytDl(x, y)
local tmpName = math.random(0,999999999999) --local tmpName = math.random(0,999999999999)
local tmpNameTwo = math.random(0,999999999999) --local tmpNameTwo = math.random(0,999999999999)
local tmpPath = x.." --output=/tmp/youtube-dl-"..tmpName.."-"..tmpNameTwo..".flv" local thePath = set_dir()
local tmpPath2 = "/tmp/youtube-dl-"..tmpName.."-"..tmpNameTwo..".flv" local tmpPath = x.."--extract-audio --audio-format=mp3 -t --output="..thePath
--local tmpPath2 = "/tmp/youtube-dl-"..tmpName.."-"..tmpNameTwo..".flv"
popin.ytdl(tmpPath) popin.ytdl(tmpPath)
io.popen("vlc "..y)
return
return tmpPath2
end end
function ffmpeg(tmpPath, dirD) --[[function ffmpeg(tmpPath, dirD)
local mp3 = "ffmpeg -i "..tmpPath.." -acodec libmp3lame -ac 2 -ab 192k -vn -y "..dirD local mp3 = "ffmpeg -i "..tmpPath.." -acodec libmp3lame -ac 2 -ab 192k -vn -y "..dirD
os.execute(mp3) os.execute(mp3)
@ -102,7 +102,7 @@ function ffmpeg(tmpPath, dirD)
io.popen("vlc "..dirD) io.popen("vlc "..dirD)
end end
--]]
--put everything into a table to use local functions globally --put everything into a table to use local functions globally
global = {} global = {}
global.url = function () global.url = function ()
@ -115,14 +115,14 @@ global.dir = function()
return dir return dir
end end
global.path = function(url) global.path = function(url, dir)
local yt = ytDl(url) local yt = ytDl(url, dir)
return yt return yt
end end
global.ffmpeg = function(tmpPath, saveDir) --global.ffmpeg = function(tmpPath, saveDir)
local convert = ffmpeg(tmpPath, saveDir) -- local convert = ffmpeg(tmpPath, saveDir)
return convert -- return convert
end --end