Start the streaming process when receiving an idle interruption.
When the stream is started using another client, empc will still be able to play the stream, provided it is connected to the server.
This commit is contained in:
parent
d461203139
commit
cb7856fc15
2 changed files with 11 additions and 7 deletions
4
TODO
4
TODO
|
|
@ -13,6 +13,9 @@
|
|||
If disconnected when using the `pause' command, it reconnects but uses wrong
|
||||
status information
|
||||
|
||||
* DONE Start the streaming process when receiving an idle interruption
|
||||
CLOSED: [2011-08-05 Fri 15:38]
|
||||
|
||||
* TODO Rewrite empc-update-status.
|
||||
should be called only at the proper moment with the diff computed before in
|
||||
parameter.
|
||||
|
|
@ -21,4 +24,3 @@
|
|||
Let the possibility to use ido or anything (don't really know how to do that…)
|
||||
|
||||
* TODO Why do I get disconnected when updating the db?
|
||||
* TODO Start the streaming process when receiving an idle interruption
|
||||
|
|
|
|||
14
empc.el
14
empc.el
|
|
@ -135,7 +135,10 @@ then update what needs to be."
|
|||
(unless (and (eq (plist-get empc-current-status :state) (plist-get new-status :state))
|
||||
(eq (plist-get empc-current-status :songid) (plist-get new-status :songid)))
|
||||
(if (eq (plist-get new-status :state) 'play)
|
||||
(empc-echo-song (gethash (plist-get new-status :songid) empc-current-playlist-songs))
|
||||
(progn
|
||||
(unless (eq (plist-get empc-current-status :state) 'play)
|
||||
(empc-stream-start))
|
||||
(empc-echo-song (gethash (plist-get new-status :songid) empc-current-playlist-songs)))
|
||||
(empc-echo-notify (if (eq (plist-get new-status :state) 'pause) "Pause" "Stop"))))
|
||||
(unless (eq (plist-get empc-current-status :playlist) (plist-get new-status :playlist))
|
||||
(empc-echo-notify "Playlist changed")))
|
||||
|
|
@ -279,11 +282,10 @@ Parse the response using the function FN which will then call CLOSURE."
|
|||
(tq-enqueue empc-queue command empc-response-regexp
|
||||
closure 'empc-handle-response t))
|
||||
|
||||
(defun empc-stream-start (status)
|
||||
(defun empc-stream-start ()
|
||||
"Start the stream process if the command to mpd returned successfully.
|
||||
If the stream process is killed for whatever the reason, pause mpd if possible."
|
||||
(when (and empc-stream-url empc-stream-program
|
||||
(eq (plist-get status 'error) nil))
|
||||
(when (and empc-stream-url empc-stream-program)
|
||||
(set-process-sentinel (start-process "empc-stream" nil empc-stream-program empc-stream-url)
|
||||
'(lambda (proc event)
|
||||
(when (and (eq (process-status proc) 'exit)
|
||||
|
|
@ -357,9 +359,9 @@ If the stream process is killed for whatever the reason, pause mpd if possible."
|
|||
((eq state 'play)
|
||||
(empc-send "pause 1"))
|
||||
((eq state 'pause)
|
||||
(empc-send "pause 0" 'empc-stream-start))
|
||||
(empc-send "pause 0"))
|
||||
(t (empc-send-play))))
|
||||
(empc-define-simple-command "play" 'empc-stream-start)
|
||||
(empc-define-simple-command "play")
|
||||
(empc-define-simple-command "previous")
|
||||
(empc-define-simple-command "stop")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue