fixed merge conflict
This commit is contained in:
commit
1e22255804
@ -28,6 +28,7 @@ dependancies.
|
|||||||
|
|
||||||
|
|
||||||
- lua 5.2
|
- lua 5.2
|
||||||
|
- libfreetype6-dev (ubuntu)
|
||||||
- youtube-dl
|
- youtube-dl
|
||||||
- ffmpeg
|
- ffmpeg
|
||||||
- vlc (temporary)
|
- vlc (temporary)
|
||||||
@ -218,3 +219,6 @@ Thanks!
|
|||||||
[7]: http://sourceforge.net/projects/imtoolkit/files/
|
[7]: http://sourceforge.net/projects/imtoolkit/files/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,62 +1,47 @@
|
|||||||
-- take note of YtLink, I keep passing it around in order to show it as the title bar
|
|
||||||
-- of the download window, YOU WILL HAVE TO PAY ATTENTION TO IT
|
|
||||||
-- IT GOES THROUGH FUCKING EVERYTHING
|
|
||||||
-- Also it will be replaced by what the user saves the file as
|
|
||||||
-- keep that in mind as well
|
|
||||||
require ('iuplua')
|
require ('iuplua')
|
||||||
|
|
||||||
local cancelflag --set variable
|
local cancelflag
|
||||||
local downloadProgress --set variable
|
local downloadProgress
|
||||||
|
|
||||||
local function downloadStart(YtLink) --create button and cancle flag
|
local function downloadStart(YtLink)
|
||||||
cancelButton = iup.button{
|
cancelButton = iup.button{
|
||||||
title = "Cancel",
|
title = "Cancel",
|
||||||
action = function()
|
action = function()
|
||||||
cancelflag = true
|
cancelflag = true
|
||||||
|
end
|
||||||
--return iup.CLOSE --not sure if needed
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
}
|
}
|
||||||
local downloadProgress = iup.progressbar{expand="HORIZONTAL", MARQUEE="YES"}
|
local downloadProgress = iup.progressbar{expand="HORIZONTAL", MARQUEE="YES"}
|
||||||
local dlgProgress = iup.dialog{ --create main window
|
local dlgProgress = iup.dialog{
|
||||||
title = YtLink,
|
title = "converting",
|
||||||
dialogframe = "YES", border = "YES",
|
dialogframe = "YES", border = "YES",
|
||||||
iup.vbox { -- create vbox that contains said objects
|
iup.vbox {
|
||||||
downloadProgress,
|
downloadProgress,
|
||||||
cancelButton,
|
cancelButton,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dlgProgress.size = "QUARTERxEIGHT" --should be size of dialog box
|
dlgProgress.size = "QUARTERxEIGHT"
|
||||||
-- dlgProgress.menubox = "NO" -- no windows menus
|
dlgProgress.menubox = "NO"
|
||||||
dlgProgress.close_cb = cancelButton.action -- calls the action of the button
|
dlgProgress.close_cb = cancelButton.action
|
||||||
dlgProgress:showxy(iup.CENTER, iup.CENTER) -- show and position box
|
dlgProgress:showxy(iup.CENTER, iup.CENTER)
|
||||||
return dlgProgress
|
return dlgProgress
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function DL_progress(YtLink) -- monitor download progress
|
local function DL_progress(YtLink)
|
||||||
downloadStart(YtLink) -- start the progress bar
|
downloadStart()
|
||||||
-- downloadProgress.value = 0
|
local pipe = io.popen(YtLink)
|
||||||
-- local pipe = io.popen(YtLink)
|
--os.execute(YtLink)
|
||||||
os.execute(YtLink)
|
|
||||||
--[[repeat
|
|
||||||
local c = pipe:read() -- read the first 20 characters of each line
|
|
||||||
if c then -- if c is true then...
|
|
||||||
|
|
||||||
--downloadProgress.value = c/100 -- x out of 100
|
repeat
|
||||||
-- in this case x is the progress
|
local c = pipe:read()
|
||||||
-- data we grabbed
|
if c then
|
||||||
iup.Flush() -- speeds everything up considerably
|
|
||||||
-- when changing an attribute of an element, the change may not
|
|
||||||
-- take place immediately
|
|
||||||
-- in that case throw in a flush after the change
|
|
||||||
|
|
||||||
iup.LoopStep() -- required to work, also allows user to click button
|
iup.Flush()
|
||||||
iup.Flush() -- added this second flush... helps a shit ton
|
|
||||||
if cancelflag then -- if cancelflag is true, then break
|
iup.LoopStep()
|
||||||
-- which happens if you click the button
|
iup.Flush()
|
||||||
|
if cancelflag then
|
||||||
|
|
||||||
iup.Message("Terminated", "You have canceled the conversion")
|
iup.Message("Terminated", "You have canceled the conversion")
|
||||||
iup.Flush()
|
iup.Flush()
|
||||||
@ -69,21 +54,16 @@ local function DL_progress(YtLink) -- monitor download progress
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
until not c-- creating a loop until c is not true
|
until not c
|
||||||
pipe:close() -- closing the ipopen--]]
|
pipe:close()
|
||||||
iup.Close()
|
iup.Close()
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
convert_mp3 = {}
|
convert_mp3 = {}
|
||||||
convert_mp3.go = function(tubeLink)
|
convert_mp3.go = function(tubeLink)
|
||||||
DL_progress(tubeLink)
|
DL_progress(tubeLink)
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
--if you can have your script call this one and insert the link to YtLink... win
|
|
||||||
|
|
||||||
--local YtLink = ('http://www.youtube.com/watch?v=jrmlums5bV8')
|
|
||||||
|
|
||||||
|
|
||||||
--DL_progress( YtLink)
|
|
||||||
|
|
||||||
|
|
||||||
|
4
main.lua
4
main.lua
@ -3,6 +3,10 @@ require("mandy")
|
|||||||
|
|
||||||
function main()
|
function main()
|
||||||
local url=global.url()
|
local url=global.url()
|
||||||
|
if not url then
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
-- codec=sel_Codec()
|
-- codec=sel_Codec()
|
||||||
local saveDir=global.dir()
|
local saveDir=global.dir()
|
||||||
if saveDir == "23" then
|
if saveDir == "23" then
|
||||||
|
24
mandy.lua
24
mandy.lua
@ -9,23 +9,31 @@ require('progress')
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--Main url entry box
|
--Main url entry box
|
||||||
function url_entry()
|
function url_entry()
|
||||||
|
|
||||||
res, url = iup.GetParam("Mandy 0.2 - Enter URL", nil,
|
res, url = iup.GetParam("Mandy 0.2 - Enter URL", nil,
|
||||||
"Enter Youtube URL: %s\n", "")
|
"Enter Youtube URL: %s\n", "")
|
||||||
if string.match(url, "youtube.com/watch") then
|
|
||||||
return url
|
if res == true then
|
||||||
|
if string.match(url, "youtube.com/watch") then
|
||||||
|
return url
|
||||||
|
|
||||||
|
else
|
||||||
|
iup.Message("Error", "The URL is not a youtube link")
|
||||||
|
iup.Flush()
|
||||||
|
iup.Close()
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
else
|
else
|
||||||
iup.Message("Error", "The URL is not a youtube link")
|
return false
|
||||||
iup.Flush()
|
|
||||||
iup.Close()
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -97,8 +105,8 @@ function ffmpeg(tmpPath, dirD)
|
|||||||
|
|
||||||
local mp3 = "ffmpeg -i "..tmpPath.." -acodec libmp3lame -ac 2 -ab 192k -vn -y "..dirD
|
local mp3 = "ffmpeg -i "..tmpPath.." -acodec libmp3lame -ac 2 -ab 192k -vn -y "..dirD
|
||||||
os.execute(mp3)
|
os.execute(mp3)
|
||||||
-- convert_mp3.go(mp3)
|
convert_mp3.go(mp3)
|
||||||
io.popen("notify-send 'File saved to' "..dirD)
|
io.popen("vlc "..dirD)
|
||||||
|
|
||||||
end
|
end
|
||||||
--put everything into a table to use local functions globally
|
--put everything into a table to use local functions globally
|
||||||
|
@ -91,7 +91,7 @@ round up and only update if number has changed
|
|||||||
|
|
||||||
until not c-- creating a loop until c is not true
|
until not c-- creating a loop until c is not true
|
||||||
pipe:close() -- closing the ipopen
|
pipe:close() -- closing the ipopen
|
||||||
iup.Close()
|
--iup.Close()
|
||||||
end
|
end
|
||||||
|
|
||||||
popin = {}
|
popin = {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user