Compare commits

...

29 Commits

Author SHA1 Message Date
7687396bf7 Merged testing into master 2013-08-09 01:02:03 -05:00
6e5e9db796 Merged in silvernode (pull request #13)
temporary fix for error caused by '
2013-08-09 01:00:51 -05:00
be4a1551aa temporary fix for error caused by ' 2013-08-08 16:02:57 -05:00
7f7d137304 Merge branch 'master' of https://bitbucket.org/silvernode1/mandy 2013-08-08 15:24:19 -05:00
b40beef785 small cleanup 2013-08-07 05:04:07 -05:00
a2ef26d215 Merge branch 'testing' of https://bitbucket.org/silvernode1/mandy into testing 2013-08-06 22:36:31 -05:00
652055d6bd Merge branch 'silvernode' into testing 2013-08-06 22:35:28 -05:00
913d126d13 Took out misleading info in README 2013-08-06 22:34:32 -05:00
8435ea7155 Merged testing into master 2013-08-06 15:41:53 -05:00
0cb8e48230 Merged in experimental (pull request #12)
new main dialog options: bitrate, play finished file and changelog viewer
2013-08-06 15:32:06 -05:00
f56dad78d6 forgot to remove something that didn't work 2013-08-06 15:23:21 -05:00
09706f706d added a comment 2013-08-06 15:19:44 -05:00
c409825057 changed #!/usr/bin/env lua and kb/s to kbps for bitrate 2013-08-05 18:41:16 -05:00
7a42ec87ad cleaned up pointless gBitrate crap and the extra y param 2013-08-05 18:07:14 -05:00
f99c3bbfd7 Revert "Revert "added -vn to ffmpeg function""
This reverts commit d36d657ecdc06ae800c1ed2c71ca3240ea08dc55.
2013-08-05 07:48:11 -05:00
f4731d488a Revert "Revert "Added a cfg file, poorly.""
everything was screwed
This reverts commit f9f328df297457bdf7a8e81d97a8bb11ccba3c9e.
2013-08-05 07:45:58 -05:00
bf81bd3369 Main dialog: bitrate, play file dropdown, changelog viewer 2013-08-05 07:22:05 -05:00
007ff260f7 Added bitrate options 2013-08-05 04:10:10 -05:00
e59b9cf3f4 updated branch 2013-08-05 01:00:20 -05:00
f9f328df29 Revert "Added a cfg file, poorly."
broken when using ogg
This reverts commit 11f74a47d8152c53f3d4f7e6d58f76c025eeadb2.
2013-08-04 03:08:45 -05:00
d36d657ecd Revert "added -vn to ffmpeg function"
learning
This reverts commit c21b96fd8122a944859f676e4357e6812217f661.
2013-08-04 03:02:49 -05:00
cd7633034c learning 2013-08-04 03:02:33 -05:00
9debac93de Revert "added -vn to ffmpeg function"
This reverts commit c21b96fd8122a944859f676e4357e6812217f661.
2013-08-04 02:58:47 -05:00
Logen Kain
11f74a47d8 Added a cfg file, poorly. 2013-08-04 02:58:47 -05:00
ade76e4200 added -vn to ffmpeg function 2013-08-04 02:58:47 -05:00
Logen Kain
74a879ab85 failed at ffmpeg bar, now delete temp flv 2013-08-04 02:58:47 -05:00
8866f16b33 Merged in logen_kain (pull request #11)
Added a cfg file, poorly
2013-08-04 02:35:09 -05:00
c21b96fd81 added -vn to ffmpeg function 2013-08-03 13:28:51 -05:00
af4e9c2c56 Merged in logen_kain (pull request #10)
Temp files
2013-08-03 04:51:03 -05:00
6 changed files with 109 additions and 48 deletions

View File

@ -1,4 +1,5 @@
#Mandy - current version: 0.5.0 #Mandy
###current version: 0.6.0
##About ##About
@ -6,7 +7,7 @@
Mandy is a script written in [Lua][1] using the [IUP][2] GUI toolkit. The Mandy is a script written in [Lua][1] using the [IUP][2] GUI toolkit. The
purpose of Mandy is to provide a simple interface for downloading purpose of Mandy is to provide a simple interface for downloading
youtube videos and converting them to different audio formats. youtube videos and converting them to different audio formats.
Currently only mp3 format is supported.
Mandy currently relies on youtube-dl and ffmpeg for video downloading and Mandy currently relies on youtube-dl and ffmpeg for video downloading and
converting however, if native libraries surface in the future the converting however, if native libraries surface in the future the
@ -215,7 +216,7 @@ Thanks!
[1]: http://lua.org [1]: http://lua.org
[2]: http://www.tecgraf.puc-rio.br/iup/ [2]: http://www.tecgraf.puc-rio.br/iup/
[3]: http://i.imgur.com/P2rMTiM.png [3]: http://i.imgur.com/btD0dJc.png
[4]: http://i.imgur.com/1AcLZk6.png [4]: http://i.imgur.com/1AcLZk6.png
[5]: http://sourceforge.net/projects/iup/files/ [5]: http://sourceforge.net/projects/iup/files/
[6]: http://sourceforge.net/projects/canvasdraw/files/ [6]: http://sourceforge.net/projects/canvasdraw/files/

View File

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

View File

@ -1,7 +1,16 @@
***CHANGELOG*** ***CHANGELOG***
Version 0.6.0 (8-5-13)
* Set the default settings in 'mandy.cfg'
* Can now select audio bitrate
* Autoremove old video files from /tmp
* Added option to play completed file
- Still unknown bug with 'converting' bar
Version 0.5.0 (7-31-13) Version 0.5.0 (7-31-13)
*added audio format selection for mp3. ogg, and flac *added audio format selection for mp3. ogg, and flac
-autoplay has been removed, users now play files manually -autoplay has been removed, users now play files manually

View File

@ -1,4 +1,4 @@
#!/usr/bin/lua5.2 #!/usr/bin/env lua
require("mandy") require("mandy")
dofile("mandy.cfg") dofile("mandy.cfg")
function main() function main()

View File

@ -1,6 +1,11 @@
cfg_table = { cfg_table = {
format = "ogg" -- 0 for mp3, 1 for ogg, 2 for flac --Change default audio format and bitrate within the quotes
--Values for format: mp3, ogg, flac
--Values for bitrate: 320k, 192k, 160k, 128k, 96k
format = "ogg",
bitrate = "320k",
playFile = "no",
} }

109
mandy.lua
View File

@ -1,4 +1,4 @@
#!/usr/bin/lua5.2 #!/usr/bin/env lua
require("iuplua") require("iuplua")
require("iupluacontrols") require("iupluacontrols")
@ -7,24 +7,31 @@ require('ffmpeg_progress')
--Main url entry box --Main url entry box
function url_entry() function url_entry()
local format = sel_format() local format = sel_format()
local bitRate = sel_bitrate()
local url = "" local url = ""
local playNow = sel_play()
local changeLog = "* Set the default settings in 'mandy.cfg'\n"..
"* Can now select audio bitrate\n"..
"* Autoremove old video files from /tmp\n"..
"* Added option to play completed file\n"..
"- Still unknown bug with 'converting' bar\n"
res, url, format = iup.GetParam("Mandy 0.5.0 - Enter URL", nil, res, url, format, bitRate, playNow, changeLog = iup.GetParam("Mandy 0.6.0 (alpha)", nil,
"Enter Youtube URL: %s\n".. "Enter Youtube URL: %s\n"..
"Select an audio format: %l|mp3|ogg|flac|\n", url, format) "Audio Options %t\n"..
"Select an audio format: %l|mp3|ogg|flac|\n"..
"Select the bitrate: %l|320 kbps|192 kbps|160 kbps|128 kbps|96 kbps|\n"..
"Play file when finished?: %l|no|yes|\n"..
"Changelog: %m\n",
url, format, bitRate, playNow, changeLog)
gPlay = ask_play(playNow)
gFormat = sel_Codec(format) gFormat = sel_Codec(format)
gBitrate = bit_logic(bitRate)
if res == true then if res == true then
if string.match(url, "youtube.com/watch") then if string.match(url, "youtube.com/watch") then
local format_config = io.open("Config.txt", "w")
format_config:write("local format = "..format)
format_config:close()
return url return url
else else
iup.Message("Error", "The URL is not a youtube link") iup.Message("Error", "The URL is not a youtube link")
@ -48,6 +55,26 @@ function sel_format()
end end
end end
function sel_bitrate()
local bitrate = cfg_table["bitrate"]
if bitrate == "320k" then return 0
elseif bitrate == "192k" then return 1
elseif bitrate == "160k" then return 2
elseif bitrate == "128k" then return 3
elseif bitrate == "96k" then return 4
elseif bitrate == "32k" then return 5
else return 0
end
end
function sel_play()
local playFile = cfg_table["playFile"]
if playFile == "no" then return 0
elseif playFile == "yes" then return 1
else return 0
end
end
--make format dropdown menu items work --make format dropdown menu items work
@ -68,6 +95,30 @@ function sel_Codec(x)
end end
function bit_logic(x)
if x == 0 then
local b320k = "320k"
print ("Selected "..b320k)
return b320k
elseif x == 1 then
local b192k = "192k"
print ("Selected "..b192k)
return b192k
elseif x == 2 then
local b160k = "160k"
print ("Selected "..b160k)
return b160k
elseif x == 3 then
local b128k = "128k"
print ("Selected "..b128k)
return b128k
elseif x == 4 then
local b96k = "96k"
print ("Selected "..b96k)
return b96k
end
end
--Ask user to set directory --Ask user to set directory
function set_dir() function set_dir()
@ -102,7 +153,7 @@ function ytDl(x)
local tmpNameTwo = math.random(0,999999999999) local tmpNameTwo = math.random(0,999999999999)
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"
print(x)
local flag = popin.ytdl(tmpPath, tmpPath2) local flag = popin.ytdl(tmpPath, tmpPath2)
if not flag then return false end if not flag then return false end
@ -112,18 +163,10 @@ end
--optional function to implement autoplay --optional function to implement autoplay
function ask_play(x) function ask_play(x)
local play = "" if x == 0 then
res, play = iup.GetParam("Play now?", nil,
"Do you want to play the file now? %t\n")
if res == true then
io.popen("notify-send 'The file was saved to' "..x)
io.close()
io.popen("xdg-open "..x)
io.close()
return true
else
return false return false
elseif x == 1 then
return true
end end
end end
@ -134,18 +177,22 @@ function ffmpeg(tmpPath, dirD)
if gFormat == ".mp3" then gFormat = "libmp3lame" end if gFormat == ".mp3" then gFormat = "libmp3lame" end
if gFormat == ".ogg" then gFormat = "libvorbis" end if gFormat == ".ogg" then gFormat = "libvorbis" end
if gFormat == ".flac" then gFormat = "flac" end if gFormat == ".flac" then gFormat = "flac" end
local subSymbols = string.gsub(dirD, "'", "")
local subSpaces = string.gsub(subSymbols, " ", "\\ ")
local codec = "ffmpeg -i "..tmpPath.." -acodec "..gFormat.." -ac 2 -ab "..gBitrate.." -vn -y "..subSpaces
local subSpaces = string.gsub(dirD, " ", "\\ ")
local codec = "ffmpeg -i "..tmpPath.." -acodec "..gFormat.." -ac 2 -ab 192k -vn -y "..subSpaces
print(format)
local flag = convert_mp3.go(codec, tmpPath) local flag = convert_mp3.go(codec, tmpPath)
if not flag then return false end if not flag then return false end
--end io.popen("notify-send 'The file was saved to' "..subSpaces)
--io.popen("notify-send 'The file was saved to' "..subSpaces) io.close()
ask_play(subSpaces) if gPlay == true then
io.popen("xdg-open "..subSpaces)
io.close()
elseif gPlay == false then
print ("You chose not to open the file")
end
end end
--put everything into a table to use local functions globally --put everything into a table to use local functions globally