From 87c5c9b251959fa8176261a378f2a4a163f987a8 Mon Sep 17 00:00:00 2001 From: silvernode Date: Sun, 9 Aug 2015 18:53:58 -0700 Subject: [PATCH] Added license and arranged comments --- LICENSE.txt | 8 ++++++++ config/zymp3.conf | 36 +++++++++++++++++++++++++++--------- lib/logic.sh | 23 +++++++++++++++-------- zymp3 | 5 +++-- 4 files changed, 53 insertions(+), 19 deletions(-) create mode 100644 LICENSE.txt diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..5b07e32 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,8 @@ +#License + +Copyright (c) 4-digit year, Company or Person's Name + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + diff --git a/config/zymp3.conf b/config/zymp3.conf index 37dc8a9..065403e 100644 --- a/config/zymp3.conf +++ b/config/zymp3.conf @@ -4,20 +4,37 @@ #Zymp3 Configuration File #FILE PATHS -INSTALLPATH="/opt/zymp3" #your choice -IMGDIR="/usr/share/pixmaps" #keep set -DESKTOPFILEDIR="/usr/share/applications" #keep set + +#choose your own install path +INSTALLPATH="/opt/zymp3" + +#You can change this but icon may not appear +IMGDIR="/usr/share/pixmaps" + +#Desktop icon directory ( default recommended) +DESKTOPFILEDIR="/usr/share/applications" + +#Default gui - switch between zenity or yad SET_GUI_BIN="zenity" -EXTENSION="ogg" #change this if you change CODEC + +#choose file extension - (does not change format) +#change this if you change CODEC +EXTENSION="ogg" +#Desired bitrate of audio in kilobytes +BITRATE="192" -BITRATE="192" #desired bitrate of mp3 in kilobytes -CODEC="libvorbis" #libmp3lame (mp3), libvorbis (ogg), flac (flac) -MUSICDIR="/home/$USER/Music/" #must have a trailing slash / +#Codec format of audio file +#libmp3lame (mp3), libvorbis (ogg), flac (flac) +CODEC="libvorbis" + +#Output directory for audio files +#must have a trailing slash / +MUSICDIR="/home/$USER/Music/" #VIDEO TMP DIRECTORY -#You shouldn't need to change these filename but just in case +#You shouldn't need to change this but you can VIDEOFILE=/tmp/youtube-dl-$RANDOM-$RANDOM.flv CONVERTED=/tmp @@ -26,9 +43,10 @@ USE_FILE_BROWSER="no" #options- yes, no #GUI SETTINGS - URL_BOX_HEIGHT="64" + URL_BOX_WIDTH="512" FILENAME_BOX_HEIGHT="64" + FILENAME_BOX_WIDTH="326" diff --git a/lib/logic.sh b/lib/logic.sh index 41502a6..8a3365c 100644 --- a/lib/logic.sh +++ b/lib/logic.sh @@ -2,6 +2,7 @@ source config/zymp3.conf +#CHECK FOR YAD OR ZENITY AND DEFAULT TO ONE if [ ! -f /usr/bin/yad ];then SET_GUI_BIN="zenity" elif [ ! -f /usr/bin/zenity ];then @@ -15,7 +16,8 @@ if [ ! -f /usr/bin/ffmpeg ];then else SET_CONV_TOOL="ffmpeg" fi -#convert youtube videos to mp3 with zenity progess bar + +#PROGRESS BAR backend() { @@ -71,7 +73,7 @@ backend() } -#first zenity gui window (paste youtube link) +#PASTE YOUTUBE LINK - WINDOW gui() { VIDURL=$(${SET_GUI_BIN} --title="Zymp3 0.1.7" \ @@ -98,7 +100,10 @@ gui() } -#second gui window to name your mp3 file + + +#ENTER MP3 FILE NAME OR OPEN FILEBROWSER +#CAN BE SWITCHED IN CONFIG gui2() { @@ -133,7 +138,8 @@ gui2() -#notify the user that the mp3 file has been moved to their music folder +#CHECK IF FILEBROWSER VAR IS SET +#IF NOT SET, DEFAULT TO MANUAL TO {MUSICDIR} open() { @@ -156,8 +162,8 @@ open() } -#Check if MUSICDIR exists and create the directory if not -#move the mp3 file to the users music directory +#MOVE MP3 FILE TO MUSICDIR +#IF MUSICDIR DOES NOT EXIST, CREATE IT move() { if [ "${USE_FILE_BROWSER}" = "no" ];then @@ -173,10 +179,11 @@ move() fi } + +#CHECK IF MP3 FILE EXISTS checkFile() { - #check if mp3 file exists if [ "${USE_FILE_BROWSER}" = "no" ];then if [ -f "${MUSICDIR}${AUDIOFILENAME}.${EXTENSION}" ];then notify-send "${AUDIOFILENAME}.${EXTENSION} was saved in ${MUSICDIR}" @@ -217,7 +224,7 @@ checkFile() dconvert() { - #call backend function and pass video URL and input of mp3 file + #PASS VIDEO URL AND FILENAME.MP3 TO BACKEND FUNCTION if [ "${USE_FILE_BROWSER}" = "no" ];then backend "${VIDURL}" "${AUDIOFILENAME}.${EXTENSION}" move diff --git a/zymp3 b/zymp3 index 9767b84..e99bb14 100755 --- a/zymp3 +++ b/zymp3 @@ -14,7 +14,7 @@ -#check for config file +#CHECK FOR CONFIG FILE chk_conf(){ if [ -f config/zymp3.conf ];then source config/zymp3.conf @@ -28,6 +28,7 @@ else fi } +#CHECK FOR FUNCTIONS SCRIPT chk_libs(){ if [ -f lib/logic.sh ];then source lib/logic.sh @@ -42,7 +43,7 @@ fi } -#call the main gui +#RUN CHECKS AND OPEN THE MAIN WINDOW main(){ while true;do chk_conf