diff --git a/mandy.lua b/mandy.lua index edf49d5..5526dc6 100644 --- a/mandy.lua +++ b/mandy.lua @@ -6,7 +6,15 @@ require("iuplua") require("iupluacontrols") require('progress') -require('ffmpeg_progress') + +local function file_check(name) + local f=io.open(name, "r") + if f~=nil then io.close(f) + return true + else + return false + end +end --Main url entry box @@ -84,11 +92,17 @@ end function ytDl(x, y) --local tmpName = math.random(0,999999999999) --local tmpNameTwo = math.random(0,999999999999) - local thePath = set_dir() - local tmpPath = x.."--extract-audio --audio-format=mp3 -t --output="..thePath + + local tmpPath = " --extract-audio --audio-format=mp3 --output="..y.." "..x --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 @@ -117,7 +131,7 @@ end global.path = function(url, dir) local yt = ytDl(url, dir) - return yt + return end --global.ffmpeg = function(tmpPath, saveDir) diff --git a/progress.lua b/progress.lua index 321f358..1e59ef6 100644 --- a/progress.lua +++ b/progress.lua @@ -5,6 +5,7 @@ -- keep that in mind as well require ('iuplua') + local cancelflag --set variable local downloadProgress --set variable @@ -90,6 +91,9 @@ round up and only update if number has changed end until not c-- creating a loop until c is not true + + + pipe:close() -- closing the ipopen iup.Close() end