jptgdp: Rename variable, reorganize help text
This commit is contained in:
		
							
								
								
									
										15
									
								
								jptgdp
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								jptgdp
									
									
									
									
									
								
							| @@ -12,7 +12,7 @@ _tmpdir="${XDG_CACHE_HOME:-$HOME/.cache}/$_name" | ||||
| _tmpfile="$_tmpdir/tmpfile" | ||||
| _xdguserdirs="${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs" | ||||
| [ -f "$_xdguserdirs" ] && source "$_xdguserdirs" | ||||
| _playlistdir="${XDG_MUSIC_DIR:-$HOME/Music}/JPTGDP Songs" | ||||
| _musicdir="${XDG_MUSIC_DIR:-$HOME/Music}/JPTGDP Songs" | ||||
|  | ||||
| # Helper functions | ||||
| log() { | ||||
| @@ -45,7 +45,7 @@ trapexit() { | ||||
|  | ||||
| # Critical functions | ||||
| clearcache() { | ||||
| 	[ -n "$_playlistdir" ] && rm "$_playlistdir"/* > /dev/null 2>&1 | ||||
| 	[ -n "$_musicdir" ] && rm "$_musicdir"/* > /dev/null 2>&1 | ||||
| 	log "Cache has been emptied" | ||||
| } | ||||
| helptext() { | ||||
| @@ -53,12 +53,15 @@ helptext() { | ||||
| Usage: $_name [OPTION] | ||||
| Use youtube-dl and audacious to queue up a playlist given a file of only search | ||||
| queries. | ||||
|   -f <file>		The playlist file to load | ||||
|  | ||||
|   -c			Clears the cache (which can become quite large) | ||||
|   -d			Download only; don't queue anything up | ||||
|   -f <file>		The playlist file to load | ||||
|   -s			Shuffle the playlist | ||||
|  | ||||
|   -r <directory>	Start up rofi, if installed, and present a listing of | ||||
| 			all .ytp files in the given directory | ||||
|   -s			Shuffle the playlist | ||||
|  | ||||
|   -h			Print this help text | ||||
|  | ||||
| Copyright (c) 2019 rehashedsalt@cock.li | ||||
| @@ -77,7 +80,7 @@ playlist() { | ||||
| 	while read line; do | ||||
| 		[ -z "$line" ] && continue | ||||
| 		rm "$_tmpfile"* > /dev/null 2>&1 | ||||
| 		filename="$_playlistdir/${line//[^ a-zA-Z0-9\[\]|()_-]/}" | ||||
| 		filename="$_musicdir/${line//[^ a-zA-Z0-9\[\]|()_-]/}" | ||||
| 		if ! [ -f "$filename" ]; then | ||||
| 			log "Finding a song for \"$line\"" | ||||
| 			youtube-dl \ | ||||
| @@ -109,7 +112,7 @@ main() { | ||||
| 	# Boostrapping and setup | ||||
| 	validatedeps basename mktemp || error "Critical dependency $_return was not met" 1 | ||||
| 	mkdir -p "$_tmpdir" | ||||
| 	mkdir -p "$_playlistdir" | ||||
| 	mkdir -p "$_musicdir" | ||||
| 	trap trapexit EXIT | ||||
|  | ||||
| 	# Actual program stuff | ||||
|   | ||||
		Reference in New Issue
	
	Block a user