Polish README and error messages, add a rofi wrapper script
This commit is contained in:
parent
29f39c5e83
commit
3104291005
32
ptgdp-rofi
Executable file
32
ptgdp-rofi
Executable file
@ -0,0 +1,32 @@
|
||||
#! /bin/bash
|
||||
#
|
||||
# ptgdp-rofi
|
||||
# Uses rofi to select a ptgdp playlist in ~/Music/Playlists
|
||||
# Copyright (C) 2019 Vintage Salt <rehashedsalt@cock.li>
|
||||
#
|
||||
# Distributed under terms of the MIT license.
|
||||
#
|
||||
set -e
|
||||
|
||||
_xdguserdirs="${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs"
|
||||
[ -z "$XDG_MUSIC_DIR" ] && [ -r "$_xdguserdirs" ] && source "$_xdguserdirs"
|
||||
unset _xdguserdirs
|
||||
playlistdir="${XDG_MUSIC_DIR:-$HOME/Music}/Playlists"
|
||||
|
||||
files=$(find "$playlistdir" -type f -name \*.gdp)
|
||||
if [ -n "$files" ]; then
|
||||
playlists=""
|
||||
while read file; do
|
||||
filebase="$(basename -- "$file")"
|
||||
filebase="${filebase%.gdp}"
|
||||
[ -n "$playlists" ] && playlists+=$'\n'
|
||||
playlists+="$filebase"
|
||||
done <<< "$files"
|
||||
else
|
||||
echo "No playlists found"
|
||||
exit 1
|
||||
fi
|
||||
prompt="ptgdp"
|
||||
choice="$(rofi -dmenu -i -p "$prompt" <<< "$playlists" 2>/dev/null)"
|
||||
[ -z "$choice" ] && exit 2
|
||||
exec ptgdp -p "$playlistdir"/"$choice".gdp
|
Loading…
Reference in New Issue
Block a user