jptgdp: Add a download-only flag, rename
This commit is contained in:
		@@ -1,6 +1,6 @@
 | 
				
			|||||||
#! /bin/bash
 | 
					#! /bin/bash
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# justplayit
 | 
					# jptgdp - Just Play the Goddamn Playlist
 | 
				
			||||||
# Copyright (C) 2019 Vintage Salt <rehashedsalt@cock.li>
 | 
					# Copyright (C) 2019 Vintage Salt <rehashedsalt@cock.li>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Distributed under terms of the MIT license.
 | 
					# Distributed under terms of the MIT license.
 | 
				
			||||||
@@ -58,6 +58,7 @@ Usage: $_name [OPTION]
 | 
				
			|||||||
Use youtube-dl and audacious to queue up a playlist given a file of only search
 | 
					Use youtube-dl and audacious to queue up a playlist given a file of only search
 | 
				
			||||||
queries.
 | 
					queries.
 | 
				
			||||||
  -c			Clears the cache (which can become quite large)
 | 
					  -c			Clears the cache (which can become quite large)
 | 
				
			||||||
 | 
					  -d			Download only; don't queue anything up
 | 
				
			||||||
  -f <file>		The playlist file to load
 | 
					  -f <file>		The playlist file to load
 | 
				
			||||||
  -r <directory>	Start up rofi, if installed, and present a listing of
 | 
					  -r <directory>	Start up rofi, if installed, and present a listing of
 | 
				
			||||||
			all .ytp files in the given directory
 | 
								all .ytp files in the given directory
 | 
				
			||||||
@@ -95,7 +96,7 @@ playlist() {
 | 
				
			|||||||
			wait
 | 
								wait
 | 
				
			||||||
			mv "$_tmpfile"* "$filename"
 | 
								mv "$_tmpfile"* "$filename"
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
		audacious -e "$filename"
 | 
							[ -z "$_optdownloadonly" ] && audacious -e "$filename"
 | 
				
			||||||
	done < <(if [ -n "$_optshuffle" ]; then shuf "$1"; else cat "$1"; fi)
 | 
						done < <(if [ -n "$_optshuffle" ]; then shuf "$1"; else cat "$1"; fi)
 | 
				
			||||||
	log "Finished building queue"
 | 
						log "Finished building queue"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -109,12 +110,15 @@ main() {
 | 
				
			|||||||
	trap trapexit EXIT
 | 
						trap trapexit EXIT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Actual program stuff
 | 
						# Actual program stuff
 | 
				
			||||||
	while getopts ":cf:r:sh" opt; do
 | 
						while getopts ":cdf:r:sh" opt; do
 | 
				
			||||||
		case $opt in
 | 
							case $opt in
 | 
				
			||||||
			c)
 | 
								c)
 | 
				
			||||||
				clearcache
 | 
									clearcache
 | 
				
			||||||
				exit $?
 | 
									exit $?
 | 
				
			||||||
				;;
 | 
									;;
 | 
				
			||||||
 | 
								d)
 | 
				
			||||||
 | 
									_optdownloadonly=1
 | 
				
			||||||
 | 
									;;
 | 
				
			||||||
			f)
 | 
								f)
 | 
				
			||||||
				_optfile="$OPTARG"
 | 
									_optfile="$OPTARG"
 | 
				
			||||||
				;;
 | 
									;;
 | 
				
			||||||
		Reference in New Issue
	
	Block a user