aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/boom6
-rwxr-xr-xplugins/fzopen8
-rwxr-xr-xplugins/mocplay14
3 files changed, 13 insertions, 15 deletions
diff --git a/plugins/boom b/plugins/boom
index 14f481d..aa77634 100755
--- a/plugins/boom
+++ b/plugins/boom
@@ -10,7 +10,7 @@ GUIPLAYER="${GUIPLAYER}"
NUMTRACKS="${NUMTRACKS:-100}"
if [ ! -z "$GUIPLAYER" ]; then
- find . -type f \( -iname "*.mp3" -o -iname "*.flac" -o -iname "*.m4a" -o -iname "*.webm" -o -iname "*.wma" \) | shuf | head -n "$NUMTRACKS" | xargs -d "\n" "$GUIPLAYER" > /dev/null 2>&1 &
+ find . -type f \( -iname "*.mp3" -o -iname "*.flac" -o -iname "*.m4a" -o -iname "*.webm" -o -iname "*.wma" \) | shuf -n "$NUMTRACKS" | xargs -d "\n" "$GUIPLAYER" > /dev/null 2>&1 &
# detach the player
sleep 1
@@ -26,7 +26,7 @@ elif which mocp >/dev/null 2>&1; then
state=$(mocp -i | grep "State:" | cut -d' ' -f2)
if [ "$state" = 'PLAY' ]; then
# add up to 100 random audio files
- find . -type f \( -iname "*.mp3" -o -iname "*.flac" -o -iname "*.m4a" -o -iname "*.webm" -o -iname "*.wma" \) | shuf | head -n "$NUMTRACKS" | xargs -d "\n" mocp -a
+ find . -type f \( -iname "*.mp3" -o -iname "*.flac" -o -iname "*.m4a" -o -iname "*.webm" -o -iname "*.wma" \) | shuf -n "$NUMTRACKS" | xargs -d "\n" mocp -a
exit
fi
fi
@@ -35,7 +35,7 @@ elif which mocp >/dev/null 2>&1; then
mocp -c
# add up to 100 random audio files
- find . -type f \( -iname "*.mp3" -o -iname "*.flac" -o -iname "*.m4a" -o -iname "*.webm" -o -iname "*.wma" \) | shuf | head -n "$NUMTRACKS" | xargs -d "\n" mocp -a
+ find . -type f \( -iname "*.mp3" -o -iname "*.flac" -o -iname "*.m4a" -o -iname "*.webm" -o -iname "*.wma" \) | shuf -n "$NUMTRACKS" | xargs -d "\n" mocp -a
# start playing
mocp -p
diff --git a/plugins/fzopen b/plugins/fzopen
index 9f5ff05..e262d68 100755
--- a/plugins/fzopen
+++ b/plugins/fzopen
@@ -4,14 +4,18 @@
# Opens in $VISUAL or $EDITOR if text
# Opens other type of files with xdg-open
#
-# Requires: fzf/fzy, xdg-open
+# Requires: fd/find, fzf/fzy/skim, xdg-open
#
# Shell: POSIX compliant
# Author: Arun Prakash Jana
if which fzf >/dev/null 2>&1; then
cmd="$FZF_DEFAULT_COMMAND"
- [ -z "$cmd" ] && cmd="find . -type f 2>/dev/null"
+ if which fd >/dev/null 2>&1; then
+ [ -z "$cmd" ] && cmd="fd -t f 2>/dev/null"
+ else
+ [ -z "$cmd" ] && cmd="find . -type f 2>/dev/null"
+ fi
entry="$(eval "$cmd" | fzf --delimiter / --nth=-1 --tiebreak=begin --info=hidden)"
# To show only the file name
# entry=$(find . -type f 2>/dev/null | fzf --delimiter / --with-nth=-1 --tiebreak=begin --info=hidden)
diff --git a/plugins/mocplay b/plugins/mocplay
index 5db44b9..36e7e50 100755
--- a/plugins/mocplay
+++ b/plugins/mocplay
@@ -7,6 +7,7 @@
# - appends tracks and exits is MOC is running, else clears playlist and adds tracks
# - to randomize the order of files appended to the playlist, set SHUFFLE=1
# if you add a directory with many files when SHUFFLE=1 is set, it might take a very long time to finish!
+# - max 100 files are added
#
# Shell: POSIX compliant
# Author: Arun Prakash Jana, ath3
@@ -30,20 +31,13 @@ mocp_add ()
for entry in $arr
do
if [ -d "$entry" ]; then
- arr2=$arr2$(find "$entry" -type f)
- else
+ arr2=$arr2$(find "$entry" -type f \( ! -iname "*.m3u" ! -iname "*.pls" \))
+ elif echo "$entry" | grep -qv '\.m3u$\|\.pls$' ; then
arr2=$(printf "%s\n%s" "$entry" "$arr2")
fi
done
- arr2=$(echo "$arr2" | awk 'BEGIN{srand();}{print rand()"\t"$0}' | sort -k1 -n | cut -f2-)
- for entry in $arr2
- do
- if [ -f "$entry" ] && echo "$entry" | grep -qv '\.m3u$\|\.pls$' ; then
- mocp -a "$entry"
- fi
- done
-
+ echo "$arr2" | shuf -n 100 | xargs -d "\n" mocp -a
else
if [ "$resp" = "y" ]; then
xargs < "$selection" -0 mocp -a