emms-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emms-patches] darcs patch: emms-mp3tag support ogg, add more documentat


From: Ye Wenbin
Subject: [Emms-patches] darcs patch: emms-mp3tag support ogg, add more documentation. fix s...
Date: Wed, 06 Dec 2006 23:40:33 +0800

Wed Dec  6 23:35:28 CST 2006  Ye Wenbin <address@hidden>
  * emms-mp3tag support ogg, add more documentation. fix some error
New patches:

[emms-mp3tag support ogg, add more documentation. fix some error
Ye Wenbin <address@hidden>**20061206153528] {
hunk ./emms-history.el 26
-;; Next time use M-x emms-playlist-load-saved-list to load saved
-;; playlist
+;; Next time use M-x emms-history-load to load saved playlist
hunk ./emms-history.el 38
-(defvar emms-history-saved-list-file "~/.emacs.d/.emms-history")
+(defvar emms-history-file "~/.emacs.d/.emms-history"
+  "File to save playlists")
hunk ./emms-history.el 41
-(defun emms-history-save-on-exit ()
-  (when (stringp emms-history-saved-list-file)
+(defun emms-history-save ()
+  "Save all playlists that open in this emacs session when exit. Use
+`emms-history-load' to load saved playlists."
+  (interactive)
+  (when (stringp emms-history-file)
hunk ./emms-history.el 77
-          (write-file emms-history-saved-list-file))))))
+          (write-file emms-history-file))))))
hunk ./emms-history.el 79
-(add-hook 'kill-emacs-hook 'emms-history-save-on-exit)
+(add-hook 'kill-emacs-hook 'emms-history-save)
hunk ./emms-history.el 81
-(defun emms-history-load-saved-list ()
+(defun emms-history-load ()
hunk ./emms-history.el 83
-  (when (and (stringp emms-history-saved-list-file)
-             (file-exists-p emms-history-saved-list-file))
+  (when (and (stringp emms-history-file)
+             (file-exists-p emms-history-file))
hunk ./emms-history.el 87
-        (insert-file-contents emms-history-saved-list-file)
+        (insert-file-contents emms-history-file)
hunk ./emms-history.el 96
-            (condition-case nil
-                (emms-playlist-select (cadr playlist))
-              (error nil))))
+            (ignore-errors
+              (emms-playlist-select (cadr playlist)))))
hunk ./emms-history.el 101
-        (emms-start)))))
+        (ignore-errors
+          (emms-start))))))
hunk ./emms-i18n.el 1
-;;; emms-i18n.el --- 
+;;; emms-i18n.el --- Function for handling coding system
hunk ./emms-i18n.el 66
-    (emms-iconv-region-1 (point-min) (point-max) from to)))
+    (emms-iconv-region (point-min) (point-max) from to)))
hunk ./emms-i18n.el 84
+  "This function run program and return the program result. If the CAR
+part of `emms-default-coding-system' is non-nil, the program result will
+be decode use the CAR part of emms-default-coding-system. Otherwise,
+use `emms-coding-dectect-functions' to detect the coding system of the
+result. If the emms-coding-dectect-functions failed, use
+`emms-detect-coding-function' to detect coding system. If all the
+coding system is nil or in `emms-nerver-used-coding-system', decode
+the result using `emms-coding-system-for-read'.
+
+The result arguments ARGS is a list of string which pass to `call-process'."
hunk ./emms-i18n.el 100
-        (setq coding (emms-detect-buffer-coding-system))
-        (decode-coding-region (point-min) (point-max) coding))
+        (decode-coding-region (point-min) (point-max) 
(emms-detect-buffer-coding-system)))
hunk ./emms-i18n.el 103
+;; Is this function useful?
hunk ./emms-i18n.el 105
+  "Run the program like `call-process'. If
+the cdr part `emms-default-coding-system' is non-nil, the string in
+ARGS will be encode by the CDR part of `emms-default-coding-system',
+otherwise, it is pass all parameter to `call-process'."
hunk ./emms-info-ogginfo.el 74
-          (when (looking-at "^\t\\(.*\\)=\\(.*\\)$")
+          (when (looking-at "^\t\\(.*?\\)=\\(.*\\)$") ; recognize the first '='
hunk ./emms-lyrics.el 134
-    (setq file (funcall emms-lyrics-find-lyric-function file)))
+    (setq file
+          (and (functionp emms-lyrics-find-lyric-function)
+               (funcall emms-lyrics-find-lyric-function file))))
hunk ./emms-mark.el 155
+  "Predicate whether the playlist has marked line"
hunk ./emms-mark.el 164
-  "If your function don't move forward, set move to non-nil."
+  "Call FUNC on every marked line in current playlist. The FUNC take
+no argument, so if need the track in marked line, should use
+`emms-playlist-track-at' to get it. The FUNC can also modify the
+playlist buffer, such as delete the line. It is import for who want to
+use this function, this function didn't move forward. So if FUNC don't
+move forward, set the third parameter MOVE to non-nil. Otherwise, the
+function will never exit the loop."
hunk ./emms-mark.el 182
+  "This function does the same thing as
+`emms-mark-do-with-marked-track', the only difference is this function
+collect the result of FUNC."
hunk ./emms-mp3tag.el 1
-;;; emms-mp3tag.el ---
+;;; emms-mp3tag.el --- Edit track tags.
hunk ./emms-mp3tag.el 48
-    (info-note        . "c")))
+    (info-date        . "d")
+    (info-note        . "c"))
+"A list to setup format.")
hunk ./emms-mp3tag.el 57
-(defvar emms-mp3tag-format
-  `(("default"
-     ,(format "%%m\n%s\n\n"
-              (mapconcat
-               (lambda (tag)
-                 (concat (propertize (format "%-16s = " (symbol-name (car 
tag)))
-                                     'read-only t 'rear-nonsticky t)
-                         "%" (cdr tag)))
-               (append '((name . "f")) emms-mp3tag-tags) "\n"))
-     emms-mp3tag-default-parser))
-  "The contents of this variable should look like:
- ((NAME FORMATER PARSER) ...)
+(defun emms-mp3tag-make-format (tags)
+  (format "%%m\n%-16s = %%f\n%s\n\n" "name"
+          (mapconcat
+           (lambda (tag)
+             (concat (propertize (format "%-16s = " (symbol-name tag))
+                                 'read-only t 'rear-nonsticky t 'face 'bold)
+                     "%" (cdr (assoc tag emms-mp3tag-tags))))
+           tags "\n")))
hunk ./emms-mp3tag.el 66
-The NAME is use to select proper format, and FORMATER should be a
-string or a function. When it is a string, it can use specification
-as:
+(defvar emms-mp3tag-formats
+  (let* ((tags (mapcar 'car emms-mp3tag-tags))
+         (default (emms-mp3tag-make-format (remove 'info-date tags))))
+    `(("mp3" . ,default)
+      ("ogg" . ,(emms-mp3tag-make-format (remove 'info-year tags)))
+      ("default" . ,default)))
+  "Format to insert the track. The CAR part is the extension of the
+track name, and the CDR part is the format template. The format
+specification is like:
hunk ./emms-mp3tag.el 85
-When it is a function, it recept a parameter, the track, and should
-return a string that to insert to `emms-mp3tag-edit-buffer'.
+You can add new specification in `emms-mp3tag-tags' and use
+`emms-mp3tag-make-format' to help create a new format.
hunk ./emms-mp3tag.el 88
-The PARSER is a function to collect all track info in
-`emms-mp3tag-edit-buffer'. It should return the new tracks. If
-the track tag changed, it should add a new property tag-modified
-and set to non-nil. If the track name change, it should set new
-newname to the new file name.
+The CDR part also can be a function, which accept one parameter, the
+track, and should return a string to insert to `emms-mp3tag-edit-buffer'.
hunk ./emms-mp3tag.el 92
-(defvar emms-mp3tag-selected-format
-  (assoc "default" emms-mp3tag-format))
+(defvar emms-mp3tag-get-format-function 'emms-mp3tag-get-format
+  "Function to decide which format to use for format the track.")
hunk ./emms-mp3tag.el 95
-(defun emms-mp3tag-select-format (format)
-  (interactive
-   (list (completing-read "Set edit format to: "
-                          emms-mp3tag-format nil t)))
-  (setq emms-mp3tag-select-format (assoc "default" emms-mp3tag-format)))
+(defvar emms-mp3tag-parse-function 'emms-mp3tag-default-parser
+  "Function to parse tags in `emms-mp3tag-edit-buffer'. It should find
+all modified tags, and return all the tracks. The tracks which tag has
+been modified should set a property 'tag-modified to t, and if the
+track name have been change, the function should set a new property
+'newname instead set the 'name directly.
+
+See also `emms-mp3tag-default-parser'.")
+
+(defvar emms-mp3tag-tagfile-functions
+  '(("mp3" "mp3info"
+     ((info-artist      . "a")
+      (info-title       . "t")
+      (info-album       . "l")
+      (info-tracknumber . "n")
+      (info-year        . "y")
+      (info-genre       . "g")
+      (info-note        . "c")))
+    ("ogg" . emms-mp3tag-tag-ogg))
+  "A List for change tag in files. If the extern program set tag by
+command line options one by one such as mp3info, the list should like:
+ (EXTENSION PROGRAM COMMAND_LINE_OPTIONS)
+
+Otherwise, a function that accept a parameter, the track, should be
+given.
+
+See also `emms-mp3tag-tag-file' and `emms-mp3tag-tag-ogg'.
+")
+
+(defun emms-mp3tag-tag-ogg (track)
+  (call-process "vorbiscomment" nil nil nil
+                "-w" "-t"
+                (mapconcat
+                 (lambda (tag)
+                   (concat tag "="
+                           (emms-track-get track (intern (concat "info-" 
tag)))))
+                 '("artist" "title" "album" "tracknumber" "date" "genre" 
"note")
+                 "\n\t")
+                (emms-track-name track)))
hunk ./emms-mp3tag.el 135
-(defun emms-mp3tag-format-track (format track)
-  (if (stringp format)
+(defun emms-mp3tag-tag-file (track program tags)
+  "Change tag in FILE use PROGRAM. The TAGS is given in 
`emms-mp3tag-tagfile-functions'."
+  (let (args val)
+    (mapc (lambda (tag)
+            (when (> (length (setq val (emms-track-get track (car tag)))) 0)
+              (setq args (append args (list (concat "-" (cdr tag)) val)))))
+          tags)
+    (apply 'call-process program
+           nil nil nil
+           filename args)))
+
+(defun emms-mp3tag-get-format (track)
+  (let ((format
+         (assoc (file-name-extension (emms-track-name track))
+                emms-mp3tag-formats)))
+    (if format
+        (cdr format)
+      (cdr (assoc "default" emms-mp3tag-formats)))))
+
+(defun emms-mp3tag-format-track (track)
+  (let ((format (funcall emms-mp3tag-get-format-function track)))
+    (if (functionp format)
+        (funcall format track)
hunk ./emms-mp3tag.el 166
-                     (mapcar
-                      (lambda (pair)
-                        (list (aref (cdr pair) 0)
-                              (or (emms-track-get track (car pair)) "")))
-                      emms-mp3tag-tags))))
-    (funcall format track)))
+                     (mapcar (lambda (tag)
+                               (list (string-to-char (cdr tag))
+                                     (or (emms-track-get track (car tag)) "")))
+                             emms-mp3tag-tags)))))))
hunk ./emms-mp3tag.el 186
-;; (defun emms-mp3tag-insert-track (track)
-;;   (cond ((null track) nil)
-;;         ((not (eq (emms-track-get track 'type) 'file))
-;;          (emms-mp3tag-log "Track %s is not a local file!" (emms-track-name 
track)))
-;;         ((not (file-writable-p (emms-track-name track)))
-;;          (emms-mp3tag-log "The file %s is not writable" (emms-track-name 
track)))
-;;         (t (insert (emms-mp3tag-format-track
-;;                     (cadr emms-mp3tag-selected-format) track)))))
-
hunk ./emms-mp3tag.el 188
-       (insert (emms-mp3tag-format-track
-                (cadr emms-mp3tag-selected-format) track))))
+       (insert (emms-mp3tag-format-track track))))
hunk ./emms-mp3tag.el 196
-    (emms-mp3tag-mode 1)
+    (emms-mp3tag-mode)
hunk ./emms-mp3tag.el 215
+  "Edit tags of track at point or marked tracks"
hunk ./emms-mp3tag.el 231
-    (define-key map "\C-c\C-c" 'emms-mp3tag-submit)
+    (define-key map "\C-c\C-c" 'emms-mp3tag-submit-and-exit)
+    (define-key map "\C-c\C-s" 'emms-mp3tag-submit)
hunk ./emms-mp3tag.el 237
-(define-minor-mode emms-mp3tag-mode
-  "A minor mode to edit mp3tag.
-\\{emms-mp3tag-mode-map}"
-  :lighter " MP3Tag"
-  :keymap emms-mp3tag-mode-map)
+(define-derived-mode emms-mp3tag-mode text-mode "Mp3tag"
+  "Major mode to edit track tags.
+\\{emms-mp3tag-mode-map}")
hunk ./emms-mp3tag.el 242
+  "Replace all track's NAME to VALUE. If turn transient-mark-mode on,
+you can apply the command to a selected region."
hunk ./emms-mp3tag.el 249
-    (goto-char (point-min))
-    (while (re-search-forward (concat "^" (regexp-quote name)) nil t)
-      (skip-chars-forward " \t=")
-      (delete-region (point) (line-end-position))
-      (insert value))))
+    (save-restriction
+      (if (and mark-active transient-mark-mode)
+          (narrow-to-region (region-beginning) (region-end)))
+      (goto-char (point-min))
+      (while (re-search-forward (concat "^" (regexp-quote name)) nil t)
+        (skip-chars-forward " \t=")
+        (delete-region (point) (line-end-position))
+        (insert value)))))
hunk ./emms-mp3tag.el 299
-(defun emms-mp3tag-submit ()
-  (interactive)
-  (let ((tracks (funcall (nth 2 emms-mp3tag-selected-format)))
-        filename exit old pos args val need-sync)
+(defun emms-mp3tag-submit (arg)
+  "Make modified tags take affect. With prefiex argument, bury tag
+edit buffer."
+  (interactive "P")
+  (let ((tracks (funcall emms-mp3tag-parse-function))
+        filename func exit old pos val need-sync)
hunk ./emms-mp3tag.el 329
-            (setq args nil)
hunk ./emms-mp3tag.el 331
-                (emms-track-set old (car tag) val)
-                (setq args (append args (list (concat "-" (cdr tag)) val)))))
+                (emms-track-set old (car tag) val)))
hunk ./emms-mp3tag.el 333
-            (if (and (eq (emms-track-get track 'type) 'file)
-                     (file-writable-p (emms-track-name track))
-                     (string-match "\\.mp3\\'" filename))
-                (if (zerop (setq exit
-                                 (apply 'call-process 
emms-info-mp3info-program-name
-                                        nil nil nil
-                                        filename args)))
-                    ;; for `emms-cache-sync' not call `emms-info-functions' 
again
-                    (emms-track-get track 'info-mtime (butlast (current-time)))
-                  (emms-mp3tag-log "Change tags of %s failed with exit value 
%d" filename exit)))
+            (when (and (eq (emms-track-get track 'type) 'file)
+                       (file-writable-p (emms-track-name track))
+                       (setq func (assoc (file-name-extension filename) 
emms-mp3tag-tagfile-functions)))
+              (setq exit
+                    (if (functionp (cdr func))
+                        (funcall (cdr func) track)
+                      (emms-mp3tag-tag-file track (cadr func) (nth 2 func))))
+              (if (zerop exit)
+                  (emms-track-get track 'info-mtime (butlast (current-time)))
+                (emms-mp3tag-log "Change tags of %s failed with exit value %d" 
filename exit)))
hunk ./emms-mp3tag.el 354
-      (message "Set all mp3 tag done!"))))
+      (message "Set all mp3 tag done!")))
+  (if arg (bury-buffer)))
+
+(defun emms-mp3tag-submit-and-exit ()
+  (interactive)
+  (emms-mp3tag-submit t))
}

Context:

[Fix a silly bug in emms-mp3tag. Remove timestamp.
Ye Wenbin <address@hidden>**20061206020710] 
[AUTHORS: Added Ye Wenbin
address@hidden 
[Fix lyrics minibuffer display. Amixer display playback and more useful commands
Wenbin Ye <address@hidden>**20061127154113] 
[Edit all track, set tag to file for mp3
Wenbin Ye <address@hidden>**20061205112209] 
[Add emms-mp3tag and emms-i18n
Wenbin Ye <address@hidden>**20061205065407] 
[Add emms-mark and emms-history
address@hidden 
[emms-info-mp3info.el: Replace `emms-iconv' with decode-coding-string and
address@hidden
 encode-coding-string.
] 
[emms.el: Fix bug introduced by recent changes to 
emms-playlist-set-playlist-buffer
Michael Olson <address@hidden>**20061119204738] 
[Default to current buffer when setting the current EMMS playlist buffer.
Michael Olson <address@hidden>**20061119053410] 
[manual: Add documentation for new emms-playlist-mode keybindings
Michael Olson <address@hidden>**20061119052935] 
[emms-playlist-mode: Bind "b" key to emms-playlist-set-playlist-buffer.
Michael Olson <address@hidden>**20061119052907] 
[emms-playlist-mode: Implement adding the thing at point to the current 
playlist.  If it is a playlist, add its contents instead.  Map this to the "a" 
key.
Michael Olson <address@hidden>**20061119052254] 
[emms.el: In emms-playlist-set-playlist-buffer, prompt user from available EMMS 
playlist buffers rather than all buffers, and display feedback upon setting the 
current buffer, since this is not an easy change to see
Michael Olson <address@hidden>**20061119052023] 
[emms.el: Fix compiler warning
Michael Olson <address@hidden>**20061119051946] 
[Don't add subdirectories for directory and playlist-directory source insert 
methods
Michael Olson <address@hidden>**20061119041900] 
[emms-playing-time.el: New variable `emms-playing-time-style', it
address@hidden
 supports two styles at present, `time' and `bar'.
] 
[bind SPC to `scroll-up' in emms-playlist-mode and update manual.
address@hidden 
[emms-player-mpd: Deal with change in output when getting supported file types
Michael Olson <address@hidden>**20061028042119] 
[emms.el: Move macros to the top of the file.
address@hidden 
[NEWS: Add entry for recent emms-player-mpd change
Michael Olson <address@hidden>**20061023125738] 
[emms-player-mpd: Handle errors that occur when we begin playback
Michael Olson <address@hidden>**20061022215310] 
[NEWS: Version 2 is version 2.0
address@hidden 
[emms-playlist-mode: Handle case where selection has not been set but user 
wants to delete a region
Michael Olson <address@hidden>**20061022201724] 
[emms-playlist-mode: Fix typo in hook name
Michael Olson <address@hidden>**20061022022812] 
[emms-player-mpd: Update version recommendation
Michael Olson <address@hidden>**20061022012223] 
[emms-player-mpd: Work properly with tracks inserted by emms-browser
Michael Olson <address@hidden>**20061022011050] 
[Add NEWS items since version 2.1
Michael Olson <address@hidden>**20061017222117] 
[emms-player-mplayer.el: Mplayer also supports .vob files.
address@hidden 
[emms-player-mpd: When using the emms-volume interface, allow the user to 
specify the amount of change in the volume
Michael Olson <address@hidden>**20061017220404] 
[Documentation cleanups in emms-player-mpd and emms-source-playlist
Michael Olson <address@hidden>**20061017215345] 
[Since emms-player-seeked-to-functions and emms-player-time-set-functions hooks 
do the same thing, replace the former with the latter
Michael Olson <address@hidden>**20061017210238] 
[emms-browser: Fix compiler warning
Michael Olson <address@hidden>**20061017205310] 
[emms-player-mpd: Implement seek-to support
Michael Olson <address@hidden>**20061017205106] 
[FluidSynth midi file player
address@hidden 
[Added delYsid
address@hidden 
[jackd-support-for-emacs
address@hidden
 jackd is a pro-audio server which can be used as a backend for
 alsaplayer, mplayer, and lots of other linux audio apps.
 This module allows to start jackd from within emacs, and
 connect/disconnect jack client ports.
] 
[browser: ensure the RNG is seeded before use
Damien Elmes <address@hidden>**20061011151535] 
[browser: require sort (fixes bug with sort-fold-case being void)
Damien Elmes <address@hidden>**20061010125718] 
[fix faulty emms-playlist-mode keybinding, fix due to William and Damien.
address@hidden 
[Added seeking to the playlist keymap, and updated the manual.
address@hidden 
[emms-player-mpd: Only display error if we are certain that url.el is not 
up-to-date
Michael Olson <address@hidden>**20061004032213] 
[seek-for-alsaplayer
address@hidden
 Add relative seek support for alsaplayer
] 
[midi-files-via-timidity
address@hidden
 A simple-player definition for timidity
] 
[emms-playing-time.el: Minor cleanups.
address@hidden 
[emms-lyrics.el: Minor Cleanups.
address@hidden 
[pause-for-alsaplayer
address@hidden
 Get pause/resume working for alsaplayer
] 
[mms-for-mplayer
address@hidden
 mplayer also supports mms:// URLs
] 
[DoTheRightThing with player pausing and emms-bookmarks.el
address@hidden 
[Added emms-bookmarks.el
address@hidden 
[Added `emms-pause' to emms-playlist-mode.el bound to to ``P''.
address@hidden 
[browser: add deletion started/finished message
Damien Elmes <address@hidden>**20060923051128] 
[Added a link to the online version of the manual.
address@hidden 
[emms-playing-time.el now works with `seek-to'.
address@hidden 
[Added `seek-to' to emms.el and emms-player-mplayer.el.
address@hidden 
[browser/cache: support deleting files, make emms-cache-dirty a defsubst
Damien Elmes <address@hidden>**20060922090553] 
[TAG 2.1
address@hidden 
Patch bundle hash:
d5f770321126fa5b43cf6048de846be2907def95

reply via email to

[Prev in Thread] Current Thread [Next in Thread]