Thu Jun 15 15:30:27 JST 2006  Damien Elmes <[EMAIL PROTECTED]>
  * add player-mpg321-remote
  - allows seeking in files
  - handles files with errors in them (the mpg321 simple version skips
    over the files)
New patches:

[add player-mpg321-remote
Damien Elmes <[EMAIL PROTECTED]>**20060615063027
 - allows seeking in files
 - handles files with errors in them (the mpg321 simple version skips
   over the files)
] {
hunk ./NEWS 3
+  - A new player that uses mpg321's remote mode is now available
+    (emms-player-mpg321-remote) - this allows seeking and copes with
+    errors in files.
hunk ./NEWS 16
-  User-visible bug fixes:
+User-visible bug fixes:
+
hunk ./NEWS 19
+  - MP3s with errors are now playable when using the remote player.
addfile ./emms-player-mpg321-remote.el
hunk ./emms-player-mpg321-remote.el 1
+;;; emms-player-mpg321-remote.el --- play files with mpg321 -R
+
+;; Copyright (C) 2006  Damien Elmes <[EMAIL PROTECTED]>
+
+;; Author: Damien Elmes <[EMAIL PROTECTED]>
+;; 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)
+;; 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., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;; This file provides an emms-player which uses mpg321's remote mode
+;; to play files. This is a persistent process which isn't killed each
+;; time a new file is played.
+
+;; The remote process copes graciously with errors in music files, and
+;; allows you to seek in files.
+
+;; To enable this code, add the following to your emacs configuration:
+
+;; (require 'emms-player-mpg321-remote)
+;; (push 'emms-player-mpg321-remote emms-player-list)
+
+;;; Code:
+
+(require 'emms)
+(require 'emms-player-simple)
+
+;; --------------------------------------------------
+;; Variables and configuration
+;; --------------------------------------------------
+
+(defgroup emms-player-mpg321-remote nil
+  "*EMMS player using mpg321's remote mode."
+  :group 'emms-player
+  :prefix "emms-player-mpg321-remote")
+
+(defcustom emms-player-mpg321-remote-command "mpg321"
+  "*The command name of mpg321."
+  :type  'string
+  :group 'emms-player-mpg321-remote)
+
+(defcustom emms-player-mpg321-remote-parameters nil
+  "*Extra arguments to pass to mpg321 when using remote mode
+For example: (list \"-o\" \"alsa\")"
+  :type  '(repeat string)
+  :group 'emms-player-mpg321-remote)
+
+(defcustom emms-player-mpg321-remote
+  (emms-player 'emms-player-mpg321-remote-start-playing
+               'emms-player-mpg321-remote-stop-playing
+               'emms-player-mpg321-remote-playable-p)
+  "*A player for EMMS."
+  :type '(cons symbol alist)
+  :group 'emms-player-mpg321-remote)
+
+(defvar emms-player-mpg321-remote-initial-args
+  (list "--skip-printing-frames=10" "-R" "-")
+  "Initial args to pass to the mpg321 process.")
+
+(defvar emms-player-mpg321-remote-process-name "emms-player-mpg321-remote-proc"
+  "The name of the mpg321 remote player process")
+
+(defmacro emms-player-mpg321-remote-add (cmd func)
+  `(emms-player-set 'emms-player-mpg321-remote
+                    ,cmd ,func))
+
+(emms-player-mpg321-remote-add
+ 'regex (emms-player-simple-regexp "mp3" "mp2"))
+(emms-player-mpg321-remote-add
+ 'pause 'emms-player-mpg321-remote-pause)
+(emms-player-mpg321-remote-add
+ 'resume 'emms-player-mpg321-remote-pause)
+(emms-player-mpg321-remote-add
+ 'seek 'emms-player-mpg321-remote-seek)
+
+;; --------------------------------------------------
+;; Process maintenence
+;; --------------------------------------------------
+
+(defun emms-player-mpg321-remote-start-process ()
+  "Start a new remote process, and return the process."
+  (let ((process (apply 'start-process
+                        emms-player-mpg321-remote-process-name
+                        nil
+                        emms-player-mpg321-remote-command
+                        (append emms-player-mpg321-remote-initial-args
+                                emms-player-mpg321-remote-parameters))))
+    (set-process-sentinel process 'emms-player-mpg321-remote-sentinel)
+    (set-process-filter process 'emms-player-mpg321-remote-filter)
+    process))
+
+(defun emms-player-mpg321-remote-stop ()
+  "Stop the currently playing process, if indeed there is one"
+  (let ((process (emms-player-mpg321-remote-process)))
+    (when process
+      (kill-process process)
+      (delete-process process))))
+
+(defun emms-player-mpg321-remote-process ()
+  "Return the remote process, if it exists."
+  (get-process emms-player-mpg321-remote-process-name))
+
+(defun emms-player-mpg321-remote-running-p ()
+  "True if the remote process exists and is running."
+  (let ((proc (emms-player-mpg321-remote-process)))
+    (and proc
+         (eq (process-status proc) 'run))))
+
+(defun emms-player-mpg321-remote-sentinel (proc str)
+  "Sentinel for determining the end of process"
+  (when (or (eq (process-status proc) 'exit)
+            (eq (process-status proc) 'signal))
+    (emms-player-stopped)))
+
+(defun emms-player-mpg321-remote-send (text)
+  "Send TEXT to the mpg321 remote process, and add a newline."
+  (let ((proc (emms-player-mpg321-remote-process)))
+    ;; we shouldn't be trying to send to a dead process
+    (assert proc)
+    (process-send-string proc (concat text "\n"))))
+
+;; --------------------------------------------------
+;; Interfacing with emms
+;; --------------------------------------------------
+
+(defun emms-player-mpg321-remote-filter (proc str)
+  (let* ((data (split-string str))
+         (cmd (car data)))
+    (cond
+     ;; stop notice
+     ((and (string= cmd "@P")
+           (string= (cadr data) "0"))
+      (if emms-player-mpg321-remote-mask-stop-message
+          (setq emms-player-mpg321-remote-mask-stop-message
+                nil)
+        (emms-player-stopped)))
+     ;; frame notice
+     ((string= cmd "@F")
+      ;; even though a timer is constantly updating this variable,
+      ;; updating it here will cause it to stay pretty much in sync.
+      (setq emms-playing-time
+            (truncate (string-to-number (nth 3 data))))))))
+
+(defun emms-player-mpg321-remote-start-playing (track)
+  "Start playing a song by telling the remote process to play it.
+If the remote process is not running, launch it."
+  (unless (emms-player-mpg321-remote-running-p)
+    (emms-player-mpg321-remote-start-process))
+  (emms-player-mpg321-remote-play-track track))
+
+(defun emms-player-mpg321-remote-stop-playing ()
+  "Stop the current song playing."
+  ;; we don't want to tell emms we've stopped playing, or it'll start
+  ;; playing the next track
+  (setq emms-player-mpg321-remote-mask-stop-message t)
+  (emms-player-mpg321-remote-send "stop"))
+
+(defun emms-player-mpg321-remote-play-track (track)
+  "Send a play command to the remote, based on TRACK."
+  (emms-player-mpg321-remote-send
+   (concat "load " (emms-track-get track 'name)))
+  (emms-player-started 'emms-player-mpg321-remote))
+
+(defun emms-player-mpg321-remote-playable-p (track)
+  ;; use the simple definition.
+  (emms-player-mpg321-playable-p track))
+
+(defun emms-player-mpg321-remote-pause ()
+  "Pause the player."
+  (emms-player-mpg321-remote-send "pause"))
+
+(defun emms-player-mpg321-remote-resume ()
+  "Resume the player."
+  (emms-player-mpg321-remote-send "pause"))
+
+(defun emms-player-mpg321-remote-seek (seconds)
+  "Seek forward or backward in the file."
+  ;; since mpg321 only supports seeking by frames, not seconds, we
+  ;; make a very rough guess as to how much a second constitutes
+  (let ((frame-string (number-to-string (* 35 seconds))))
+    ;; if we're not going backwards, we need to add a '+'
+    (unless (eq ?- (string-to-char frame-string))
+      (setq frame-string (concat "+" frame-string)))
+    (emms-player-mpg321-remote-send (concat "jump " frame-string))))
+
+(provide 'emms-player-mpg321-remote)
+;;; emms-player-mpg321-remote.el ends here
}

Context:

[playlist: enable undo, add extra undo binding
Damien Elmes <[EMAIL PROTECTED]>**20060615022826] 
[browser: require emms-playlist-sort
Damien Elmes <[EMAIL PROTECTED]>**20060615015543] 
[browser: make defcustom lines user variables
Damien Elmes <[EMAIL PROTECTED]>**20060615013606] 
[playlist-mode: add 'C' to clear playlist
Damien Elmes <[EMAIL PROTECTED]>**20060615013417] 
[info: display progress when adding async
Damien Elmes <[EMAIL PROTECTED]>**20060615012854] 
[browser: expand/collapse levels, tab through entries
Damien Elmes <[EMAIL PROTECTED]>**20060614180725] 
[browser: refactor data format, bugfixes; emms: add emms-track-p
Damien Elmes <[EMAIL PROTECTED]>**20060614160048
 
 Subitems are now stored in a tree of "bdata" objects, which is
 generated when initially displaying the buffer. This makes rendering
 simpler and also fixes some bugs where tracks were not being sorted
 correctly in the browser and/or the playlist.
 
 Adding items to the playlist now inserts 'group' names when you add a
 whole album, artist, etc at a time. These names will be thrown away if
 you run emms-shuffle. The sorting routines will correctly sort the
 buffer, throwing away the group tags, but then throw an error because
 the buffer is not the size they expected it to be. Other playlist
 manipulation routines like next/previous should skip over the group
 names - if they don't, it's a bug in the playlist code.
 
 An example of the new interface is at:
 http://repose.cx/dump/emms-browser.png
] 
[emms-lyrics.el: Fix file-exists-p error when finding lyrics file for
[EMAIL PROTECTED]
 streams. At present, will just take care of tracks with 'file type.
] 
[added the section "Finding files and speed" to the manual
[EMAIL PROTECTED] 
[fix bug in emms-playlist-mode-center-current
[EMAIL PROTECTED] 
[removed superfluous comment (actually testing darcs send)
[EMAIL PROTECTED] 
[debian: add changelog for 2.0-2
[EMAIL PROTECTED] 
[debian: Install info file as well
[EMAIL PROTECTED] 
[browser: sorting, bugfixes
Damien Elmes <[EMAIL PROTECTED]>**20060612051800
 - add sorting for subitems (albums, tracks, etc)
 - make isearching expand the current entry automatically
 - rename subitems-exist to subitems-visible (clearer)
] 
[updated manual about emms-foobar-file prefix toggling
[EMAIL PROTECTED] 
[emms-cache: add pruning support, make save/load interactive
Damien Elmes <[EMAIL PROTECTED]>**20060611095400] 
[Use better exclude regexp, so that people can load music files with '#' in the middle of the name.
Michael Olson <[EMAIL PROTECTED]>**20060610230507] 
[emms-info: Never return 0 for info-mtime, since emms-time-less-p does not like this.  Use nil instead.
Michael Olson <[EMAIL PROTECTED]>**20060610230409] 
[Add mpd volume settings to custom
Martin Schoenmakers <[EMAIL PROTECTED]>**20060609231150
 
 Small patchlet so mpd users can use custom to change the volume setting
 backend to use the appropriate volume functions.
] 
[browse subcategories (eg artist->album->title)
Damien Elmes <[EMAIL PROTECTED]>**20060609185950
 - subcategories can now be expanded and contracted, and added to
   playlist
 - see the new keybindings at the top of the file
 - add new faces for the various sublevels (only the dark background
   colours are useful at the moment - any light background users want
   to fix that?)
 - fix a bug in emms-smart-browse with (recenter)
] 
[update emms-cache.el commentary
Damien Elmes <[EMAIL PROTECTED]>**20060609064935] 
[emms-player-mpd: Add functionality to dump MusicPD data into the EMMS cache.  This allows for easy integration with emms-browser.el.
Michael Olson <[EMAIL PROTECTED]>**20060609043831] 
[emms-player-mpd: Rename volume functions to better match the namespace created by emms-volume.el.
Michael Olson <[EMAIL PROTECTED]>**20060609043643] 
[emms-player-mpd: Fix minor bug when importing the current MusicPD playlist into EMMS.
Michael Olson <[EMAIL PROTECTED]>**20060609043538] 
[emms-setup: Get rid of pointless compiler warning.
Michael Olson <[EMAIL PROTECTED]>**20060609042002] 
[emms-cache: Small compiler fix.
Michael Olson <[EMAIL PROTECTED]>**20060609041606] 
[emms-cache: Add standard enable/disable/toggle interface and do a docfix for emms-cache-set-function.
Michael Olson <[EMAIL PROTECTED]>**20060609040108] 
[Standardize copyright notices.  Add COPYING file.  Mention license in README.
Michael Olson <[EMAIL PROTECTED]>**20060608194123] 
[Fix compiler warnings in emms-cache.el.
Michael Olson <[EMAIL PROTECTED]>**20060608184612] 
[emms-metaplaylist-mode: Fix bug introduced by the recent emms-playlist-mode overhaul.  Add faces for light backgrounds.
Michael Olson <[EMAIL PROTECTED]>**20060608143846] 
[NEWS is new
[EMAIL PROTECTED] 
[emms-playlist-mode: Facify tracks on startup.
[EMAIL PROTECTED] 
[refactor browser mode creation code
Damien Elmes <[EMAIL PROTECTED]>**20060608123618
 - make the rendering function (browse-by-artist, etc) responsible for
   the mode name
 - fix a bug where the wrong buffer is used
] 
[browser sorting, and bug fixes
Damien Elmes <[EMAIL PROTECTED]>**20060608105253
 - sort tracks when they're added to the playlist
 - fix a bug where we didn't uniquify the buffer
 - distinguish between files and urls
 - modify emms-playlist-sort to accept an optional region
] 
[update modeline when changing browsing method
Damien Elmes <[EMAIL PROTECTED]>**20060608094037] 
[avoid rebuilding the browser window each time
Damien Elmes <[EMAIL PROTECTED]>**20060608092623] 
[fix RET on trailing \n
Damien Elmes <[EMAIL PROTECTED]>**20060608090703
 \n isn't propertized which means hitting RET on a playlist or browser
 entry fails. this patch moves the point before trying to read the
 properties.
] 
[add a metadata browser - emms-browser.el
Damien Elmes <[EMAIL PROTECTED]>**20060608084400
 * preliminary work on a metadata browser - still alpha, but it's
   useable for me
 * also updated my email address in emms-cache.el (whoops)
] 
[small typo fix
Damien Elmes <[EMAIL PROTECTED]>**20060608032546] 
[emms.el: Change directory to / before starting the player.
[EMAIL PROTECTED] 
[emms-playlist-mode: When making new overlays, do not allow the rear to advance.  This prevents some display issues.  If we really need to modify the text there, we should be using (insert-before-markers).
Michael Olson <[EMAIL PROTECTED]>**20060607215212] 
[Make emms-property-region bulletproof.
Michael Olson <[EMAIL PROTECTED]>**20060607215113] 
[Fix typo in emms-property-region
[EMAIL PROTECTED] 
[emms.el, simplified emms-property-region considerably.
[EMAIL PROTECTED] 
[Very basic support for recording the time you last played a track.
[EMAIL PROTECTED]
 
 * emms-last-played.el: New file.
   Nothing fancy right now, more to come soon.
 * emms-setup.el: emms-devel now requires and setups emms-last-played.
] 
[Mark the cache as dirty for each modification.
[EMAIL PROTECTED] 
[emms.el: The currently playing marker now should stay where it is, even for yanks
[EMAIL PROTECTED] 
[emms-playlist-mode: Stop overlay from being attached to text inserted before it
[EMAIL PROTECTED] 
[fix damien elmes's email address
Damien Elmes <[EMAIL PROTECTED]>**20060607154000] 
[emms sources now switch add/play behavior when a prefix argument is supplied.
[EMAIL PROTECTED] 
[Add autoloads to emms-setup.el
[EMAIL PROTECTED] 
[Typo, defvar => defcustom for emms-cache-set-function
[EMAIL PROTECTED] 
[Cleaned up the cached code in emms.el a bit
[EMAIL PROTECTED] 
[refactor caching code into emms-cache.el
Damien Elmes <[EMAIL PROTECTED]>**20060607125345
 * caching support is now provided via two function vars in emms.el,
   emms-cache-get-function and emms-cache-set-function
 * (emms-standard) or above will enable caching support
 * you'll need to remove .emms-cache or s/emms-info-cache/emms-cache-db/
] 
[emms-info: Fix bug that occurs after clearing the current playlist and trying to re-add songs to it.
Michael Olson <[EMAIL PROTECTED]>**20060606144439] 
[emms-playlist-mode doesn't need overlay compatibility anymore
[EMAIL PROTECTED] 
[emms-playlist-mode.el - now with less overlay!
[EMAIL PROTECTED] 
[AUTHORS: fixed Lucas' e-mail address
[EMAIL PROTECTED] 
[AUTHORS: Damien Elmes address updated
[EMAIL PROTECTED] 
[info-cache-dirty/coding
Damien Elmes <[EMAIL PROTECTED]>**20060605163339
 
 * mark the info cache as dirty when it's modified, so we don't have to
   write it out all the time
 * save the cache as mule-utf-8 - comments? i'm not sure if this is
   correct
] 
[emms-info caching (thanks to Damien Elmes)
[EMAIL PROTECTED] 
[Sort file names from `emms-source-file-directory-tree-function'.
[EMAIL PROTECTED] 
[Add some sources for inserting playlists without inserting their contents, and likewise for directories of playlist files.  Exclude some files and directories from being added when walking directories.
Michael Olson <[EMAIL PROTECTED]>**20060604195602] 
[emms-player-mpd: Differentiate between files and URLs when it makes sense to do so.
Michael Olson <[EMAIL PROTECTED]>**20060604195449] 
[Miscellaneous minor cleanups.
Michael Olson <[EMAIL PROTECTED]>**20060604195311] 
[Make sure we never have an empty track description when inserting a song into a playlist buffer.
Michael Olson <[EMAIL PROTECTED]>**20060604194940] 
[Remove debian-extras package as requested by ftpmasters (debian)
[EMAIL PROTECTED] 
[Put volume options in their own customize group.
Martin Schoenmakers <[EMAIL PROTECTED]>**20060601193853
 
 Added a separate emms-volume group for customize and put things there instead
 of in the main thing.
] 
[Make handling of multiple playlist buffers less error-prone.
Michael Olson <[EMAIL PROTECTED]>**20060531203810] 
[emms-volume.el: Cosmetic stuff, defvar -> defcustom
[EMAIL PROTECTED] 
[emms-volume.el: Minor cosmetic cleanup
[EMAIL PROTECTED] 
[emms-volme.el: Add some requires.
[EMAIL PROTECTED] 
[emms-volume-amixer.el: Provide a way to set the control for amixer
[EMAIL PROTECTED] 
[AUTHORS: Add Martin Schoenmakers. Welcome! :-)
[EMAIL PROTECTED] 
[Add emms-volume and emms-volume-amixer.
Martin Schoenmakers <[EMAIL PROTECTED]>**20060530223500
 
 New files: emms-volume.el provides some general volume changing things,
 including a minor mode to more easily change volume when not in the
 EMMS buffer. emms-volume-amixer.el is a backend using amixer.
 
] 
[emms-streams: Re-add space after prompt and use completion for type.
Michael Olson <[EMAIL PROTECTED]>**20060530190620] 
[emms-streams: When the user wants emms-streams to play the selected stream instead of add it, create our own playlist buffer.  When quitting, if we own the current playlist buffer, kill it.
Michael Olson <[EMAIL PROTECTED]>**20060530144243] 
[allow nonzero ogginfo exit plus some reindenting
Martin Schoenmakers <[EMAIL PROTECTED]>**20060530130411
 
 When ogginfo gave a nonzero value on exit, any valid data would get tossed
 if there was any. This prevented emms from showing info for files that are
 tagged but a bit odd.
 
 Also reindented emms-info-ogginfo accordingly, which incidentally removed
 some tabs in favour of spaces.
 
] 
[emms-streams: Re-implement yank and kill so that they do the right thing with emms-stream-list.
Michael Olson <[EMAIL PROTECTED]>**20060530045429] 
[emms-streams: Implement kill and yank.
Michael Olson <[EMAIL PROTECTED]>**20060530040114] 
[emms-streams: Make hitting RET on a URL do the right thing, improve cursor movement, and mark the buffer as unmodified after performing a save.
Michael Olson <[EMAIL PROTECTED]>**20060529030043] 
[emms-player-mpd: Make seek work correctly.
Michael Olson <[EMAIL PROTECTED]>**20060525033120] 
[emms-player-mpd: Use more robust method of detecting whether we need to force-feed MusicPD our playlist.
Michael Olson <[EMAIL PROTECTED]>**20060525014253] 
[emms-playlist-mode: Make "d" kill the entire line.  This seems to be a good compromise of those who use C-k and those who want more standard object-killing behavior.
foo**20060524200008] 
[emms-player-mpd: When showing the currently-playing song, prepend the name of the radio station, if it exists.
foo**20060524195911] 
[emms-player-mpd: Fix bug that caused unconditional reloading of the entire MusicPD playlist whenever the track was changed manually.
Michael Olson <[EMAIL PROTECTED]>**20060524061655] 
[emms-player-mpd: Overhaul for streamlist support, and fix a few miscellaneous issues.
Michael Olson <[EMAIL PROTECTED]>**20060524055707] 
[emms-player-mpd: Add a few checks to make sure that the given buffer exists before trying to do anything with it.
Michael Olson <[EMAIL PROTECTED]>**20060517035419] 
[emms-source-playlist: Do not expand names of files in playlists, as this can cause problems with emms-player-mpd in some configurations.
Michael Olson <[EMAIL PROTECTED]>**20060516081257] 
[emms-playlist-mode: Implement the option (disabled by default) of opening a new EMMS buffer for a playlist, when hitting RET on one.
Michael Olson <[EMAIL PROTECTED]>**20060510040730] 
[emms-playlist-mode.el: Don't put a period after the mode map. This hangs 21.4 on display.
[EMAIL PROTECTED] 
[TAG 2.0
[EMAIL PROTECTED] 
Patch bundle hash:
1aab10146a3c0919de569781613b209cc939b548
_______________________________________________
Emms-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/emms-patches

Reply via email to