Cleaned code, fixed spaceing

This commit is contained in:
Logen Kain
2013-07-27 11:51:07 -05:00
parent c573c46553
commit f2e401c7c7
3 changed files with 129 additions and 208 deletions

View File

@@ -4,66 +4,57 @@ local cancelflag
local downloadProgress
local function downloadStart(YtLink)
cancelButton = iup.button{
title = "Cancel",
action = function()
cancelflag = true
end
cancelButton = iup.button{
title = "Cancel",
action = function()
cancelflag = true
end
}
local downloadProgress = iup.progressbar{expand="HORIZONTAL", MARQUEE="YES"}
local dlgProgress = iup.dialog{
title = "converting",
dialogframe = "YES", border = "YES",
iup.vbox {
downloadProgress,
cancelButton,
}
local downloadProgress = iup.progressbar{expand="HORIZONTAL", MARQUEE="YES"}
local dlgProgress = iup.dialog{
title = "converting",
dialogframe = "YES", border = "YES",
iup.vbox {
downloadProgress,
cancelButton,
}
}
dlgProgress.size = "QUARTERxEIGHT"
dlgProgress.menubox = "NO"
dlgProgress.close_cb = cancelButton.action
dlgProgress:showxy(iup.CENTER, iup.CENTER)
return dlgProgress
}
dlgProgress.size = "QUARTERxEIGHT"
dlgProgress.menubox = "NO"
dlgProgress.close_cb = cancelButton.action
dlgProgress:showxy(iup.CENTER, iup.CENTER)
return dlgProgress
end
local function DL_progress(YtLink)
downloadStart()
local pipe = io.popen(YtLink)
--os.execute(YtLink)
repeat
local c = pipe:read()
if c then
iup.Flush()
iup.LoopStep()
iup.Flush()
if cancelflag then
iup.Message("Terminated", "You have canceled the conversion")
iup.Flush()
break
end
end
until not c
pipe:close()
iup.Close()
return
downloadStart()
local pipe = io.popen(YtLink)
repeat
local c = pipe:read()
if c then
iup.Flush()
iup.LoopStep()
iup.Flush()
if cancelflag then
iup.Message("Terminated", "You have canceled the conversion")
iup.Flush()
break
end
end
until not c
pipe:close()
iup.Close()
return
end
convert_mp3 = {}
convert_mp3.go = function(tubeLink)
DL_progress(tubeLink)
return
end
end