@@ 8,7 8,7 @@ cleanup() {
trap cleanup INT TERM
usage() {
- echo "Usage: $0 [-1] [-h]" 1>&2
+ echo "Usage: $0 [-1] [-h] [-t] [-s]" 1>&2
echo "" 1>&2
printf "This is a program made to copy multimedia URLs into system clibboard
and play them through \$VIDEOPLAYER (if it is not set, mpv).\n" 1>&2
@@ 38,7 38,7 @@ svw_stop() {
svw() {
printf "%b\n" "" | xclip -i -selection clipboard
- if [ ! -e $stop_file ]; then
+ if [ ! -f $stop_file ]; then
touch $stop_file
else
notify-send "Error" "Already selecting"
@@ 52,7 52,7 @@ svw() {
echo "$!" > "$stop_file"
wait
link="$(xclip -o -selection clipboard)"
- if [ -n "$link" ] && [ -z "$(printf "%b\n" "$links" | grep "$link")" ]
+ if [ -n "$link" ] && ! printf "%b\n" "$links" | grep -q "$link"
then
links="$links\n$link"
echo "$link"
@@ 70,9 70,9 @@ svw() {
[ -n "$links" ] &&
if [ -n "$single" ]; then
- printf "%b\n" "$links" | tail -n +2 | xargs "$player"
+ printf "%b\n" "$links" | tail -n +2 | xargs $player
else
- printf "%b\n" "$links" | tail -n +2 | xargs -L1 "$player"
+ printf "%b\n" "$links" | tail -n +2 | xargs -L1 $player
fi
rm "$videos_file" 2>/dev/null