Christophe Weblog Wiki Code Publications Music
initial commit
[squeeze-el.git] / squeeze.el
1 (defgroup squeeze nil
2   "Interact with Squeezebox media servers"
3   :prefix "squeeze-" 
4   :group 'applications)
5
6 (defcustom squeeze-server-address "localhost"
7   "Address for the Squeezebox server"
8   :group 'squeeze)
9 (defcustom squeeze-server-port 9090
10   "Port number for the Squeezebox server"
11   :group 'squeeze)
12
13 (defvar squeeze-mode-map
14   (let ((map (make-sparse-keymap)))
15     (define-key map (kbd "TAB") 'completion-at-point)
16     map))
17
18 (define-derived-mode squeeze-mode comint-mode "Squeeze"
19   "Major mode for interacting with the Squeezebox Server CLI.\\<squeeze-mode-map>"
20   (add-hook 'comint-preoutput-filter-functions 'url-unhex-string nil t))
21
22 (defun squeeze-complete-command-at-point ()
23   (save-excursion
24     (list (progn (backward-word) (point))
25           (progn (forward-word) (point))
26           '(;; General commands and queries
27             "login" "can" "version" "listen" "subscribe" "pref"
28             "logging" "getstring" "setsncredentials" "debug"
29             "exit" "shutdown"
30
31             ;; Player commands and queries
32             "player" "count" "id" "uuid" "name" "ip" "model" "isplayer"
33             "displaytype" "canpoweroff" "?" "signalstrength" "connected"
34             "sleep" "sync" "syncgroups" "power" "mixer" "volume" "muting"
35             "bass" "treble" "pitch" "show" "display" "linesperscreen"
36             "displaynow" "playerpref" "button" "ir" "irenable"
37             "connect" "client" "forget" "disconnect" "players"
38             
39             ;; Database commands and queries
40             "rescan" "rescanprogress" "abortscan" "wipecache" "info"
41             "total" "genres" "artists" "albums" "songs" "years"
42             "musicfolder" "playlists" "tracks" "new" "rename" "delete"
43             "edit" "songinfo" "titles" "search" "pragma"
44
45             ;; Playlist commands and queries
46             "play" "stop" "pause" "mode" "time" "genre" "artist" "album"
47             "title" "duration" "remote" "current_title" "path" "playlist"
48             "add" "insert" "deleteitem" "move" "delete" "preview" "resume"
49             "save" "loadalbum" "addalbum" "loadtracks" "addtracks"
50             "insertalbum" "deletealbum" "clear" "zap" "name" "url"
51             "modified" "playlistsinfo" "index" "shuffle" "repeat"
52             "playlistcontrol"
53
54             ;; Compound queries
55             "serverstatus" "status" "displaystatus" "readdirectory"
56
57             ;; Notifications
58             
59             ;; Alarm commands and queries
60             "alarm" "alarms"
61
62             ;; Plugins commands and queries
63             "favorites"
64             
65             ))))
66
67 (defun squeeze ()
68   (interactive)
69   (let ((buffer (make-comint-in-buffer "squeeze" nil
70                                        (cons squeeze-server-address
71                                              squeeze-server-port))))
72     (switch-to-buffer buffer)
73     (squeeze-mode)))