Merged in silvernode (pull request #9)
Implemented audio format selection for mp3, ogg, and flac
This commit is contained in:
commit
d7d3cc53bf
10
README.md
10
README.md
@ -1,4 +1,5 @@
|
||||
#Mandy
|
||||
#Mandy - current version: 0.5.0
|
||||
|
||||
|
||||
##About
|
||||
|
||||
@ -20,6 +21,8 @@ Current platforms: Linux(x86/x64)
|
||||
|
||||
![progressbar][4]
|
||||
|
||||
![converting][8]
|
||||
|
||||
|
||||
##Installation
|
||||
|
||||
@ -212,11 +215,12 @@ Thanks!
|
||||
|
||||
[1]: http://lua.org
|
||||
[2]: http://www.tecgraf.puc-rio.br/iup/
|
||||
[3]: http://i.imgur.com/ol0ZRUp.png
|
||||
[4]: http://i.imgur.com/wpoVeXZ.png
|
||||
[3]: http://i.imgur.com/P2rMTiM.png
|
||||
[4]: http://i.imgur.com/1AcLZk6.png
|
||||
[5]: http://sourceforge.net/projects/iup/files/
|
||||
[6]: http://sourceforge.net/projects/canvasdraw/files/
|
||||
[7]: http://sourceforge.net/projects/imtoolkit/files/
|
||||
[8]: http://i.imgur.com/XrmwZrX.png
|
||||
|
||||
|
||||
|
||||
|
2
TODO.txt
2
TODO.txt
@ -2,7 +2,7 @@ TODO:
|
||||
|
||||
key: + = to add, - = to remove, x = completed, # = comment
|
||||
|
||||
+Add option for multiple audio formats
|
||||
xAdd option for multiple audio formats
|
||||
+Dynamic libraries
|
||||
+Create custom url entry dialog
|
||||
+Create dialog asking to play finished file or not
|
||||
|
17
changelog.txt
Normal file
17
changelog.txt
Normal file
@ -0,0 +1,17 @@
|
||||
***CHANGELOG***
|
||||
|
||||
|
||||
Version 0.5.0 (7-31-13)
|
||||
*added audio format selection for mp3. ogg, and flac
|
||||
-autoplay has been removed, users now play files manually
|
||||
|
||||
Version 0.4 (7-27-13)
|
||||
|
||||
+ fixed media player error when opening finished file
|
||||
+ fixed .mp3 validation
|
||||
+ cancel button now works properly in url entry box
|
||||
* added progress bar for conversion process
|
||||
* added push notifications
|
||||
* files now open with default media player not vlc
|
||||
|
||||
|
71
mandy.lua
71
mandy.lua
@ -7,8 +7,13 @@ require('ffmpeg_progress')
|
||||
|
||||
--Main url entry box
|
||||
function url_entry()
|
||||
res, url = iup.GetParam("Mandy 0.4 - Enter URL", nil,
|
||||
"Enter Youtube URL: %s\n", "")
|
||||
local url = ""
|
||||
local format = 0
|
||||
res, url, format = iup.GetParam("Mandy 0.5.0 - Enter URL", nil,
|
||||
"Enter Youtube URL: %s\n"..
|
||||
"Select an audio format: %l|mp3|ogg|flac|\n", url, format)
|
||||
|
||||
gFormat = sel_Codec(format)
|
||||
if res == true then
|
||||
if string.match(url, "youtube.com/watch") then
|
||||
return url
|
||||
@ -23,28 +28,43 @@ function url_entry()
|
||||
end
|
||||
|
||||
|
||||
--Ask user to select a codec
|
||||
function sel_Codec()
|
||||
--make format dropdown menu items work
|
||||
function sel_Codec(x)
|
||||
if x == 0 then
|
||||
local mp3 = ".mp3"
|
||||
print("Selected "..mp3)
|
||||
return mp3
|
||||
elseif x == 1 then
|
||||
local ogg = ".ogg"
|
||||
print("Selected "..ogg)
|
||||
return ogg
|
||||
elseif x == 2 then
|
||||
local flac = ".flac"
|
||||
print("Selected "..flac)
|
||||
return flac
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--Ask user to set directory
|
||||
function set_dir()
|
||||
|
||||
getPath = iup.filedlg{dialogtype = "SAVE", title="Save file...",
|
||||
filter="*.mp3", filterinfo="mp3",
|
||||
filter="*.mp3; *.ogg; *.flac",
|
||||
directory=".",
|
||||
file="*.mp3"}
|
||||
file=""}
|
||||
|
||||
getPath:popup(iup.ANYWHERE, iup.ANYWHERE)
|
||||
|
||||
local status = getPath.status
|
||||
|
||||
if status == "1" or status == "0" then
|
||||
if string.match(getPath.value, "%.mp3") then
|
||||
if string.match(getPath.value, "%"..gFormat) then
|
||||
local savedPath = getPath.value
|
||||
return savedPath
|
||||
|
||||
else
|
||||
local savedPath = getPath.value..".mp3"
|
||||
local savedPath = getPath.value..gFormat
|
||||
return savedPath
|
||||
|
||||
end
|
||||
@ -66,13 +86,40 @@ function ytDl(x)
|
||||
return tmpPath2
|
||||
end
|
||||
|
||||
--optional function to implement autoplay
|
||||
function ask_play(x)
|
||||
play = ""
|
||||
res, play = iup.GetParam("Play now?", nil,
|
||||
"Do you want to play the file now? %t\n", play)
|
||||
|
||||
if res == true then
|
||||
io.popen("notify-send 'The file was saved to' "..x)
|
||||
io.popen("xdg-open "..x)
|
||||
else
|
||||
return false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
function ffmpeg(tmpPath, dirD)
|
||||
local subSpaces = string.gsub(dirD, " ", "\\ ")
|
||||
local mp3 = "ffmpeg -i "..tmpPath.." -acodec libmp3lame -ac 2 -ab 192k -vn -y "..subSpaces
|
||||
|
||||
local subSpaces = string.gsub(dirD, " ", "\\ ")
|
||||
local mp3 = "ffmpeg -i "..tmpPath.." -acodec libmp3lame -ac 2 -ab 192k -vn -y "..subSpaces
|
||||
local ogg = "ffmpeg -i "..tmpPath.." -acodec libvorbis -ac 2 -ab 192k -vn -y "..subSpaces
|
||||
local flac = "ffmpeg -i "..tmpPath.." -acodec flac -ac 2 -ab 192k -vn -y "..subSpaces
|
||||
|
||||
if gFormat == ".mp3" then
|
||||
local flag = convert_mp3.go(mp3)
|
||||
if not flag then return false end
|
||||
elseif gFormat == ".ogg" then
|
||||
local flag = convert_mp3.go(ogg)
|
||||
elseif gFormat == ".flac" then
|
||||
local flag = convert_mp3.go(flac)
|
||||
else
|
||||
if not flag then return false end
|
||||
|
||||
end
|
||||
io.popen("notify-send 'The file was saved to' "..subSpaces)
|
||||
io.popen("xdg-open "..subSpaces)
|
||||
end
|
||||
|
||||
--put everything into a table to use local functions globally
|
||||
|
Loading…
x
Reference in New Issue
Block a user