aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryonirabkin <yonirabkin>2005-09-21 15:10:00 +0000
committeryonirabkin <mwolson@gnu.org>2005-09-21 15:10:00 +0000
commitec90d94d50cdfb49d5474190365b71cd6f6267ae (patch)
tree47aa90c7310e426a6543fd9200ab3374fcd39d3d
parentcd1f64f873331c5a12fcd0146b0edd6ebfe0b2d9 (diff)
fix emms-score.el and emms-info-ogg.el borkage
darcs-hash:20050921151000-be80e-f0f52d81156347ffd2469b1cc3fc0f019a1cd597.gz
-rw-r--r--emms-info-ogg.el53
-rw-r--r--emms-score.el64
2 files changed, 54 insertions, 63 deletions
diff --git a/emms-info-ogg.el b/emms-info-ogg.el
index 07b5e59..d0c4899 100644
--- a/emms-info-ogg.el
+++ b/emms-info-ogg.el
@@ -44,17 +44,12 @@
"EMMS info ogg version string.")
;; $Id: emms-info-ogg.el,v 1.14 2005/07/09 11:56:00 forcer Exp $
-(defgroup emms-info-ogg-comments nil
+(defgroup emms-info-ogg nil
"An EMMS-info method for getting/setting ogg-comments, using
ogg-comments.el"
:group 'emms-info-methods
:prefix "emms-info-ogg-")
-(defcustom emms-info-ogginfo-program-name "ogginfo"
- "*The name/path of the ogginfo tag program."
- :type 'string
- :group 'emms-info-ogginfo)
-
(defun emms-info-ogg-get-comment (field info)
(let ((comment (cadr (assoc field (cadr info)))))
(if comment
@@ -63,28 +58,30 @@ ogg-comments.el"
(defun emms-info-ogg (track)
"Retrieve an emms-info structure as an ogg-comment"
- (let ((info (oggc-read-header (emms-track-name track)))
- (file (emms-track-get track 'name)))
- (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))))
- (setq ptime-total (+ (* minutes 60) seconds)
- ptime-min minutes
- ptime-sec seconds)))
-
- (emms-track-set track 'info-title (emms-info-ogg-get-comment "title" info))
- (emms-track-set track 'info-artist (emms-info-ogg-get-comment "artist" info))
- (emms-track-set track 'info-album (emms-info-ogg-get-comment "album" info))
- (emms-track-set track 'info-note (emms-info-ogg-get-comment "comment" info))
- (emms-track-set track 'info-year (emms-info-ogg-get-comment "date" info))
- (emms-track-set track 'info-genre (emms-info-ogg-get-comment "genre" info))
- (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))))
+ (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)))
+ (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))))
+ (setq ptime-total (+ (* minutes 60) seconds)
+ ptime-min minutes
+ ptime-sec seconds)))
+
+ (emms-track-set track 'info-title (emms-info-ogg-get-comment "title" info))
+ (emms-track-set track 'info-artist (emms-info-ogg-get-comment "artist" info))
+ (emms-track-set track 'info-album (emms-info-ogg-get-comment "album" info))
+ (emms-track-set track 'info-note (emms-info-ogg-get-comment "comment" info))
+ (emms-track-set track 'info-year (emms-info-ogg-get-comment "date" info))
+ (emms-track-set track 'info-genre (emms-info-ogg-get-comment "genre" info))
+ (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)))))
(provide 'emms-info-ogg)
;;; emms-info-ogg.el ends here
diff --git a/emms-score.el b/emms-score.el
index da28828..9f97c0e 100644
--- a/emms-score.el
+++ b/emms-score.el
@@ -1,13 +1,11 @@
;;; emms-scores.el --- Scoring system for mp3player
-;; Author & Maintainer: Jean-Philippe Theberge (jphiltheberge@videotron.ca)
-;; version :
-(defconst emms-scores-version "1.92 $Revision: 1.4 $")
-;; $Id: emms-score.el,v 1.4 2004/02/17 09:01:49 kanaldrache Exp $
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Copyright (c) 1/me think he smoke too much marijuana in it's yong years998 - 1999 Free Software Foundation, Inc.
-;;
-;; This file is not part of GNU Emacs. :-(
-;;
+
+;; Copyright (C) 2003, 2004, 2005
+
+;; Authors: Jean-Philippe Theberge <jphiltheberge@videotron.ca>, Yoni
+;; Rabkin <yonirabkin@member.fsf.org>
+;; Keywords: emms, mp3, mpeg, multimedia
+
;; 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)
@@ -17,9 +15,9 @@
;; 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.
-;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
+
+;;; Commentary:
+
;; NOTE: This is experimental stuff - comments welcome! There
;; shouldn't worky anything in that file... scores aren't saved, they
;; even don't have any consequence on playing order and there's just
@@ -36,7 +34,7 @@
;; You can change your mood with M-x emms-score-change-mood.
;;
;; Every music file start with a default score of 0 the command
-;; emms-score-up-current and emms-score-down-current modify the
+;; emms-score-up-playing and emms-score-down-playing modify the
;; score of the file you are curently listening by 1 In addition,
;; skipping a file (with emms-skip) automaticaly score the file
;; down.
@@ -55,10 +53,6 @@
;;; Code:
-(defvar emms-score-version "0.2 $Revision: 1.4 $"
- "EMMS score version string.")
-;; $Id: emms-score.el,v 1.4 2004/02/17 09:01:49 kanaldrache Exp $
-
(defvar emms-scores-list nil)
(defvar emms-score-current-mood 'default)
(defvar emms-score-min-score 0)
@@ -79,7 +73,6 @@ The score hash is automatically saved."
(emms-score-save-hash)
(setq emms-score-current-mood (intern (downcase mood))))
-
(defun emms-score-save-hash ()
"Save score hash in `emms-score-file'."
(interactive)
@@ -87,11 +80,11 @@ The score hash is automatically saved."
(make-directory (file-name-directory emms-score-file)))
(with-temp-file emms-score-file
(let ((standard-output (current-buffer)))
- (insert "(")
- (maphash (lambda (key value)
- (prin1 (cons key value)))
- emms-score-hash)
- (insert ")"))))
+ (insert "(")
+ (maphash (lambda (key value)
+ (prin1 (cons key value)))
+ emms-score-hash)
+ (insert ")"))))
(defun emms-score-load-hash ()
"Load score hash from `emms-score-file'."
@@ -113,25 +106,26 @@ The score hash is automatically saved."
(plist-put sp emms-score-current-mood (+ sc score))
emms-score-hash)
(message "New score is %s" (+ score sc))))
-
-(defun emms-score-up-current ()
+
+(defun emms-score-up-playing ()
(interactive)
- (emms-score-change-score 1 (emms-playlist-current)))
+ (if emms-player-playing-p
+ (emms-score-change-score 1 (emms-playlist-current-selected-track))
+ (error "No track currently playing")))
-(defun emms-score-down-current ()
+(defun emms-score-down-playing ()
(interactive)
- (emms-score-change-score -1 (emms-playlist-current)))
+ (if emms-player-playing-p
+ (emms-score-change-score -1 (emms-playlist-current-selected-track))
+ (error "No track currently playing")))
(defun emms-score-up-file-on-line ()
(interactive)
- (let ((idx (1- (count-lines (point-min) (point-at-eol)))))
- (emms-score-change-score 1 (emms-track-name (emms-playlist-get-track idx)))))
-
+ (emms-score-change-score 1 (emms-playlist-current-selected-track)))
+
(defun emms-score-down-file-on-line ()
(interactive)
- (let ((idx (1- (count-lines (point-min) (point-at-eol)))))
- (emms-score-change-score -1 (emms-track-name (emms-playlist-get-track idx)))))
-
+ (emms-score-change-score -1 (emms-playlist-current-selected-track)))
(defun emms-score (arg)
"Turn on emms-score if prefix argument ARG is a positive integer,
@@ -154,7 +148,7 @@ This is a suitable function to put in `emms-player-stopped-hook'."
(when emms-player-playing-p
(error "A track is already playing."))
(if (emms-playlist-next)
- (if (emms-score-check-score (emms-playlist-current))
+ (if (emms-score-check-score (emms-playlist-current-selected-track))
(emms-start)
(emms-score-next-noerror))
(message "No track in playlist that matches your score anymore")))