1#compdef xmms2 2 3_xmms2_command() { 4 local xmms2_cmds 5 6 xmms2_cmds=( 7 add:"adds a URL to the playlist" 8 addarg:"adds one URL with arguments to the playlist" 9 addid:"adds a Medialib id to the playlist" 10 insert:"inserts one URL at a specific position" 11 insertid:"inserts one Medialib id at a specific position" 12 radd:"adds a directory recursively to the playlist" 13 clear:"clears the playlist" 14 shuffle:"shuffles the playlist" 15 sort:"sort the playlist; use a space delimiter for multiple properties" 16 remove:"removes something from the playlist" 17 list:"lists the playlist" 18 addpls:"Adds the contents of a playlist file to the playlist" 19 play:"starts playback" 20 stop:"stops playback" 21 toggleplay:"toggles playback status between play/pause" 22 pause:"pause playback" 23 next:"play next song" 24 prev:"play previous song" 25 seek:"seek to a specific place in current song" 26 jump:"take a leap in the playlist" 27 move:"move a entry in the playlist" 28 volume:"set volume for a channel" 29 volume_list:"list volume levels for each channel" 30 mlib:"medialib manipulation - type 'xmms2 mlib' for more extensive help" 31 playlist:"playlist manipulation - type 'xmms2 playlist' for more extensive help" 32 coll:"collection manipulation - type 'xmms2 coll' for more extensive help" 33 browse:"browse server file lists" 34 status:"go into status mode" 35 info:"information about current entry" 36 current:"formatted information about the current entry" 37 config:"set a config value" 38 config_list:"list all config values" 39 plugin_list:"list all plugins loaded in the server" 40 stats:"get statistics from server" 41 quit:"make the server quit" 42 help:"print help about a command" 43 ) 44 45 if (( CURRENT == 1 )); then 46 _describe -t command "xmms2 commands" xmms2_cmds 47 else 48 local curcontext="$curcontext" 49 fi 50 51 local cmd=$words[1] 52 53 local curcontext="${curcontext%:*}:xmms2-${cmd}" 54 _call_function ret _xmms2_$cmd 55} 56 57 _xmms2_jump() { 58 songlist=(${"$(xmms2 list)"}) 59 playlistitems=() 60 for song ($songlist); do 61 if [[ $song = (#b)' '\[(<->)/(<->)\]' '(*)' '\((*)\) ]]; then 62 playlistitems+=("$match[1][$match[3]]") 63 fi 64 done 65 66 _values -s ' ' 'playlist items' ${(On)playlistitems} 67 68} 69 70_xmms2_mlib() { 71 local mlib_cmds 72 mlib_cmds=( 73 add:"Add 'url' to medialib" 74 loadall:"Load everything from the mlib to the playlist" 75 searchadd:"Search for, and add songs to playlist" 76 search:"Search for songs matching criteria" 77 addpath:"Import metadata from all media files under 'path'" 78 rehash:"Force the medialib to check whether its data is up to date" 79 remove:"Remove an entry from medialib" 80 setstr:"Set a string property together with a medialib entry." 81 setint:"Set a int property together with a medialib entry." 82 rmprop:"Remove a property from a medialib entry" 83 addcover:"Add a cover image on id(s)." 84 85 ) 86 if (( CURRENT == 2 )); then 87 _describe -t command "xmms2 mlib commands" mlib_cmds 88 else 89 local curcontext="$curcontext" 90 fi 91 92 local cmd=$words[2] 93 94 local curcontext="${curcontext%:*}:xmms2-${cmd}" 95 _call_function ret _xmms2_$cmd 96 97} 98 99 100_xmms2_playlist() { 101 local playlist_cmds 102 playlist_cmds=( 103 list:"List all available playlists" 104 create:"Create a playlist" 105 type:"Set the type of the playlist (list, queue, pshuffle)" 106 load:"Load 'playlistname' stored in medialib" 107 remove:"Remove a playlist" 108 ) 109 if (( CURRENT == 2 )); then 110 _describe -t command "xmms2 playlist commands" playlist_cmds 111 else 112 local curcontext="$curcontext" 113 fi 114 115 local cmd=$words[2] 116 117 local curcontext="${curcontext%:*}:xmms2-${cmd}" 118 _call_function ret _xmms2_playlist_$cmd 119} 120 121_xmms2_playlist_load() { 122 local list 123 list=($(xmms2 playlist list)) 124 _describe -t command "xmms2 playlists" list 125} 126 127 128_xmms2_playlist_remove() { 129 local list 130 list=($(xmms2 playlist list)) 131 _describe -t command "xmms2 playlists" list 132} 133 134 135_xmms2_coll() { 136 local coll_cmds 137 coll_cmds=( 138 save:"Save a pattern as a collection" 139 rename:"Rename a collection" 140 list:"List all collections in a given namespace" 141 query:"Display all the media in a collection" 142 queryadd:"Add all media in a collection to active playlist" 143 find:"Find all collections that contain the given media" 144 get:"Display the structure of a collection" 145 remove:"Remove a saved collection" 146 attr:"Get/set an attribute for a saved collection" 147 ) 148 if (( CURRENT == 2 )); then 149 _describe -t command "xmms2 collection commands" coll_cmds 150 else 151 local curcontext="$curcontext" 152 fi 153 154 local cmd=$words[2] 155 156 local curcontext="${curcontext%:*}:xmms2-${cmd}" 157 _call_function ret _xmms2_coll_$cmd 158} 159 160_xmms2_coll_helper() { 161 local list 162 list=($(xmms2 coll list)) 163 _describe -t command "xmms2 playlists" list 164} 165 166_xmms2_coll_rename() { 167 _xmms2_coll_helper 168} 169 170_xmms2_coll_remove() { 171 _xmms2_coll_helper 172} 173 174_xmms2_coll_get() { 175 _xmms2_coll_helper 176} 177 178_xmms2_coll_query() { 179 _xmms2_coll_helper 180} 181 182_xmms2_coll_queryadd() { 183 _xmms2_coll_helper 184} 185 186_xmms2_coll_attr() { 187 _xmms2_coll_helper 188} 189 190_xmms2_add() { 191 _files 192} 193 194_xmms2_radd() { 195 _dirs 196} 197 198_xmms2_addpls() { 199 local expl 200 _description files expl 'playlist' 201 _files "$expl[@]" -g '*.([mM]3[uU]|[pP][lL][sS])(-.)' 202} 203 204_xmms2() { 205_arguments \ 206 '--format[specify the format of song display]:format string' \ 207 '--no-status[prevent printing song status on completion]' \ 208 '*::xmms2 command:_xmms2_command' 209} 210 211_xmms2 "$@" 212