(defgroup media ()
"Major mode to control media players"
- :version "1.2.1")
+ :version "1.2.2")
(defcustom media/player-api "media-mplayer"
"The file to load for the abstract layer with the media player."
;; Finding and playing URLs ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defun media/reset-current-information ()
+ (setq media/current-information nil
+ media/current-song-in-stream nil))
+
(defun media/format-url (url)
(if (string-match "^file:.*/\\([^/]+\\)$" url)
(match-string 1 url)
(time (get-text-property position 'time)))
(if (not url) (media/remove-highlight)
(run-hook-with-args 'media/before-play-hook url)
- (setq media/current-information nil
- media/current-song-in-stream nil)
+ (media/reset-current-information)
(media/api/play url)
;; We keep the information of the url and the title
(setq media/played-information (cons url (get-text-property position 'title)))
(defun media/stop () (interactive)
(message "Stop")
- (setq media/current-information nil
- media/current-song-in-stream nil)
+ (media/reset-current-information)
(media/api/stop))
(defun media/queue-song-at-point ()
(defun media/player-error ()
(message "Player error")
- (setq media/current-information nil
- media/current-song-in-stream nil)
+ (media/reset-current-information)
(media/remove-highlight))
(defun media/song-terminates ()
(with-current-buffer media/buffer
(if media/continue-mode (media/play-next t)
- (setq media/current-information nil
- media/current-song-in-stream nil)
+ (media/reset-current-information)
(media/remove-highlight))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(or (and (string= (car media/played-information) (nth 0 media/current-information))
(cdr media/played-information))
(replace-regexp-in-string "^.*/\\([^/]*\\)$" "\\1" (nth 0 media/current-information)))
- (if media/current-song-in-stream (concat "[" media/current-song-in-stream "] ") "")
+ ;; (if media/current-song-in-stream (concat "[" media/current-song-in-stream "] ") "")
+ (if media/current-song-in-stream (concat "| " media/current-song-in-stream " ") "")
(nth 1 media/current-information)
(if (= 2 (nth 2 media/current-information)) "stereo" "mono")
(nth 3 media/current-information))