summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRasmus Steinke <rasi@xssn.at>2014-11-01 11:32:27 +0100
committerRasmus Steinke <rasi@xssn.at>2014-11-01 11:32:27 +0100
commit8e9b77bd534ee60e93b5315016d4b42c8d859294 (patch)
tree0704f0b4219f76c9cb363ce30fd538fc9100a999
parent0967184432eb0ee7f55da645fcd09472a35c54fd (diff)
downloadperl-app-clerk-8e9b77bd534ee60e93b5315016d4b42c8d859294.tar.gz
perl-app-clerk-8e9b77bd534ee60e93b5315016d4b42c8d859294.tar.xz
sort results
-rwxr-xr-xclerk8
1 files changed, 4 insertions, 4 deletions
diff --git a/clerk b/clerk
index f329806..0600163 100755
--- a/clerk
+++ b/clerk
@@ -131,8 +131,8 @@ browseFilesystem () {
chose() {
if [[ -d "$selection" ]]; then
cd "$selection"
- dirs="$(find . -maxdepth 1 \( ! -regex '.*/\..*' \) -type d | cut -c 3-)"
- files="$(find -maxdepth 1 -type f -regex ".*/.*\.\(flac\|mp3\|ogg\|m4a\|wav\|wv\|mpc\|wma\|aac\)" | cut -c 3-)"
+ dirs="$(find . -maxdepth 1 \( ! -regex '.*/\..*' \) -type d | cut -c 3- | sort -u)"
+ files="$(find -maxdepth 1 -type f -regex ".*/.*\.\(flac\|mp3\|ogg\|m4a\|wav\|wv\|mpc\|wma\|aac\)" | cut -c 3- | sort -u)"
selection="$(echo -e "0 Return to Library Menu\n---\n1 Add all music files\n---\n..$(echo "$dirs")\n$(echo "$files")" | dmenu_t -p "$(realpath .) > ")"
chose
elif [[ "$selection" == "1 Add all music files" ]]; then
@@ -146,8 +146,8 @@ browseFilesystem () {
}
cd ~
- dirs="$(find . -maxdepth 1 \( ! -regex '.*/\..*' \) -type d | cut -c 3-)"
- files="$(find -maxdepth 1 -type f -regex ".*/.*\.\(flac\|mp3\|ogg\|m4a\|wav\|wv\|mpc\|wma\|aac\)" | cut -c 3-)"
+ dirs="$(find . -maxdepth 1 \( ! -regex '.*/\..*' \) -type d | cut -c 3- | sort -u)"
+ files="$(find -maxdepth 1 -type f -regex ".*/.*\.\(flac\|mp3\|ogg\|m4a\|wav\|wv\|mpc\|wma\|aac\)" | cut -c 3- | sort -u)"
selection="$(echo -e "0 Return to Library Menu\n---\n1 Add all music files\n---\n..$(echo "$dirs")\n$(echo "$files")" | dmenu_t -p "$(realpath .) > ")"
chose
}