diff options
-rw-r--r-- | emms-info-libtag.el | 2 | ||||
-rw-r--r-- | emms-info-mp3info.el | 2 | ||||
-rw-r--r-- | emms-info-ogg.el | 7 | ||||
-rw-r--r-- | emms-info-ogginfo.el | 20 | ||||
-rw-r--r-- | emms-metaplaylist-mode.el | 21 | ||||
-rw-r--r-- | emms-mode-line-icon.el | 7 | ||||
-rw-r--r-- | emms-mode-line.el | 16 | ||||
-rw-r--r-- | emms-player-simple.el | 3 | ||||
-rw-r--r-- | emms-playlist-mode.el | 57 | ||||
-rw-r--r-- | emms-playlist-sort.el | 17 | ||||
-rw-r--r-- | emms-score.el | 2 | ||||
-rw-r--r-- | emms-setup.el | 16 | ||||
-rw-r--r-- | emms-stream-info.el | 10 | ||||
-rw-r--r-- | emms-streams.el | 15 |
14 files changed, 100 insertions, 95 deletions
diff --git a/emms-info-libtag.el b/emms-info-libtag.el index b5b6543..e3b7d9a 100644 --- a/emms-info-libtag.el +++ b/emms-info-libtag.el @@ -35,6 +35,8 @@ ;;; Code: +(require 'emms-info) + (defvar emms-info-libtag-coding-system 'utf-8) (defvar emms-info-libtag-program-name "emms-print-metadata") diff --git a/emms-info-mp3info.el b/emms-info-mp3info.el index 75368f4..fade64e 100644 --- a/emms-info-mp3info.el +++ b/emms-info-mp3info.el @@ -35,6 +35,8 @@ ;;; Code: +(require 'emms-info) + (defvar emms-info-mp3info-version "0.2 $Revision: 1.10 $" "EMMS info mp3info version string.") ;; $Id: emms-info-mp3info.el,v 1.10 2005/08/12 18:01:16 xwl Exp $ diff --git a/emms-info-ogg.el b/emms-info-ogg.el index 7d5ce02..6178415 100644 --- a/emms-info-ogg.el +++ b/emms-info-ogg.el @@ -61,13 +61,14 @@ ogg-comments.el" (when (and (eq 'file (emms-track-type track)) (string-match "\\.[Oo][Gg][Gg]\\'" (emms-track-name track))) (let ((info (oggc-read-header (emms-track-name track))) - (file (emms-track-get track 'name))) + (file (emms-track-get track 'name)) + ptime-total ptime-min ptime-sec) (with-temp-buffer (call-process "ogginfo" nil t nil file) (goto-char (point-min)) (re-search-forward "Playback length: \\([0-9]*\\)m:\\([0-9]*\\)") - (let ((minutes (string-to-int (match-string 1))) - (seconds (string-to-int (match-string 2)))) + (let ((minutes (string-to-number (match-string 1))) + (seconds (string-to-number (match-string 2)))) (setq ptime-total (+ (* minutes 60) seconds) ptime-min minutes ptime-sec seconds))) diff --git a/emms-info-ogginfo.el b/emms-info-ogginfo.el index b6d8414..b6f4a0e 100644 --- a/emms-info-ogginfo.el +++ b/emms-info-ogginfo.el @@ -25,6 +25,8 @@ ;;; Code: +(require 'emms-info) + (defgroup emms-info-ogginfo nil "An EMMS-info method for getting, using the external ogginfo program" @@ -54,15 +56,15 @@ This is a useful element for `emms-info-functions'." ;; play time, emms-info-ogg.el [U. Jensen] (goto-char (point-min)) (re-search-forward "Playback length: \\([0-9]*\\)m:\\([0-9]*\\)") - (let ((minutes (string-to-int (match-string 1))) - (seconds (string-to-int (match-string 2)))) - (setq ptime-total (+ (* minutes 60) seconds) - ptime-min minutes - ptime-sec seconds)) - (emms-track-set track 'info-playing-time ptime-total) - (emms-track-set track 'info-playing-time-min ptime-min) - (emms-track-set track 'info-playing-time-sec ptime-sec) - (emms-track-set track 'info-file (emms-track-name track)) + (let* ((minutes (string-to-number (match-string 1))) + (seconds (string-to-number (match-string 2))) + (ptime-total (+ (* minutes 60) seconds)) + (ptime-min minutes) + (ptime-sec seconds)) + (emms-track-set track 'info-playing-time ptime-total) + (emms-track-set track 'info-playing-time-min ptime-min) + (emms-track-set track 'info-playing-time-sec ptime-sec) + (emms-track-set track 'info-file (emms-track-name track))) ;; all the rest of the info available (goto-char (point-min)) diff --git a/emms-metaplaylist-mode.el b/emms-metaplaylist-mode.el index 42d7c4f..f80c9bb 100644 --- a/emms-metaplaylist-mode.el +++ b/emms-metaplaylist-mode.el @@ -29,6 +29,7 @@ ;;; Code: +(require 'emms) (require 'emms-playlist-mode) ;;; -------------------------------------------------------- @@ -73,14 +74,14 @@ ;;; -------------------------------------------------------- (defconst emms-metaplaylist-mode-map - (let ((emms-metaplaylist-mode-map (make-sparse-keymap))) - (set-keymap-parent emms-metaplaylist-mode-map text-mode-map) - (define-key emms-metaplaylist-mode-map (kbd "n") 'next-line) - (define-key emms-metaplaylist-mode-map (kbd "p") 'previous-line) - (define-key emms-metaplaylist-mode-map (kbd "RET") 'emms-metaplaylist-mode-goto-current) - (define-key emms-metaplaylist-mode-map (kbd "q") 'kill-this-buffer) - (define-key emms-metaplaylist-mode-map (kbd "?") 'describe-mode) - emms-metaplaylist-mode-map) + (let ((map (make-sparse-keymap))) + (set-keymap-parent map text-mode-map) + (define-key map (kbd "n") 'next-line) + (define-key map (kbd "p") 'previous-line) + (define-key map (kbd "RET") 'emms-metaplaylist-mode-goto-current) + (define-key map (kbd "q") 'kill-this-buffer) + (define-key map (kbd "?") 'describe-mode) + map) "Keymap for `emms-metaplaylist-mode'.") ;;; -------------------------------------------------------- @@ -113,7 +114,9 @@ (playlists (get-emms-playlist-buffers))) (if playlists (progn - (ignore-errors (kill-buffer name)) + (condition-case nil + (kill-buffer name) + (error nil)) (get-buffer-create name) (with-current-buffer name (emms-metaplaylist-mode) diff --git a/emms-mode-line-icon.el b/emms-mode-line-icon.el index 04699f3..b823bcf 100644 --- a/emms-mode-line-icon.el +++ b/emms-mode-line-icon.el @@ -41,8 +41,8 @@ For example, if you want to have something like : \[ <icon> Foo - The Foo Song ] You should set it to \"[\", and set emms-mode-line-format to \"%s ]\"") -(setq emms-mode-line-icon-image-cache - `(image :type xpm :ascent center :data ,(concat "/* XPM */ +(defvar emms-mode-line-icon-image-cache + `(image :type xpm :ascent center :data ,(concat "/* XPM */ static char *note[] = { /* width height num_colors chars_per_pixel */ \" 10 11 2 1\", @@ -67,8 +67,7 @@ static char *note[] = { (concat " " emms-mode-line-icon-before-format (propertize "NP:" 'display emms-mode-line-icon-image-cache) - (format emms-mode-line-format (emms-info-file-info-song-artist - (emms-playlist-current-selected-track))))) + (emms-mode-line-playlist-current))) (setq emms-mode-line-mode-line-function 'emms-mode-line-icon-function) diff --git a/emms-mode-line.el b/emms-mode-line.el index 83f1e67..4730393 100644 --- a/emms-mode-line.el +++ b/emms-mode-line.el @@ -53,22 +53,12 @@ (defun emms-mode-line-playlist-current () "Format the currently playing song" - (format - emms-mode-line-format - (let* ((track (emms-playlist-current-selected-track)) - (artist (emms-track-get track 'info-artist)) - (title (emms-track-get track 'info-title)) - (type (emms-track-type track))) - ;; when artist or title info cann't be achieved, show file name - ;; without directory. - (if (and (not (and artist title)) - (eq 'file type)) - (file-name-nondirectory (emms-track-name track)) - (emms-track-description - (emms-playlist-current-selected-track)))))) + (format emms-mode-line-format (emms-track-description + (emms-playlist-current-selected-track)))) (defvar emms-mode-line-active-p nil "If non-nil, emms mode line is active.") +(defvar emms-mode-line-string "") (defvar emms-mode-line-initial-titlebar frame-title-format) diff --git a/emms-player-simple.el b/emms-player-simple.el index 47a9fd8..9bb8196 100644 --- a/emms-player-simple.el +++ b/emms-player-simple.el @@ -78,7 +78,8 @@ to call the player and ARGS are the command line arguements." :group ',group) (defcustom ,player-name (emms-player ',start ',stop ',playablep) ,(concat "*A player for EMMS.") - :type '(cons symbol alist)) + :type '(cons symbol alist) + :group ',group) (emms-player-set ,player-name 'regex ,regex) (emms-player-set ,player-name 'pause 'emms-player-simple-pause) (emms-player-set ,player-name 'resume 'emms-player-simple-resume) diff --git a/emms-playlist-mode.el b/emms-playlist-mode.el index b884094..2924e03 100644 --- a/emms-playlist-mode.el +++ b/emms-playlist-mode.el @@ -33,12 +33,17 @@ ;;; Variables ;;; -------------------------------------------------------- +(require 'emms) + (defvar emms-playlist-mode-hook nil "Emms playlist mode hook.") (defvar emms-playlist-mode-selected-overlay-marker nil "Marker for last selected track. Use for updating the display.") +(defvar emms-playlist-mode-selected-overlay nil + "Last selected track. Use for updating the display.") + (defvar emms-playlist-mode-switched-buffer nil "Last buffer visited before calling `emms-playlist-mode-switch-buffer'.") @@ -55,7 +60,7 @@ (defgroup emms-playlist-mode nil "*The Emacs Multimedia System playlist mode." :prefix "emms-playlist-mode-" - :group 'multimedia) + :group 'emms) ;;; -------------------------------------------------------- ;;; Faces @@ -84,31 +89,31 @@ ;;; -------------------------------------------------------- (defconst emms-playlist-mode-map - (let ((emms-playlist-mode-map (make-sparse-keymap))) - (set-keymap-parent emms-playlist-mode-map text-mode-map) - (define-key emms-playlist-mode-map (kbd "C-x C-s") 'emms-playlist-mode-save-buffer) - (define-key emms-playlist-mode-map (kbd "C-y") 'emms-playlist-mode-yank) - (define-key emms-playlist-mode-map (kbd "C-k") 'emms-playlist-mode-kill-track) - (define-key emms-playlist-mode-map (kbd "C-w") 'emms-playlist-mode-kill) - (define-key emms-playlist-mode-map (kbd "C-_") 'emms-playlist-mode-undo) - (define-key emms-playlist-mode-map (kbd "C-n") 'next-line) - (define-key emms-playlist-mode-map (kbd "C-p") 'previous-line) - (define-key emms-playlist-mode-map (kbd "C-j") 'emms-playlist-mode-insert-newline) - (define-key emms-playlist-mode-map (kbd "M-y") 'emms-playlist-mode-yank-pop) - (define-key emms-playlist-mode-map (kbd "M-<") 'emms-playlist-mode-first) - (define-key emms-playlist-mode-map (kbd "M->") 'emms-playlist-mode-last) - (define-key emms-playlist-mode-map (kbd "d") 'emms-playlist-mode-kill-track) - (define-key emms-playlist-mode-map (kbd "n") 'emms-next) - (define-key emms-playlist-mode-map (kbd "p") 'emms-previous) - (define-key emms-playlist-mode-map (kbd "s") 'emms-stop) - (define-key emms-playlist-mode-map (kbd "f") 'emms-show) - (define-key emms-playlist-mode-map (kbd "c") 'emms-playlist-mode-center-current) - (define-key emms-playlist-mode-map (kbd "q") 'bury-buffer) - (define-key emms-playlist-mode-map (kbd "?") 'describe-mode) - (define-key emms-playlist-mode-map (kbd "r") 'emms-random) - (define-key emms-playlist-mode-map (kbd "<mouse-2>") 'emms-playlist-mode-play-current-track) - (define-key emms-playlist-mode-map (kbd "RET") 'emms-playlist-mode-play-current-track) - emms-playlist-mode-map) + (let ((map (make-sparse-keymap))) + (set-keymap-parent map text-mode-map) + (define-key map (kbd "C-x C-s") 'emms-playlist-mode-save-buffer) + (define-key map (kbd "C-y") 'emms-playlist-mode-yank) + (define-key map (kbd "C-k") 'emms-playlist-mode-kill-track) + (define-key map (kbd "C-w") 'emms-playlist-mode-kill) + (define-key map (kbd "C-_") 'emms-playlist-mode-undo) + (define-key map (kbd "C-n") 'next-line) + (define-key map (kbd "C-p") 'previous-line) + (define-key map (kbd "C-j") 'emms-playlist-mode-insert-newline) + (define-key map (kbd "M-y") 'emms-playlist-mode-yank-pop) + (define-key map (kbd "M-<") 'emms-playlist-mode-first) + (define-key map (kbd "M->") 'emms-playlist-mode-last) + (define-key map (kbd "d") 'emms-playlist-mode-kill-track) + (define-key map (kbd "n") 'emms-next) + (define-key map (kbd "p") 'emms-previous) + (define-key map (kbd "s") 'emms-stop) + (define-key map (kbd "f") 'emms-show) + (define-key map (kbd "c") 'emms-playlist-mode-center-current) + (define-key map (kbd "q") 'bury-buffer) + (define-key map (kbd "?") 'describe-mode) + (define-key map (kbd "r") 'emms-random) + (define-key map (kbd "<mouse-2>") 'emms-playlist-mode-play-current-track) + (define-key map (kbd "RET") 'emms-playlist-mode-play-current-track) + map) "Keymap for `emms-playlist-mode'.") (defmacro emms-playlist-mode-move-wrapper (name fun) diff --git a/emms-playlist-sort.el b/emms-playlist-sort.el index 2346d7e..ee3671a 100644 --- a/emms-playlist-sort.el +++ b/emms-playlist-sort.el @@ -59,11 +59,17 @@ (> (emms-score-get-score (emms-track-get a 'name)) (emms-score-get-score (emms-track-get b 'name)))))) +(defgroup emms-playlist-sort nil + "*Sorting Emacs Multimedia System playlists." + :prefix "emms-playlist-sort-" + :group 'emms) + ;; FIXME: Should better avoid relying on setting before loading. (defcustom emms-playlist-sort-prefix "S" "*Prefix key sequence for `emms-playlist-sort-map'. You should set this variable before loading this file." - :type 'string) + :type 'string + :group 'emms-playlist-sort) (defvar emms-playlist-sort-map (let ((map (make-sparse-keymap))) @@ -75,10 +81,11 @@ You should set this variable before loading this file." (define-key map (kbd "o") 'emms-playlist-sort-by-info-note) map)) -(eval-after-load "emms-playlist-sort.el" - (define-key emms-playlist-mode-map - emms-playlist-sort-prefix - emms-playlist-sort-map)) +(eval-after-load "emms-playlist-mode" + (and (boundp 'emms-playlist-mode-map) + (define-key emms-playlist-mode-map + emms-playlist-sort-prefix + emms-playlist-sort-map))) (defun emms-playlist-sort (predicate) "Sort the whole playlist buffer by PREDICATE." diff --git a/emms-score.el b/emms-score.el index 891866f..8bc93c0 100644 --- a/emms-score.el +++ b/emms-score.el @@ -58,6 +58,8 @@ ;; 2. bug: everything(playing time, lyrics, ...) disppears on mode line ;; when calling `emms-score-next-noerror'. +(require 'emms) + (defvar emms-scores-list nil) (defvar emms-score-current-mood 'default) (defvar emms-score-min-score 0) diff --git a/emms-setup.el b/emms-setup.el index c8326be..96f57c6 100644 --- a/emms-setup.el +++ b/emms-setup.el @@ -37,6 +37,8 @@ ;;; Code: +(require 'emms) + (defgroup emms-setup nil "*The Emacs Multimedia System setup utility." :prefix "emms-setup" @@ -54,7 +56,6 @@ (defun emms-minimalistic () "An Emms setup script. Invisible playlists and all the basics for playing media." - (require 'emms) (require 'emms-source-file) (require 'emms-player-simple) (require 'emms-player-mplayer)) @@ -85,12 +86,13 @@ stable features which come with the Emms distribution." ;; include (emms-standard) ;; define - (require 'emms-mode-line) - (require 'emms-streams) - (require 'emms-lyrics) - (require 'emms-playing-time) - (require 'emms-player-mpd) - (require 'emms-playlist-sort) + (eval-and-compile + (require 'emms-mode-line) + (require 'emms-streams) + (require 'emms-lyrics) + (require 'emms-playing-time) + (require 'emms-player-mpd) + (require 'emms-playlist-sort)) ;; setup (emms-mode-line 1) (emms-mode-line-blank) diff --git a/emms-stream-info.el b/emms-stream-info.el index 8a6b245..93c0de4 100644 --- a/emms-stream-info.el +++ b/emms-stream-info.el @@ -69,6 +69,8 @@ ;;; Code: +(require 'emms) + ;; A higher value for 'emms-stream-info-max' this gives us a ;; correspondingly higher chance of grabbing the title information ;; from a stream but incurs a price in the additional time it takes to @@ -624,9 +626,11 @@ Optional argument CONT boolean." (if urlstring (emms-stream-info-parse-url urlstring) - (emms-stream-info-parse-url - ;; possible bug, what if there is no last stream? - (emms-stream-url emms-stream-last-stream))) + (and (boundp 'emms-stream-last-stream) + (fboundp 'emms-stream-url) + emms-stream-last-stream + (emms-stream-info-parse-url + (emms-stream-url emms-stream-last-stream)))) (emms-stream-info-reset-state) diff --git a/emms-streams.el b/emms-streams.el index 004348a..dec8318 100644 --- a/emms-streams.el +++ b/emms-streams.el @@ -426,21 +426,6 @@ Don't forget to save your modifications !" ; (add-to-list 'emms-info-methods-list 'emms-info-url) -(defun emms-info-file-info-song-artist (track) - "Returns a description of TRACK, build from its comments. - -If the track already indicates artist and title, use it. -Otherwise return the name of the track." - (let ((name (and track (emms-track-name track)))) - (if (null name) - "Invalid track!" - (let ((artist (emms-track-get track 'info-artist)) - (title (emms-track-get track 'info-title))) - (if (and artist (not (string= artist "")) - title (not (string= title ""))) - (concat artist " - " title) - (file-name-sans-extension (file-name-nondirectory name))))))) - (defun emms-stream-add-data-to-track (track) (emms-track-set track 'metadata emms-stream-last-stream)) |