Cleaned code, fixed spaceing
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user