1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
;;; emms-info-mp3info.el --- Info-method for EMMS using mp3info
;; Copyright (C) 2003 Free Software Foundation, Inc.
;; Authors: Ulrik Jensen <terryp@daimi.au.dk>
;; Jorgen Schäfer <forcer@forcix.cx>
;; Keywords:
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
;; Boston, MA 02110-1301 USA
;;; Commentary:
;; This code has been adapted from code found in mp3player.el, written
;; by Jean-Philippe Theberge (jphiltheberge@videotron.ca), Mario
;; Domgoergen (kanaldrache@gmx.de) and Jorgen Schäfer
;; <forcer@forcix.cx>
;; To activate this method for getting info, use something like:
;; (require 'emms-info-mp3info)
;; (add-to-list 'emms-info-functions 'emms-info-mp3info)
;;; Code:
(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 $
(defgroup emms-info-mp3info nil
"An EMMS-info method for getting/setting ID3v1 tags, using the
external mp3info program"
:group 'emms-info)
(defcustom emms-info-mp3info-program-name "mp3info"
"*The name/path of the mp3info tag program."
:type 'string
:group 'emms-info-mp3info)
(defcustom emms-info-mp3findo-arguments
`("-p" ,(concat "info-artist=%a\\n"
"info-title=%t\\n"
"info-album=%l\\n"
"info-tracknum=%n\\n"
"info-year=%y\\n"
"info-genre=%g\\n"
"info-note=%c\\n"
"info-playing-time=%S\\n"))
"The argument to pass to `emms-info-mp3info-program-name'.
This should be a list of info-flag=value lines."
:type '(repeat string)
:group 'emms-info-mp3info)
(defun emms-info-mp3info (track)
"Add track information to TRACK.
This is a useful element for `emms-info-functions'."
(when (eq 'file (emms-track-type track))
(with-temp-buffer
(when (zerop (apply 'call-process
emms-info-mp3info-program-name
nil t nil
(emms-track-name track)
emms-info-mp3findo-arguments))
(goto-char (point-min))
(while (looking-at "^\\([^=]+\\)=\\(.*\\)$")
(emms-track-set track
(intern (match-string 1))
(match-string 2))
(forward-line 1))))))
(provide 'emms-info-mp3info)
;;; emms-info-mp3info.el ends here
|