60 lines
696 B
Plaintext
60 lines
696 B
Plaintext
use moi/util/condition
|
|
use moi/util/file
|
|
|
|
var extensions = [
|
|
aac
|
|
ape
|
|
avi
|
|
divx
|
|
flac
|
|
flv
|
|
m3u
|
|
m4a
|
|
m4v
|
|
mp3
|
|
mp4
|
|
mpeg
|
|
mpg
|
|
mkv
|
|
mng
|
|
mov
|
|
qt
|
|
oga
|
|
ogg
|
|
ogm
|
|
ogv
|
|
opus
|
|
ra
|
|
rv
|
|
ts
|
|
vob
|
|
wav
|
|
webm
|
|
wmv
|
|
wma
|
|
wmx
|
|
]
|
|
|
|
fn -files [m]{
|
|
var type = (condition:cset (eq $m '') prefix deep-prefix)
|
|
file:match-extensions &type=$type $m $@extensions
|
|
}
|
|
|
|
fn complete [@argv]{
|
|
var c = (count $argv)
|
|
if (== $c 2) {
|
|
put --speed
|
|
-files $argv[-1]
|
|
} elif (== $c 3) {
|
|
if (eq $argv[-2] --speed) {
|
|
put 0.8 0.9 1.0 1.1 1.2
|
|
} else {
|
|
-files $argv[-1]
|
|
}
|
|
} else {
|
|
-files $argv[-1]
|
|
}
|
|
}
|
|
|
|
set edit:completion:arg-completer[mpv] = $complete~
|