From 0f4ebd81ccc1a4e40caf7e85630fe3a8e3c74894 Mon Sep 17 00:00:00 2001
From: Salt <rehashedsalt@cock.li>
Date: Thu, 13 Jun 2019 07:58:48 -0500
Subject: [PATCH] jptgdp: Rename variable, reorganize help text

---
 jptgdp | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/jptgdp b/jptgdp
index 22ab7fa..a181f6d 100755
--- a/jptgdp
+++ b/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