Fixed various cancle flags to act properly.
This commit is contained in:
11
progress.lua
11
progress.lua
@@ -34,7 +34,7 @@ end
|
||||
local function DL_progress(YtLink)
|
||||
downloadStart(YtLink)
|
||||
downloadProgress.value = 0
|
||||
local pipe = io.popen("youtube-dl " ..YtLink)
|
||||
local pipe = io.popen("youtube-dl " ..YtLink )
|
||||
repeat
|
||||
local c = pipe:read(20) -- read the first 20 characters of each line
|
||||
if c then
|
||||
@@ -49,7 +49,10 @@ local function DL_progress(YtLink)
|
||||
if cancelflag then
|
||||
iup.Message("Terminated", "You have canceled the download")
|
||||
iup.Flush()
|
||||
break
|
||||
pipe:close()
|
||||
iup.Flush()
|
||||
return false
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -60,10 +63,12 @@ local function DL_progress(YtLink)
|
||||
|
||||
until not c
|
||||
pipe:close()
|
||||
return true
|
||||
end
|
||||
|
||||
popin = {}
|
||||
popin.ytdl = function(tubeLink)
|
||||
DL_progress(tubeLink)
|
||||
local flag = DL_progress(tubeLink)
|
||||
if not flag then return false else return true end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user