以下作品:
# play file1 and then file 2:
mpv "file1" "file 2"
# use fzf to select a file and play that file:
mpv "$(fdfind . /path/to/Music | fzf)"
Now fzf -m
允许多选。但是以下方法不起作用:
mpv "$(fdfind . /path/to/Music | fzf -m)" #select at least 2 files here
起初我以为问题在于fzf -m
返回由换行符分隔的选择,例如:
file1
file 2
所以我尝试了一些sed
/ awk
stuff:
fdfind . /path/to/Music | fzf -m |
sed 's/^/"/;s/$/"/' | #double quotes every line
awk 1 ORS=' ' | #replace newline with ' '
head -c -1 | #delete the last ' '
将其格式化为:
"file1" "file 2"
这也是行不通的。所以我也尝试过kdialog
具有以下内容:
mpv "$(kdialog --getopenfilename --multiple /path/to/Music/)" #select at least 2 files here
但这不起作用。但是,那kdialog-open-files.lua https://gist.github.com/ntasos/d1d846abd7d25e4e83a78d22ee067a22用户脚本对我来说效果很好!
我认为我在如何将论点传递给mpv
,如下(显然)有效:
mpv "$(fdfind . /path/to/Music | fzf)" "$(fdfind . /path/to/Music | fzf)"