projects
/
elisp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
460fef0
)
Cosmetics.
author
Francois Fleuret
<francois@fleuret.org>
Thu, 11 Jun 2015 20:45:44 +0000
(22:45 +0200)
committer
Francois Fleuret
<francois@fleuret.org>
Thu, 11 Jun 2015 20:45:44 +0000
(22:45 +0200)
media-mplayer.el
patch
|
blob
|
history
diff --git
a/media-mplayer.el
b/media-mplayer.el
index
5b00526
..
c0df300
100644
(file)
--- a/
media-mplayer.el
+++ b/
media-mplayer.el
@@
-72,6
+72,9
@@
load Emacs less. Nil means no timing."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(setq media/mplayer/protocol-regexp
+ "^\\(AUDIO:\\|Exiting...\\|Starting\\|ANS_LENGTH\\|ANS_TIME_POSITION\\|Cache fill:\\|ICY Info:\\) *\\(.*\\)$")
+
(defun media/mplayer/filter-subfunctions (cmd param)
;; (unless (string= cmd "A:")
;; (message "cmd=%s param=%s" cmd param)
(defun media/mplayer/filter-subfunctions (cmd param)
;; (unless (string= cmd "A:")
;; (message "cmd=%s param=%s" cmd param)
@@
-82,9
+85,6
@@
load Emacs less. Nil means no timing."
(assoc cmd
'(
(assoc cmd
'(
-
- ;; ----------------------------------------
-
("ICY Info:"
;; (message "ICY Info \"%s\"" param)
("ICY Info:"
;; (message "ICY Info \"%s\"" param)
@@
-103,10
+103,11
@@
load Emacs less. Nil means no timing."
)
)
)
)
+ ;; If we did not parse it properly, reset the
+ ;; song name, and display the ICY string raw
(setq media/current-song-in-stream nil)
(setq media/current-song-in-stream nil)
-
- ;; If we did not parse it properly, show it
- (message "ICY Info \"%s\"" param))
+ (message "ICY Info \"%s\"" param)
+ )
(if (and media/current-song-in-stream media/current-information)
(media/show-current-information))
(if (and media/current-song-in-stream media/current-information)
(media/show-current-information))
@@
-162,7
+163,10
@@
load Emacs less. Nil means no timing."
("Starting"
(media/mplayer/write "get_time_length\n")
("Starting"
(media/mplayer/write "get_time_length\n")
- (if media/mplayer/capture-dir (media/mplayer/write "capturing\n"))
+ (when media/mplayer/capture-dir
+ (media/mplayer/write "capturing\n")
+ ;; (message "Capturing stream in %s" media/mplayer/capture-dir)
+ )
)
;; ----------------------------------------
)
;; ----------------------------------------
@@
-205,7
+209,7
@@
load Emacs less. Nil means no timing."
(string-match "\\(.*\\)[\n
\r
]+" media/mplayer/buffer start))
(setq start (1+ (match-end 1)))
(let ((line (match-string 1 media/mplayer/buffer)))
(string-match "\\(.*\\)[\n
\r
]+" media/mplayer/buffer start))
(setq start (1+ (match-end 1)))
(let ((line (match-string 1 media/mplayer/buffer)))
- (when (string-match
"^\\(AUDIO:\\|Exiting...\\|Starting\\|ANS_LENGTH\\|ANS_TIME_POSITION\\|Cache fill:\\|ICY Info:\\) *\\(.*\\)$"
line)
+ (when (string-match
media/mplayer/protocol-regexp
line)
(media/mplayer/filter-subfunctions (match-string 1 line) (match-string 2 line))))
)
(setq media/mplayer/buffer (substring media/mplayer/buffer start)))
(media/mplayer/filter-subfunctions (match-string 1 line) (match-string 2 line))))
)
(setq media/mplayer/buffer (substring media/mplayer/buffer start)))
@@
-249,7
+253,8
@@
load Emacs less. Nil means no timing."
media/song-current-time nil
media/mplayer/cumulated-duration 0
media/mplayer/last-current-time nil
media/song-current-time nil
media/mplayer/cumulated-duration 0
media/mplayer/last-current-time nil
- ))
+ )
+)
(defun media/api/cleanup () "Called when killing the application's buffer"
(when media/mplayer/process
(defun media/api/cleanup () "Called when killing the application's buffer"
(when media/mplayer/process
@@
-274,14
+279,15
@@
load Emacs less. Nil means no timing."
'("mplayer" nil "mplayer" "-slave" "-quiet")
media/mplayer/args
(when (string-match "\\(asx\\|m3u\\|pls\\|ram\\)$" media/mplayer/url)
'("mplayer" nil "mplayer" "-slave" "-quiet")
media/mplayer/args
(when (string-match "\\(asx\\|m3u\\|pls\\|ram\\)$" media/mplayer/url)
- (if media/mplayer/capture-dir (list "-dumpfile"
- (concat media/mplayer/capture-dir
- "/"
- (replace-regexp-in-string "[^a-zA-Z0-9\.]" "_" media/mplayer/url)
- (format-time-string "-%Y-%m-%d-%H:%M:%S"))
- "-capture"
- "-playlist"
- )
+ (if media/mplayer/capture-dir
+ (list "-dumpfile"
+ (concat media/mplayer/capture-dir
+ "/"
+ (replace-regexp-in-string "[^a-zA-Z0-9\.]" "_" media/mplayer/url)
+ (format-time-string "-%Y-%m-%d-%H:%M:%S"))
+ "-capture"
+ "-playlist"
+ )
(list "-playlist"))
)
(list (replace-regexp-in-string "^file://" "" media/mplayer/url)))
(list "-playlist"))
)
(list (replace-regexp-in-string "^file://" "" media/mplayer/url)))