Merged in logen_kain (pull request #8)

Fixed your problem correctly
This commit is contained in:
Justin Moore 2013-07-30 14:18:18 -05:00
commit cea0ad69dc
5 changed files with 39 additions and 40 deletions

View File

@ -2,15 +2,16 @@ TODO:
key: + = to add, - = to remove, x = completed, # = comment key: + = to add, - = to remove, x = completed, # = comment
xAppend extensions to file name in save dialog unless exists
+Add option for multiple audio formats +Add option for multiple audio formats
+Dynamic libraries +Dynamic libraries
+Create custom url entry dialog +Create custom url entry dialog
xUrl validation
+Percentage in progress bar
+Replace spaces in file name with dashes/underscores
+Make cancel button exit in url dialog
+Create dialog asking to play finished file or not +Create dialog asking to play finished file or not
+Display current action in progressbar instead of youtube link itself +Fix FFMPEG MARQUEE bar
+Fix progress bar cancel button xMake cancel button exit in url dialog
xFix progress bar cancel button
xDisplay current action in progressbar instead of youtube link itself
xUrl validation
xplace spaces in file name with dashes/underscores
xAppend extensions to file name in save dialog unless exists
+Percentage in progress bar --- not possible with iUP
#possibly more later #possibly more later

View File

@ -42,19 +42,21 @@ local function DL_progress(YtLink)
if cancelflag then if cancelflag then
iup.Message("Terminated", "You have canceled the conversion") iup.Message("Terminated", "You have canceled the conversion")
iup.Flush() iup.Flush()
break pipe:close()
iup.Flush()
return false
end end
end end
until not c until not c
pipe:close() pipe:close()
iup.Close() iup.Close()
return return true
end end
convert_mp3 = {} convert_mp3 = {}
convert_mp3.go = function(tubeLink) convert_mp3.go = function(tubeLink)
DL_progress(tubeLink) local flag = DL_progress(tubeLink)
return if not flag then return false else return true end
end end

View File

@ -3,19 +3,15 @@ require("mandy")
function main() function main()
local url=global.url() local url=global.url()
if not url then if not url then return false end
return false
end
-- codec=sel_Codec() -- codec=sel_Codec()
local saveDir=global.dir() local saveDir=global.dir()
if saveDir == "23" then if not saveDir then return false end
return 0
end local tmpPath = global.path(url)
local tmpPath = global.path(url) if not tmpPath then return false end
local convert = global.ffmpeg(tmpPath, saveDir)
local convert = global.ffmpeg(tmpPath, saveDir)
end end
--initialize function "main" --initialize function "main"

View File

@ -38,7 +38,7 @@ function set_dir()
local status = getPath.status local status = getPath.status
if status == "1" then if status == "1" or status == "0" then
if string.match(getPath.value, "%.mp3") then if string.match(getPath.value, "%.mp3") then
local savedPath = getPath.value local savedPath = getPath.value
return savedPath return savedPath
@ -49,16 +49,8 @@ function set_dir()
end end
elseif status == "0" then
local savedPath = getPath.value
g_status = "23"
return savedPath, g_status
elseif status == "-1" then elseif status == "-1" then
g_status = "23" return false
return g_status
end end
end end
@ -68,14 +60,17 @@ function ytDl(x)
local tmpPath = x.." --output=/tmp/youtube-dl-"..tmpName.."-"..tmpNameTwo..".flv" local tmpPath = x.." --output=/tmp/youtube-dl-"..tmpName.."-"..tmpNameTwo..".flv"
local tmpPath2 = "/tmp/youtube-dl-"..tmpName.."-"..tmpNameTwo..".flv" local tmpPath2 = "/tmp/youtube-dl-"..tmpName.."-"..tmpNameTwo..".flv"
popin.ytdl(tmpPath) local flag = popin.ytdl(tmpPath)
if not flag then return false end
return tmpPath2 return tmpPath2
end end
function ffmpeg(tmpPath, dirD) function ffmpeg(tmpPath, dirD)
local subSpaces = string.gsub(dirD, " ", "\\") local subSpaces = string.gsub(dirD, " ", "\\ ")
local mp3 = "ffmpeg -i "..tmpPath.." -acodec libmp3lame -ac 2 -ab 192k -vn -y "..subSpaces local mp3 = "ffmpeg -i "..tmpPath.." -acodec libmp3lame -ac 2 -ab 192k -vn -y "..subSpaces
convert_mp3.go(mp3) local flag = convert_mp3.go(mp3)
if not flag then return false end
io.popen("notify-send 'The file was saved to' "..subSpaces) io.popen("notify-send 'The file was saved to' "..subSpaces)
io.popen("xdg-open "..subSpaces) io.popen("xdg-open "..subSpaces)
end end

View File

@ -34,7 +34,7 @@ end
local function DL_progress(YtLink) local function DL_progress(YtLink)
downloadStart(YtLink) downloadStart(YtLink)
downloadProgress.value = 0 downloadProgress.value = 0
local pipe = io.popen("youtube-dl " ..YtLink) local pipe = io.popen("youtube-dl " ..YtLink )
repeat repeat
local c = pipe:read(20) -- read the first 20 characters of each line local c = pipe:read(20) -- read the first 20 characters of each line
if c then if c then
@ -49,7 +49,10 @@ local function DL_progress(YtLink)
if cancelflag then if cancelflag then
iup.Message("Terminated", "You have canceled the download") iup.Message("Terminated", "You have canceled the download")
iup.Flush() iup.Flush()
break pipe:close()
iup.Flush()
return false
end end
end end
@ -60,10 +63,12 @@ local function DL_progress(YtLink)
until not c until not c
pipe:close() pipe:close()
return true
end end
popin = {} popin = {}
popin.ytdl = function(tubeLink) popin.ytdl = function(tubeLink)
DL_progress(tubeLink) local flag = DL_progress(tubeLink)
if not flag then return false else return true end
end end