summary refs log tree commit diff
path: root/Completion/Unix/Command/_xmms2
blob: f132ada353e37de9d9bc94ffed0fddea97f63781 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
#compdef xmms2

_xmms2_command() {
    local xmms2_cmds

    xmms2_cmds=(
	add:"adds a URL to the playlist"
	addarg:"adds one URL with arguments to the playlist"
	addid:"adds a Medialib id to the playlist"
	insert:"inserts one URL at a specific position"
	insertid:"inserts one Medialib id at a specific position"
	radd:"adds a directory recursively to the playlist"
	clear:"clears the playlist"
	shuffle:"shuffles the playlist"
	sort:"sort the playlist; use a space delimiter for multiple properties"
	remove:"removes something from the playlist"
	list:"lists the playlist"
	addpls:"Adds the contents of a playlist file to the playlist"
	play:"starts playback"
	stop:"stops playback"
	toggleplay:"toggles playback status between play/pause"
	pause:"pause playback"
	next:"play next song"
	prev:"play previous song"
	seek:"seek to a specific place in current song"
	jump:"take a leap in the playlist"
	move:"move a entry in the playlist"
	volume:"set volume for a channel"
	volume_list:"list volume levels for each channel"
	mlib:"medialib manipulation - type 'xmms2 mlib' for more extensive help"
	playlist:"playlist manipulation - type 'xmms2 playlist' for more extensive help"
	coll:"collection manipulation - type 'xmms2 coll' for more extensive help"
	browse:"browse server file lists"
	status:"go into status mode"
	info:"information about current entry"
	current:"formatted information about the current entry"
	config:"set a config value"
	config_list:"list all config values"
	plugin_list:"list all plugins loaded in the server"
	stats:"get statistics from server"
	quit:"make the server quit"
	help:"print help about a command"
	)

    if (( CURRENT == 1 )); then
	_describe -t command "xmms2 commands" xmms2_cmds
    else
	local curcontext="$curcontext"
    fi

    local cmd=$words[1]

    local curcontext="${curcontext%:*}:xmms2-${cmd}"
    _call_function ret _xmms2_$cmd
}

 _xmms2_jump() {
     oldIFS=$IFS
     IFS=$'\n'
     songlist=($(xmms2 list))
     IFS=oldIFS
     playlistitems=""
     for song ($songlist); do 
	 if [[ $song = (#b)'  '\[(<->)/(<->)\]' '(*)' '\((*)\) ]]; then
		    playlistitems=($playlistitems "$match[1][$match[3]]")
	 fi
     done
     
     _values -s ' ' 'playlist items' ${(On)playlistitems}

}

_xmms2_mlib() {
    local mlib_cmds
    mlib_cmds=(
	add:"Add 'url' to medialib"
	loadall:"Load everything from the mlib to the playlist"
	searchadd:"Search for, and add songs to playlist"
	search:"Search for songs matching criteria"
	addpath:"Import metadata from all media files under 'path'"
	rehash:"Force the medialib to check whether its data is up to date"
	remove:"Remove an entry from medialib"
	setstr:"Set a string property together with a medialib entry."
	setint:"Set a int property together with a medialib entry."
	rmprop:"Remove a property from a medialib entry"
	addcover:"Add a cover image on id(s)."

	)
    if (( CURRENT == 2 )); then
	_describe -t command "xmms2 mlib commands" mlib_cmds
    else
	local curcontext="$curcontext"
    fi

    local cmd=$words[2]

    local curcontext="${curcontext%:*}:xmms2-${cmd}"
    _call_function ret _xmms2_$cmd

}


_xmms2_playlist() {
    local playlist_cmds
    playlist_cmds=(
	list:"List all available playlists"
	create:"Create a playlist"
	type:"Set the type of the playlist (list, queue, pshuffle)"
	load:"Load 'playlistname' stored in medialib"
	remove:"Remove a playlist"
	)
    if (( CURRENT == 2 )); then
	_describe -t command "xmms2 playlist commands" playlist_cmds
    else
	local curcontext="$curcontext"
    fi

    local cmd=$words[2]

    local curcontext="${curcontext%:*}:xmms2-${cmd}"
    _call_function ret _xmms2_playlist_$cmd
}

_xmms2_playlist_load() {
    local list
    list=($(xmms2 playlist list))
    _describe -t command "xmms2 playlists" list
}


_xmms2_playlist_remove() {
    local list
    list=($(xmms2 playlist list))
    _describe -t command "xmms2 playlists" list
}


_xmms2_coll() {
    local coll_cmds
    coll_cmds=(
	save:"Save a pattern as a collection"
	rename:"Rename a collection"
	list:"List all collections in a given namespace"
	query:"Display all the media in a collection"
	queryadd:"Add all media in a collection to active playlist"
	find:"Find all collections that contain the given media"
	get:"Display the structure of a collection"
	remove:"Remove a saved collection"
	attr:"Get/set an attribute for a saved collection"
	)
    if (( CURRENT == 2 )); then
	_describe -t command "xmms2 collection commands" coll_cmds
    else
	local curcontext="$curcontext"
    fi

    local cmd=$words[2]

    local curcontext="${curcontext%:*}:xmms2-${cmd}"
    _call_function ret _xmms2_coll_$cmd
}

_xmms2_coll_helper() {
    local list
    list=($(xmms2 coll list))
    _describe -t command "xmms2 playlists" list
}

_xmms2_coll_rename() {
    _xmms2_coll_helper
}

_xmms2_coll_remove() {
    _xmms2_coll_helper
}

_xmms2_coll_get() {
    _xmms2_coll_helper
}

_xmms2_coll_query() {
    _xmms2_coll_helper
}

_xmms2_coll_queryadd() {
    _xmms2_coll_helper
}

_xmms2_coll_attr() {
    _xmms2_coll_helper
}

_xmms2() {
_arguments \
    '--format[specify the format of song display]:format string' \
    '--no-status[prevent printing song status on completion]' \
    '*::xmms2 command:_xmms2_command'
}

_xmms2 "$@"