From c374891fa8118d31ca82fe6ac247aab800b268f9 Mon Sep 17 00:00:00 2001 From: silvernode Date: Fri, 26 Jul 2013 21:07:19 -0500 Subject: [PATCH] reverted back to original --- main.lua | 4 ++-- mandy.lua | 36 +++++++++++++++--------------------- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/main.lua b/main.lua index 48a8018..4b3e63d 100755 --- a/main.lua +++ b/main.lua @@ -8,8 +8,8 @@ function main() if saveDir == "23" then return 0 end - global.path(url, saveDir) - --local convert = global.ffmpeg(tmpPath, saveDir) + local tmpPath = global.path(url) + local convert = global.ffmpeg(tmpPath, saveDir) end diff --git a/mandy.lua b/mandy.lua index 5526dc6..e7fc319 100644 --- a/mandy.lua +++ b/mandy.lua @@ -89,26 +89,20 @@ function set_dir() end -function ytDl(x, y) - --local tmpName = math.random(0,999999999999) - --local tmpNameTwo = math.random(0,999999999999) +function ytDl(x) + local tmpName = math.random(0,999999999999) + local tmpNameTwo = math.random(0,999999999999) - local tmpPath = " --extract-audio --audio-format=mp3 --output="..y.." "..x - --local tmpPath2 = "/tmp/youtube-dl-"..tmpName.."-"..tmpNameTwo..".flv" + local tmpPath = x.." --extract-audio --audio-format=mp3 --output="..tmpName.."-"..tmpNameTwo..".flv" + local tmpPath2 = "/tmp/youtube-dl-"..tmpName.."-"..tmpNameTwo..".flv" popin.ytdl(tmpPath) - repeat - io.write("w/e\n") -until file_check(/usr/var/ffmpeg) - - - io.popen("vlc "..y) - return + return tmpPath2 end ---[[function ffmpeg(tmpPath, dirD) +function ffmpeg(tmpPath, dirD) local mp3 = "ffmpeg -i "..tmpPath.." -acodec libmp3lame -ac 2 -ab 192k -vn -y "..dirD os.execute(mp3) @@ -116,7 +110,7 @@ end io.popen("vlc "..dirD) end ---]] + --put everything into a table to use local functions globally global = {} global.url = function () @@ -129,14 +123,14 @@ global.dir = function() return dir end -global.path = function(url, dir) - local yt = ytDl(url, dir) - return +global.path = function(url) + local yt = ytDl(url) + return yt end ---global.ffmpeg = function(tmpPath, saveDir) --- local convert = ffmpeg(tmpPath, saveDir) --- return convert ---end +global.ffmpeg = function(tmpPath, saveDir) + local convert = ffmpeg(tmpPath, saveDir) + return convert +end