fordon_greeman / voidfiles

Branch: main
Switch branches/tags
main
theidioticdev add emacs 2079ec5 1d ago
4240 lines · 131 KB Raw Blame History
1 \input texinfo @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename emms.info
4 @settitle The Emms Manual
5 @c %**end of header
6
7 @c History: The Emms manual was almost entirely rewritten for the
8 @c release of Emms version 2.
9
10
11 @dircategory Emacs
12 @direntry
13 * Emms: (emms). The Emacs Multimedia System
14 @end direntry
15
16 @copying
17 @copyright{} 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2014,
18 2015, 2016, 2020, 2021, 2022, 2023, 2024, 2025 Free Software Foundation,
19 Inc.
20 @quotation
21 Permission is granted to copy, distribute and/or modify this document
22 under the terms of the GNU Free Documentation License, Version 1.1 or
23 any later version published by the Free Software Foundation; with no
24 Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
25 copy of the license is included in the section entitled "GNU Free
26 Documentation License".
27 @end quotation
28 @end copying
29
30 @c For printed material
31 @titlepage
32 @title The Emms Manual
33
34 @page
35 @vskip 0pt plus 1filll
36 @insertcopying
37 @end titlepage
38
39 @contents
40 @c END For printed material
41
42 @ifnottex
43 @node Top, Introduction, (dir), (dir)
44 @top Emms Manual
45
46 This is the Manual for the Emacs Multimedia System.
47
48 @insertcopying
49
50 @menu
51 Starting out
52 * Introduction:: Introduction to Emms.
53 * Quickstart Guide:: First steps with Emms for new users.
54 * Installation:: How to install Emms on your System.
55 * Setup:: How to setup Emms.
56 * Configuration:: More detailed setup and configuration.
57 * Getting Help:: Where to get help with Emms and make suggestions.
58 * Formats and Freedom:: File formats without restrictions.
59
60 Emms basics
61 * Basic Commands:: How to control Emms with ease.
62 * The Core File:: The inner core of Emms.
63 * Sources:: Sources for playlists-creation.
64 * Simple Players:: Some simple players.
65 * Playlists:: How Emms organizes media.
66
67 Advanced Features
68 * Track Information:: More narrative track descriptions.
69 * Interactive Playlists:: Interactive Playlists.
70 * Markable Playlists:: Allow tracks to be marked.
71 * Extending Emms:: How to define new players and modules.
72
73 Modules and Extensions
74 * The Browser:: Advanced metadata browsing.
75 * The Filter System:: Advanced metadata filtering.
76 * Sorting Playlists:: Sorting the order of the tracks.
77 * Persistent Playlists:: Restoring playlists on emacs startup.
78 * Editing Tracks:: Editing track information from within Emms.
79 * Emms Mode Line:: Emms information on the mode line.
80 * Limiting:: Derive a new playlist from the current.
81 * Music Player Daemon:: Interface to Music Player Daemon.
82 * Lyrics:: Displaying lyrics synchronously.
83 * Volume:: Changing the volume.
84 * Streaming Audio:: Interface to streaming audio.
85 * Radio Browser:: Search for internet radio stations
86 * APE / FLAC Commands:: How to play next or previous track in these files.
87 * Bookmarks:: Saving a place in a media file.
88 * Managing Playlists:: Managing multiple playlists.
89 * GNU FM:: Connect to music community websites.
90 * Listenbrainz:: Notify listenbrainz of tracks played.
91 * D-Bus:: Control Emms over D-Bus.
92
93 Copying and license
94 * Copying:: The GNU General Public License gives you permission to
95 redistribute Emms on certain terms; it also explains
96 that there is no warranty.
97 * The GNU FDL:: The license for this documentation.
98
99 Indices
100 * Concept Index::
101 * Function Index::
102 * Variable Index::
103 * Keybinding Index::
104
105 @detailmenu
106 --- The Detailed Node Listing ---
107
108 Here are some other nodes which are really inferiors of the ones
109 already listed, mentioned here so you can get to them in one step:
110
111 Installation
112 * Compiling Emms:: Compiling Emms into Byte-Code.
113
114 The Core File
115 * User Variables:: Variables for the user to tweak.
116 * Hooks:: Hooks for important Emms functions.
117 * Core Functions:: Providing the basic functionality of Emms.
118
119 Track Information
120 * Metadata Utilities:: Supported external metadata utilities.
121 * Defining Info Methods:: Defining new info methods.
122
123 Extending Emms
124 * New Player:: How to define a new player.
125 * Simple Player for `play':: Example player using @command{play}.
126 * More Complex Player:: Example of a complex player using @command{mpg321}.
127 @end detailmenu
128 @end menu
129
130 @end ifnottex
131
132 @c -------------------------------------------------------------------
133 @node Introduction
134 @chapter Introduction
135
136 @cindex introduction
137
138 Emms is the Emacs Multi-Media System. Emms organizes playlists, allows
139 browsing through track and album metadata, and plays files by calling
140 external players.
141
142 This manual tries to be the definitive source of information about
143 Emms, an online version of the manual is available at:
144 @uref{http://www.gnu.org/software/emms/manual/}.
145
146 The basic functionality of Emms consists of three parts: The core, the
147 sources, and the players.
148
149 The core resides in @file{emms.el}, provides a simple playlist, and
150 the basic functionality to use all the other features of Emms. It
151 provides the common user commands and interfaces for other parts. It
152 thinks in tracks, where a track is the combination of a type and a
153 name - e.g. the track type 'file has a name that is the file
154 name. Other track types are possible.
155
156 To get to tracks, the core needs sources. The file @file{emms-source-file.el}
157 provides simple sources to interact with the file system.
158
159 When Emms finally has the sources in the playlist, it needs a player
160 to play them. @file{emms-player-simple.el} defines a few useful
161 players and provides a straightforward way of providing your own.
162
163 The Emms comes with many additional features to extend the
164 functionality beyond the core.
165
166 The way Emms works is easy to customize with your own code or by using
167 `M-x customize' or by changing the variables directly.
168
169
170 @c -------------------------------------------------------------------
171 @node Quickstart Guide
172 @chapter Quickstart Guide
173
174 This chapter demonstrates how to setup Emms so that you can start
175 listening to your music without having to read all of the
176 documentation first. This is the tl;dr version of the manual.
177
178 The first thing to do is to load Emms via GNU ELPA. Invoke @kbd{M-x
179 list-packages} and choose to install Emms.
180
181 If you are installing Emms manually, then start by telling Emacs where
182 your copy of Emms is located. Let's say you have it in
183 @file{~/elisp/emms/}. So add this line to your @file{.emacs}:
184
185 @lisp
186 (add-to-list 'load-path "~/elisp/emms/lisp/")
187 (require 'emms-setup)
188 @end lisp
189
190 (More detailed information about installing Emms can be found in the
191 installation chapter, @xref{Installation}.)
192
193 Either way, you are now ready to configure Emms. Your Emms config can
194 be as simple as three lines. For example:
195
196 @lisp
197 (emms-all)
198 (setq emms-player-list '(emms-player-vlc)
199 emms-info-functions '(emms-info-native))
200 @end lisp
201
202 The function @code{emms-all} loads all of the stable features in Emms.
203
204 Emms can automatically generate that `setq' statement for you based on
205 which players and metadata readers you have installed on your
206 system. Just invoke @code{emms-setup-discover} and answer a few
207 questions.
208
209 The variable @var{emms-player-list} is a list of players that Emms
210 should call to play your media. In this example we assume that you
211 have VLC installed on your system. But if you use mpv or mplayer
212 instead, just change @code{emms-player-vlc} to @code{emms-player-mpv}
213 or @code{emms-player-mplayer}; you get the idea.
214
215 The variable @var{emms-info-functions} is a list of ways for Emms to
216 read the metadata in your media files, so that Emms can display the
217 song title, artist name, etc. @code{emms-info-native} is a metadata
218 reader written entirely in Emacs Lisp, but there are also other
219 backends which call external programs such as TinyTag, Taglib,
220 Exiftool, and etc.
221
222 Reload your Emacs initialization file, or restart Emacs to let the
223 changes have an effect.
224
225 Add all your music to a playlist by invoking @kbd{M-x
226 emms-add-directory-tree RET ~/my_music_directory/ RET}. When you do
227 this Emms will start reading metadata from the files and populating
228 the cache. This may take a while.
229
230 When you are done, you can load the browser with @kbd{M-x
231 emms-browser}, or view your playlist directly with @kbd{M-x
232 emms-playlist-mode-go} (when in the playlist you can hit @kbd{RET} on
233 a track to start playing it.)
234
235 Now you can start exploring Emms. It's probably best to begin with the
236 basic commands (@pxref{Basic Commands}), the interactive playlists
237 (@pxref{Interactive Playlists}), and the browser (@pxref{The Browser}).
238
239 More detail about setting up Emms can be found in the setup chapter,
240 @xref{Setup}.
241
242 Need help? There are knowledgeable people on the #emacs channel on irc
243 (irc.libera.chat), and Emms has a mailing list at emms-help@@gnu.org.
244
245
246 @c -------------------------------------------------------------------
247 @node Installation
248 @chapter Installation
249
250 @cindex installation
251
252 Emms is available via GNU ELPA, which takes care of all of the
253 following steps automatically.
254
255 If you are installing Emms manually, you need to put all the .el files
256 of emms in a directory in your load-path. For example, if you put all
257 those files into ~/elisp/emms/, then in your ~/.emacs, you should add:
258
259 @lisp
260 (add-to-list 'load-path "~/elisp/emms/lisp/")
261 @end lisp
262 @noindent
263
264 @menu
265 * Compiling Emms:: Compiling Emms into Byte-Code.
266 @end menu
267
268
269
270 @node Compiling Emms
271 @section Compiling Emms
272
273 @cindex compiling
274
275 If you are using XEmacs, you will need to edit @file{Makefile} as
276 follows before continuing.
277
278 @example
279 EMACS=xemacs
280 SITEFLAG=-no-site-file
281 @end example
282
283 You can byte-compile Emms by first entering the directory containing the
284 Emms source code, followed by invoking:
285
286 @command{make}
287
288 Which will byte compile Emms. You can then invoke:
289
290 @command{make install}
291
292 Which will install Emms into your Emacs directories (provided you have
293 the appropriate permissions to do so on your system).
294
295 Note that Emms is a light-weight and agile program, you can therefore
296 run Emms just fine without byte compiling it.
297
298
299 @c -------------------------------------------------------------------
300 @node Setup
301 @chapter Setup
302
303 @cindex setup
304 @cindex setting up Emms
305 @cindex quick setup
306
307 The `emms-setup' feature is provided by the file
308 @file{emms-setup.el}. It is essentially a collection of shortcuts for
309 loading different Emms features quickly, but everything you can do
310 with `emms-setup' can also be done manually.
311
312 We use `emms-setup' by calling one of the setup functions.
313
314 @defun emms-minimalistic
315 An Emms setup script.
316 Playlists and all the basics for playing media, but nothing else.
317 @end defun
318
319 @defun emms-all
320 An Emms setup script.
321 Loads all the stable features which come with the Emms distribution.
322 @end defun
323
324 `emms-setup' also comes with a convenience function to set a default
325 list of media players.
326
327 @defun emms-default-players
328 Set @var{emms-player-list} to @var{emms-setup-default-player-list}.
329 @end defun
330
331 You can of course write your own Emms setup functions like the above
332 by looking at the existing function definitions in
333 @file{emms-setup.el}.
334
335
336 @c -------------------------------------------------------------------
337 @node Configuration
338 @chapter Configuration
339
340 @cindex Configuration
341
342 This chapter discusses the configuration of Emms in more detail.
343
344 The following code fragment provides a minimal Emms setup without
345 using the layer of `emms-setup'. It can maybe be used to better
346 understand the internals of Emms. You can see how Emms needs to know
347 about players (these are defined in `emms-player-simple') and about
348 sources for tracks (trivial file system based sources, such as this
349 `emms-directory-tree', are defined in `emms-source-file').
350
351 @lisp
352 (require 'emms-player-simple)
353 (require 'emms-source-file)
354 (require 'emms-source-playlist)
355 (setq emms-player-list '(emms-player-mpg321
356 emms-player-ogg123
357 emms-player-mplayer))
358 @end lisp
359
360 For a discussion on how to define additional players, see @xref{Simple
361 Players}.
362
363 Much of the behaviour of Emms can be changed by setting
364 variables. For example:
365
366 @lisp
367 (setq emms-info-asynchronously nil)
368 (setq emms-playlist-buffer-name "*Music*")
369 @end lisp
370
371 The first @code{setq} turns off the asynchronous updating of info tags. The
372 second sets the default name of the Emms playlist buffer.
373
374 Another way to change Emms variables is to use the M-x
375 @command{customize} mechanism provided by Emacs.
376
377 @menu
378 * Finding files and speed:: Finding files quickly or portably.
379 * Setup Examples:: Examples of ways to setup Emms.
380 @end menu
381
382
383
384 @node Finding files and speed
385 @section Finding files and speed
386
387 @cindex files
388 @cindex speed
389
390 Emms needs to traverse directories in order to find playable
391 media. The default method Emms uses to achive this is
392 @code{emms-source-file-directory-tree-internal} as defined in
393 @file{emms-source-file.el}. The above method is written portably and
394 will always work, but might be too slow if we want to load several
395 hundred tracks (or more).
396
397 @file{emms-source-file.el} defines another method for finding files,
398 @code{emms-source-file-directory-tree-find} which uses
399 GNU/find. @code{emms-source-file-directory-tree-find} is usually an
400 order of magnitude faster, but of course will not work if you do not
401 have GNU/find installed.
402
403 The method Emms will use is defined in the customisable variable
404 @var{emms-source-file-directory-tree-function}.
405
406
407 @node Setup Examples
408 @section Setup Examples
409
410 @cindex example
411 @cindex configuration
412
413 What follow are samples from real-world Emms configurations which show
414 some of the variety and breadth of modifications people make to the
415 default Emms setup.
416
417 The following excerpt includes dbus integration, defining a "recent"
418 filter for the @xref{The Browser}, persistent playlist via
419 @file{emms-history.el}, and enabling sending track information with
420 @file{emms-librefm-stream.el}:
421
422 @lisp
423 ;; notifications
424 (require 'emms-dbus)
425 (emms-dbus-enable)
426 ;; covers
427 (setq emms-browser-covers #'emms-browser-cache-thumbnail-async)
428 (setq emms-browser-thumbnail-small-size 64)
429 (setq emms-browser-thumbnail-medium-size 128)
430 ;; filters
431 (emms-browser-make-filter "all" #'ignore)
432 (emms-browser-make-filter "recent"
433 (lambda (track) (< 30
434 (time-to-number-of-days
435 (time-subtract (current-time)
436 (emms-info-track-file-mtime track))))))
437 (emms-browser-set-filter (assoc "all" emms-browser-filters))
438 ;; history
439 (emms-history-load)
440 ;; libre-fm
441 (emms-librefm-scrobbler-enable)
442 @end lisp
443
444
445 In the following it is possible to see how some of defaults are set
446 regarding saving playlists, playlist interaction, adding special
447 arguments to a specific player backend and configuring player-specific
448 volume control options enabled via @file{emms-volume.el}.
449
450 @lisp
451 (setq-default
452 emms-source-file-default-directory "/mnt/db/mediaCore/sound_music/"
453
454 emms-source-playlist-default-format 'm3u
455 emms-playlist-mode-center-when-go t
456 emms-playlist-default-major-mode 'emms-playlist-mode
457 emms-show-format "NP: %s"
458
459 emms-player-list '(emms-player-mpv)
460 emms-player-mpv-environment '("PULSE_PROP_media.role=music")
461 emms-player-mpv-parameters '("--quiet" "--really-quiet" "--no-audio-display" "--force-window=no" "--vo=null")
462
463 emms-volume-change-function 'emms-volume-mpv-change
464 emms-volume-mpv-method 'smart)
465 @end lisp
466
467
468 @c -------------------------------------------------------------------
469 @node Getting Help
470 @chapter Getting Help
471
472 @cindex mailing list
473 @cindex website
474
475 If you have a bug to report, need help, or wish to suggest a feature,
476 please feel free to use the Emms mailing list. The address of the list
477 is emms-help@@gnu.org. To subscribe to it, visit
478 @url{http://lists.gnu.org/mailman/listinfo/emms-help}.
479
480 If you are familiar with the Gmane service, there is a Gmane newsgroup
481 which mirrors this mailing address at gmane.emacs.emms.user.
482
483 Emms also has a website at @url{http://www.gnu.org/software/emms/}.
484
485
486 @c -------------------------------------------------------------------
487 @node Formats and Freedom
488 @chapter Formats and Freedom
489
490 @cindex freedom
491 @cindex format
492
493 Emms is free software, but some of the file formats it can play carry
494 restrictions, they are proprietary file formats. Proprietary software
495 companies are pushing out audio and video formats which restrict when,
496 where and how you can play them, and restrict developers from writing
497 free software which interacts with them.
498
499 Restrictive file formats put the corporate bottom-line before the
500 public interest.
501
502 Fortunately there are alternatives like Ogg. Ogg is a professional
503 grade multimedia format. Ogg Vorbis is the compressed audio format
504 (like MP3), and Ogg Theora is the video format. For more information,
505 go to @url{http://www.xiph.org/}.
506
507 If you want to transcode audio into a lossless format, you can try
508 FLAC (Free Lossless Audio Codec). FLAC stands out as the fastest and
509 most widely supported lossless audio codec, and the only one that at
510 once is non-proprietary, is unencumbered by patents and has the source
511 code for a reference implementation freely available. For more
512 information about FLAC, go to @url{http://flac.sourceforge.net/}.
513
514
515 @c -------------------------------------------------------------------
516 @node Basic Commands
517 @chapter Basic Commands
518
519 @cindex basic commands
520 @cindex commands, basic
521
522 Before you can use the interface commands, you need a playlist to
523 start with. The following commands allow you to add to the current
524 playlist from different sources:
525
526 Note that the commands with the ``emms-add-'' prefix add the source to
527 the playlist but do not start playing it immediately. Conversely, the
528 commands with the ``emms-play-'' prefix begin playing the track
529 immediately.
530
531 This creates the active playlist and queue as needed. The active queue will automatically switch to any playlists that are browsed to such that the next song played will come from the currently viewed playlist.
532
533 Locking the active playlist queue to its playlist will prevent it from changing, allowing for browsing other playlists and sending songs to the current active playlist from them.
534
535 Locking the queue to its playlist allows for live creation of a curated playlist by browsing other playlists as well as the music database and files.
536
537 @defun emms-play-file file
538 A source for a single file - either @var{file}, or queried from the
539 user. If called with a prefix the file will be added like
540 @command{emms-add-file}.
541 @end defun
542 @defun emms-add-file file
543 A source for a single file - either @var{file}, or queried from
544 the user. If called with a prefix the file will be played like
545 @command{emms-play-file}.
546 @end defun
547 @defun emms-play-directory dir
548 A source for a whole directory tree - either @var{dir}, or queried
549 from the user.
550 @end defun
551 @defun emms-add-directory dir
552 A source for a whole directory tree - either @var{dir}, or queried
553 from the user.
554 @end defun
555 @defun emms-play-directory-tree dir
556 A source for multiple directory trees - either @var{dir}, or the
557 value of @var{emms-source-file-default-directory}.
558 @end defun
559 @defun emms-add-directory-tree dir
560 A source for multiple directory trees - either @var{dir}, or the
561 value of @var{emms-source-file-default-directory}.
562 @end defun
563 @defun emms-play-url url
564 A source for an @var{url} - for example, for streaming over http,
565 playing over sftp, or playing local files (with the ``file://''
566 scheme).
567 @end defun
568 @defun emms-add-url url
569 A source for an @var{url} - for example, for streaming over http,
570 playing over sftp, or playing local files (with the ``file://''
571 scheme).
572 @end defun
573 @defun emms-play-playlist playlist
574 A source for the M3u or PLS playlist format from the file @var{playlist}.
575 @end defun
576 @defun emms-add-playlist playlist
577 A source for the M3u or PLS playlist format from the file @var{playlist}.
578 @end defun
579 @defun emms-play-find dir regexp
580 A source that will find files in @var{dir} or
581 @var{emms-source-file-default-directory} which match @var{regexp}.
582 @end defun
583 @defun emms-add-find dir regexp
584 A source that will find files in @var{dir} or
585 @var{emms-source-file-default-directory} which match @var{regexp}.
586 @end defun
587
588 The basic functionality of Emms is just to play music without being
589 noticed. It provides a few commands to skip the current track and
590 such, but other than that it doesn't show up. Emms provides the
591 following basic user commands (which you might want to bind to
592 keystrokes):
593
594 @defun emms-start
595 Start playing the current playlist
596 @end defun
597 @defun emms-stop
598 Stop playing
599 @end defun
600 @defun emms-next
601 Start playing the next track in the playlist
602 @end defun
603 @defun emms-previous
604 Start playing previous track in the playlist
605 @end defun
606 @defun emms-shuffle
607 Shuffle the current playlist. This uses
608 @var{emms-playlist-shuffle-function}.
609 @end defun
610 @defun emms-sort
611 Sort the current playlist. This uses
612 @var{emms-playlist-sort-function}.
613 @end defun
614 @defun emms-lock-queue
615 Lock the current active playlist queue to its playlist.
616 @var{emms-playlist-sort-function}.
617 @end defun
618 @defun emms-unlock-queue
619 Unlock the current active playlist queue from its playlist.
620 @var{emms-playlist-sort-function}.
621 @end defun
622 @defun emms-show &optional insertp
623 Describe the current Emms track in the minibuffer. If @var{insertp} is
624 non-nil, insert the description into the current buffer instead. This
625 function uses @var{emms-show-format} to format the current track.
626 @end defun
627 The command @command{emms-show-all} will pop up a window with the
628 complete information about the track being
629 played. @command{emms-show-all} is provided by
630 @file{emms-show-all.el}, which is included in the `emms-all' setup
631 level. See @xref{Setup}.
632
633
634 @c -------------------------------------------------------------------
635 @node The Core File
636 @chapter The Core File
637
638 @cindex core file
639 @cindex heart of Emms
640 @cindex primitive functions
641
642 The core file @file{emms.el} provides the all basic functions for
643 playing music, generating playlists and defining players.
644
645 @menu
646 * User Variables:: Variables for the user to tweak.
647 * Hooks:: Hooks for important Emms functions.
648 * Core Functions:: Providing the basic functionality of Emms.
649 @end menu
650
651
652
653 @node User Variables
654 @section User Variables
655
656 @cindex user variables
657 @cindex options
658
659 The core file defines a number of user variables.
660
661 @defopt emms-player-list
662 A list of players Emms can use. You need to set this in order to use
663 Emms to play media.
664 @end defopt
665 @defopt emms-show-format
666 The format to use for @command{emms-show}. Any "%s" is replaced by
667 what @var{emms-track-description-function} returns for the currently
668 playing track.
669 @end defopt
670 @defopt emms-repeat-playlist
671 Non-nil if the Emms playlist should automatically repeat the playlist.
672 If nil, playback will stop when the last track finishes playing.
673 @end defopt
674 @defopt emms-track-description-function
675 Function for describing an Emms track in a user-friendly way.
676 @end defopt
677 @defopt emms-sort-lessp-function
678 A function that compares two tracks, and returns non-nil if the first
679 track should be sorted before the second (see also @code{sort}).
680 @end defopt
681
682
683
684 @node Hooks
685 @section Hooks
686
687 @cindex hooks
688 @cindex adding functionality
689
690 The core file provides hook variables for the basic functionality of
691 Emms.
692
693 @defopt emms-player-started-hook
694 A hook run when an Emms player started playing.
695 @end defopt
696 @defopt emms-player-stopped-hook
697 A hook run when an Emms player stopped playing. See also
698 @var{emms-player-finished-hook}.
699 @end defopt
700 @defopt emms-playlist-source-inserted-hook
701 Hook run when a source got inserted into the playlist. The buffer is
702 narrowed to the new tracks.
703 @end defopt
704 @defopt emms-playlist-selection-changed-hook
705 Hook run after another track is selected in the Emms playlist.
706 @end defopt
707 @defopt emms-playlist-cleared-hook
708 Hook run after the current Emms playlist is cleared. This happens both
709 when the playlist is cleared and when a new buffer is created for it.
710 @end defopt
711 @defopt emms-player-finished-hook
712 Hook run when an Emms player finishes playing a track. Please pay
713 attention to the differences between @var{emms-player-finished-hook}
714 and @var{emms-player-stopped-hook}. The former is called only when the
715 player is stopped interactively; the latter, only when the player
716 actually finishes playing a track.
717 @end defopt
718 @defopt emms-player-paused-hook
719 Hook run when a player is paused or resumed. Use
720 @var{emms-player-paused-p} to find the current state.
721 @end defopt
722
723
724
725 @node Core Functions
726 @section Core Functions
727
728 @cindex core functions
729 @cindex basic functions
730
731 The core file also defines all the functions important to the basic
732 use of Emms.
733
734 There are functions which deal with movement in the playlist.
735
736 @defun emms-next-noerror
737 Start playing the next track in the Emms playlist. Unlike
738 @code{emms-next}, this function doesn't signal an error when called at
739 the end of the playlist. This function should only be called when no
740 player is playing. This is a good function to put in
741 @code{emms-player-finished-hook}.
742 @end defun
743 @defun emms-playlist-next
744 Move to the next track in the current buffer.
745 @end defun
746 @defun emms-playlist-previous
747 Move to the previous track in the current buffer.
748 @end defun
749 @defun emms-random
750 Jump to a random track.
751 @end defun
752 @defun emms-toggle-repeat-playlist
753 Toggle whether emms repeats the playlist after it is done. See
754 @var{emms-repeat-playlist}.
755 @end defun
756 @defun emms-toggle-repeat-track
757 Toggle whether emms repeats the current track. See
758 @var{emms-repeat-track}.
759 @end defun
760 @defun emms-toggle-random-playlist
761 Toggle whether emms plays the tracks randomly or sequentially. See
762 @end defun
763 @var{emms-random-playlist}.
764
765 Some functions deal with the getting and setting track information.
766
767 @defun emms-track type name
768 Create a track with type @var{type} and name @var{name}.
769 @end defun
770 @defun emms-track-type track
771 Return the type of @var{track}.
772 @end defun
773 @defun emms-track-name track
774 Return the name of @var{track}.
775 @end defun
776 @defun emms-track-get name track &optional inexistent
777 Return the value of @var{name} for @var{track}. If there is no value,
778 return @var{default} (or nil, if not given).
779 @end defun
780 @defun emms-track-set track name value
781 Set the value of @var{name} for @var{track} to @var{value}.
782 @end defun
783 @defun emms-track-description track
784 Return a description of @var{track}. This function uses
785 @var{emms-track-description-function}.
786 @end defun
787 @defun emms-player-for track
788 Return an Emms player capable of playing @var{track}. This will be the
789 first player whose PLAYABLEP function returns non-nil, or nil if no
790 such player exists.
791 @end defun
792 @defun emms-playlist-current-selected-track
793 Return the currently selected track in the current playlist.
794 @end defun
795
796 There are also functions which deal with the playing itself.
797
798 @defun emms-player-start track
799 Start playing @var{track}.
800 @end defun
801 @defun emms-player-stop
802 Stop the currently playing player.
803 @end defun
804 @defun emms-player-stopped
805 Declare that the current Emms player is finished.
806 This should only be done by the current player itself.
807 @end defun
808
809 @defun emms-seek duration
810 Seek the current player by @var{duration} from its current position.
811 The argument @var{duration} can be:
812
813 @itemize @minus
814
815 @item
816 A single number, in which case it is interpreted as seconds.
817
818 @item
819 A string of form @verb{|[-][HH:]MM:SS.m|}, where @verb{|HH|} is hours,
820 @verb{|MM|} is minutes, and @verb{|SS|} is seconds.
821
822 @end itemize
823
824 In both forms seconds can be a floating point number. A negative
825 value seeks backwards.
826 @end defun
827
828 @defun emms-seek-to timestamp
829 Seek the current player to @var{timestamp}. Acceptable forms for
830 @var{timestamp} are the same as time duration in @code{emms-seek},
831 except that timestamps cannot be negative.
832 @end defun
833
834 @defun emms-seek-forward
835 Seek ten seconds forward.
836 @end defun
837 @defun emms-seek-backward
838 Seek ten seconds backward.
839 @end defun
840
841 For more basic commands defined in the core file see @xref{Basic
842 Commands}.
843
844
845 @c -------------------------------------------------------------------
846 @node Sources
847 @chapter Sources
848
849 @cindex Sources
850
851 Sources allow Emms to add and play tracks. Emms comes with a number of
852 sources of its own. Sources are designed so that creating new ones
853 will be easy.
854
855 For examples of Emms sources for files and directories see
856 @file{emms-source-file.el}.
857
858 @defopt emms-source-file-default-directory
859 The default directory to look for media files.
860 @end defopt
861 @defun emms-play-find
862 Play all files in @var{emms-source-file-default-directory} that match
863 a specific regular expression.
864 @end defun
865 @defun emms-source-file &optional file
866 An Emms source for a single file - either @var{file}, or queried from the
867 user.
868 @end defun
869 @defun emms-source-files files
870 An Emms source for a list of @var{files}.
871 @end defun
872 @defun emms-source-directory &optional dir
873 An Emms source for a whole directory tree - either @var{dir}, or queried
874 from the user
875 @end defun
876 @defun emms-source-directory-tree & optional dir
877 An Emms source for multiple directory trees - either @var{dir}, or the
878 value of @var{emms-source-file-default-directory}.
879 @end defun
880 @defun emms-source-playlist file
881 An Emms source for playlists. See @var{emms-source-playlist-formats}
882 for a list of supported formats.
883 @end defun
884 @defun emms-source-playlist-native file
885 An Emms source for a native Emms playlist file.
886 @end defun
887 @defun emms-source-playlist-m3u file
888 An Emms source for an m3u playlist file.
889 @end defun
890 @defun emms-source-playlist-pls file
891 An Emms source for a pls playlist file.
892 @end defun
893 @defun emms-source-find &optional dir regex
894 An Emms source that will find files in @var{dir} or
895 @var{emms-source-file-default-directory} that match @var{regexp}.
896 @end defun
897 @defun emms-source-beets database filter sort
898 An Emms source that will read a @command{beets} library database
899 (requires Emacs to be built with SQLite support). With prefix
900 argument @var{filter}, interactively filter the database. With a
901 double (or more) prefix argument, also set @var{sort} interactively;
902 otherwise use @var{emms-source-beets-sort-columns}. If @var{database}
903 is omitted or nil, @var{emms-source-beets-database} is used.
904 @end defun
905 @defun emms-source-file-directory-tree &optional dir
906 Return a list of all files under @var{dir} which match @var{regex}.
907 @end defun
908 @defun emms-play-dired
909 Play all marked files of a dired buffer
910 @end defun
911 @defun emms-add-dired
912 Add all marked files of a dired buffer
913 @end defun
914 @defun emms-source-file-regex
915 Return a regexp that matches everything any player (that supports
916 files) can play.
917 @end defun
918 @defun emms-locate regexp
919 Search for @var{regexp} and display the results in a locate buffer
920 @end defun
921
922
923 @c -------------------------------------------------------------------
924 @node Simple Players
925 @chapter Simple Players
926
927 @cindex players, simple
928
929 @defmac define-emms-simple-player name types regex command &rest args
930 Define a simple player.
931 @var{name} is used to construct the name of the function like
932 emms-player-@var{name}. @var{types} is a list of track types
933 understood by this player. @var{regex} must be a regexp that matches
934 the filenames the player can play. @var{command} specifies the command
935 line argument to call the player and @var{args} are the command line
936 arguments.
937 @end defmac
938
939 For a discussion on how to define new players see @xref{New Player}.
940
941 @defun emms-player-simple-stop
942 Stop the currently playing process, if indeed there is one.
943 @end defun
944 @defun emms-player-simple-start filename cmdname params
945 Starts a process playing @var{filename} using the specified @var{cmdname} with
946 the specified @var{params}.
947 @end defun
948 @defun emms-player-simple-sentinel proc str
949 Sentinel for determining the end of process for the process @var{proc}
950 and the sentinel string @var{str}.
951 @end defun
952
953
954 @c -------------------------------------------------------------------
955 @node Playlists
956 @chapter Playlists
957
958 @cindex organizing tracks and media
959
960 Emms uses Emacs buffers to store the media tracks for playing. We call
961 one such buffer a ``playlist buffer'' or an ``Emms playlist
962 buffer''. Emms then proceeds to play the media tracks in the buffer
963 from top to bottom until the end of the playlist.
964
965 The name of the playlist buffer is defined in the variable
966 @var{emms-playlist-buffer-name} and is set to be an invisible Emacs
967 buffer by default. You can change to any name you want. For an example
968 configuration see @xref{Configuration}.
969
970 You can create any number of playlist buffers you wish. At any time
971 Emms has a single ``current'' buffer through which it proceeds track
972 by track. A saved playlist can be added to the current buffer by
973 calling @kbd{M-x emms-add-playlist} or @kbd{M-x emms-play-playlist},
974 which also plays the tracks immediately.
975
976 The current Emms playlist buffer is stored in the variable
977 @var{emms-playlist-buffer}.
978
979 @defun emms-playlist-new &optional name
980 Create a new playlist buffer.
981 The buffer is named @var{name}, but made unique. @var{name} defaults
982 to `emms-playlist-buffer-name'. If called interactively, the new
983 buffer is also selected.
984 @end defun
985
986 @defun emms-playlist-save &optional format file
987 Store the current playlist to FILE as the type FORMAT. The default
988 format is specified by @var{emms-source-playlist-default-format}.
989 @end defun
990
991 @defun emms-playlist-clear
992 Clears the playlist buffer.
993 @end defun
994
995 @defun emms-playlist-current-clear
996 Clear the current playlist. If no current playlist exists, a new one
997 is generated.
998 @end defun
999
1000 @defun emms-playlist-current-kill
1001 Kill the current EMMS playlist buffer and switch to the next one.
1002 @end defun
1003
1004 @defun emms-playlist-length
1005 Display the total playing time of the current playlist.
1006 @end defun
1007
1008 @defun emms-playlist-total-playing-time
1009 Alias for @code{emms-playlist-length}.
1010 @end defun
1011
1012
1013 @c -------------------------------------------------------------------
1014 @node Track Information
1015 @chapter Track Information
1016
1017 @cindex track information
1018 @cindex info tags
1019
1020 By default Emms will only list tracks as file names or URLs in
1021 playlists (@pxref{Playlists}) and the browser (@pxref{The Browser}).
1022 However, Emms can be configured to utilize so-called @dfn{info
1023 methods} to augment tracks with metadata information, such as artist
1024 name, track name, album title, and the like. We describe these
1025 methods and their use in this chapter.
1026
1027 Fundamentally, info methods are Emacs Lisp functions that are called
1028 for each track to provide information for that track. Current info
1029 methods in Emms are restricted to tracks that are files; they do not
1030 work with stream URLs (@pxref{Streaming Audio}). Some of the methods
1031 require installation of some additional software that Emms can then
1032 call to read metadata from disk (@pxref{Metadata Utilities}).
1033 Finally, some methods work only with a limited set of media file
1034 formats such as Ogg or MP3, while some methods support a wide variety
1035 of formats.
1036
1037 If caching is enabled (it is by default) then the metadata for each
1038 track will be stored in the cache for faster retrieval. That means if
1039 you change info method and want updated tracks, you will have to reset
1040 the cache @kbd{M-x emms-cache-reset} and then repopulate with @kbd{M-x
1041 emms-add-directory-tree RET ~/Music/ RET} or similar.
1042
1043 Automatic track information retrieval is enabled by default in the
1044 @code{emms-all} setup level (@pxref{Setup}). That setup level
1045 configures Emms to use @code{emms-info-native} and
1046 @code{emms-info-cueinfo} methods, as they are the only methods that do
1047 not rely on additional software.
1048
1049 Here is a list of all info methods distributed with Emms and their
1050 software requirements:
1051
1052 @table @code
1053
1054 @item emms-info-native
1055 This method is implemented completely in Emacs Lisp and hence does not
1056 require any external software. It supports Ogg Vorbis, Opus, FLAC and
1057 MP3 files.
1058
1059 @item emms-info-tinytag
1060 This method utilizes a small Python library @code{tinytag}. It
1061 supports MP3, Ogg Vorbis, Opus, MP4, M4A, FLAC, WMA and WAV formats.
1062
1063 @item emms-info-exiftool
1064 This method calls @command{exiftool} utility written in Perl. It
1065 supports dozens of media file formats, far too many to list here.
1066
1067 @item emms-info-libtag
1068 This method calls a small ``shim'' executable
1069 @command{emms-print-metadata} built around TagLib library. It
1070 supports MP3, Ogg Vorbis, Opus, FLAC, MPC, Speex, WavPack, TrueAudio,
1071 WAV, AIFF, MP4 and ASF formats.
1072
1073 @item emms-info-metaflac
1074 This method calls @command{metaflac} utility. It works only with FLAC
1075 files.
1076
1077 @item emms-info-mp3info
1078 This method calls @command{mp3info} utility. It works only with MP3
1079 files that have older id3v1 tags.
1080
1081 @item emms-info-ogginfo
1082 This method calls @command{ogginfo} utility. It supports Ogg Vorbis
1083 and Theora formats.
1084
1085 @item emms-info-opusinfo
1086 This method calls @command{opusinfo} utility. It works only with Opus
1087 files.
1088
1089 @item emms-info-cueinfo
1090 This is a special method that parses track information from an
1091 accompanying cue file for FLAC and APE files (@pxref{APE / FLAC
1092 Commands}). It does not require any additional software.
1093
1094 @end table
1095
1096 To use any of the methods, add the method to
1097 @code{emms-info-functions} list. For example:
1098
1099 @lisp
1100 (require 'emms-info-native)
1101 (add-to-list 'emms-info-functions 'emms-info-native)
1102 @end lisp
1103
1104 @noindent
1105 You can also use a combination of format-specific tools if needed:
1106
1107 @lisp
1108 (require 'emms-info-mp3info)
1109 (require 'emms-info-ogginfo)
1110 (add-to-list 'emms-info-functions 'emms-info-mp3info 'emms-info-ogginfo)
1111 @end lisp
1112
1113 @noindent
1114 In this case both @code{emms-info-mp3info} and
1115 @code{emms-info-ogginfo} will be called for each track.
1116
1117 There are a number of user variables which control the behavior of
1118 @code{emms-info}:
1119
1120 @defopt emms-info-auto-update
1121 Non-nil when Emms should update track information if the file changes.
1122 This will cause hard drive activity on track loading. If this is too
1123 annoying for you, set this variable to nil.
1124 @end defopt
1125
1126 @defopt emms-info-asynchronously
1127 Non-nil when track information should be loaded asynchronously. This
1128 requires the feature @code{later-do} which is provided by the file
1129 @file{later-do.el}, which comes with Emms. See variable
1130 @code{emms-later-do-batch} for performance tweaking.
1131 @end defopt
1132
1133 @defopt emms-info-functions
1134 A list of functions (info methods) which add information to tracks.
1135 Each function is called with a track as argument. If two info methods
1136 produce the same information (for example album name), the latter one
1137 takes precedence.
1138 @end defopt
1139
1140 @menu
1141 * Metadata Utilities:: Supported external metadata utilities.
1142 * Defining Info Methods:: How to define new info methods.
1143 @end menu
1144
1145
1146
1147 @node Metadata Utilities
1148 @section Metadata Utilities
1149
1150 With the exception of @code{emms-info-native} and
1151 @code{emms-info-cueinfo}, Emms info methods require external metadata
1152 utilities to read metadata from media files. If you plan to use a
1153 certain info method, make sure you have the corresponding utility
1154 installed. All of these utilities are free software, and most of them
1155 are included in free GNU/Linux distributions.
1156
1157 @subsubheading tinytag
1158
1159 tinytag is a Python library for reading metadata from music files. It
1160 is available at @url{https://pypi.org/project/tinytag/}. Naturally a
1161 working Python interpreter is also required. The corresponding Emms
1162 info method is @code{emms-info-tinytag}.
1163
1164 It is best to configure @code{emms-info-tinytag} as the sole info
1165 method for Emms, because competing and overlapping methods can cause
1166 confusion. To use it, add the following into your Emacs initialization file:
1167
1168 @lisp
1169 (require 'emms-info-tinytag)
1170 (setq emms-info-functions '(emms-info-tinytag))
1171 @end lisp
1172
1173 @subsubheading ExifTool
1174
1175 ExifTool is a platform-independent Perl library and a command-line
1176 application for reading, writing and editing meta information in a
1177 wide variety of files. It is available at
1178 @uref{https://exiftool.org/}. Naturally a working Perl interpreter is
1179 also required. The corresponding Emms info method is
1180 @code{emms-info-exiftool}.
1181
1182 It is best to configure @code{emms-info-exiftool} as the sole info
1183 method for Emms, because competing and overlapping methods can cause
1184 confusion. To use it, add the following into your Emacs
1185 initialization file:
1186
1187 @lisp
1188 (require 'emms-info-exiftool)
1189 (setq emms-info-functions '(emms-info-exiftool))
1190 @end lisp
1191
1192 @subsubheading TagLib
1193
1194 TagLib is a library for reading and editing metadata of several
1195 popular audio formats. It is available at
1196 @url{http://taglib.github.io/}. Because TagLib is a C++ library
1197 instead of an executable program, you have to build and install a
1198 small ``shim'' executable @command{emms-print-metadata} around it.
1199 @code{emms-info-libtag} will then call this executable to read
1200 metadata from media files.
1201
1202 To compile @command{emms-print-metadata} invoke
1203
1204 @command{make emms-print-metadata}
1205
1206 @noindent
1207 in Emms directory. For this to succeed you need to have a working C++
1208 compiler and TagLib development libraries installed on your system.
1209 The resultant binary executable will be installed when you invoke
1210
1211 @command{make install} as in @xref{Compiling Emms}.
1212
1213 @noindent
1214 It is of course also possible to install only the
1215 @file{emms-print-metadata} binary where your system can find and
1216 execute it without installing all of Emms via the make command.
1217
1218 Once @command{emms-print-metadata} is available, it is best to
1219 configure @code{emms-info-libtag} as the sole info method for Emms,
1220 because competing and overlapping methods can cause confusion. To use
1221 it, add the following into your Emacs initialization file:
1222
1223 @lisp
1224 (require 'emms-info-libtag)
1225 (setq emms-info-functions '(emms-info-libtag))
1226 @end lisp
1227
1228 @subsubheading metaflac
1229
1230 @command{metaflac} is the command-line FLAC file metadata editor. It
1231 is included in FLAC source distribution available at
1232 @url{https://github.com/xiph/flac}. The corresponding info method is
1233 @code{emms-info-metaflac}. To use it, add the following into your
1234 Emacs initialization file:
1235
1236 @lisp
1237 (require 'emms-info-metaflac)
1238 (add-to-list 'emms-info-functions 'emms-info-metaflac)
1239 @end lisp
1240
1241 @subsubheading MP3info
1242
1243 MP3info is a small utility for reading and modifying id3v1 tags from
1244 MP3 files. Note that more recent id3v2 tags are not supported; for
1245 those you need to use another info method, for example
1246 @code{emms-info-native}. MP3info is available at
1247 @url{https://ibiblio.org/mp3info/}.
1248
1249 The corresponding info method is @code{emms-info-mp3info}. To use it,
1250 add the following into your Emacs initialization file:
1251
1252 @lisp
1253 (require 'emms-info-mp3info)
1254 (add-to-list 'emms-info-functions 'emms-info-mp3info)
1255 @end lisp
1256
1257 @subsubheading ogginfo
1258
1259 @command{ogginfo} is a small utility for extracting information about
1260 Ogg Vorbis and Theora files. It is part of Vorbis Tools source
1261 distribution available at @url{https://github.com/xiph/vorbis-tools}.
1262 The corresponding info method is @code{emms-info-ogginfo}. To use it,
1263 add the following into your Emacs initialization file:
1264
1265 @lisp
1266 (require 'emms-info-ogginfo)
1267 (add-to-list 'emms-info-functions 'emms-info-ogginfo)
1268 @end lisp
1269
1270 @subsubheading opusinfo
1271
1272 @command{opusinfo} is a small utility for extracting information about
1273 Opus files. It is part of Opus Tools source distribution available at
1274 @url{https://github.com/xiph/opus-tools}. The corresponding info
1275 method is @code{emms-info-opusinfo}. To use it, add the following
1276 into your Emacs initialization file:
1277
1278 @lisp
1279 (require 'emms-info-opusinfo)
1280 (add-to-list 'emms-info-functions 'emms-info-opusinfo)
1281 @end lisp
1282
1283 @node Defining Info Methods
1284 @section Defining Info Methods
1285
1286 @cindex defining info methods
1287
1288 An info method essentially consists of a function which, given an Emms
1289 track, sets the appropriate @dfn{info-symbols} for that track. Info
1290 symbols are keys that have an associated value stored in the
1291 @dfn{metadata cache}. While info symbols can have arbitrary names,
1292 the following symbols are recognized by Emms:
1293
1294 @table @code
1295 @item info-album
1296 Album title.
1297
1298 @item info-albumsort
1299 Album title for collation.
1300
1301 @item info-artist
1302 Artist name.
1303
1304 @item info-artistsort
1305 Artist name for collation.
1306
1307 @item info-albumartist
1308 Album artist name.
1309
1310 @item info-albumartistsort
1311 Album artist name for collation.
1312
1313 @item info-composer
1314 Composer name.
1315
1316 @item info-composersort
1317 Composer name for collation.
1318
1319 @item info-date
1320 Release date.
1321
1322 @item info-originaldate
1323 Original release date.
1324
1325 @item info-performer
1326 Performer name.
1327
1328 @item info-title
1329 Track title.
1330
1331 @item info-titlesort
1332 Track title for collation.
1333
1334 @item info-tracknumber
1335 Track number.
1336
1337 @item info-discnumber
1338 Disc number.
1339
1340 @item info-year
1341 Release year.
1342
1343 @item info-originalyear
1344 Original release year.
1345
1346 @item info-note
1347 Free-form note.
1348
1349 @item info-genre
1350 Genre.
1351
1352 @item info-label
1353 Record label.
1354
1355 @item info-playing-time
1356 Playing time in seconds.
1357
1358 @end table
1359
1360 @noindent
1361 An info method does not need to add all of these symbols into the
1362 given track. It can also add other symbols, but those extra symbols
1363 won't be used by Emms.
1364
1365 We can for example look at the predefined method for retrieving
1366 information about audio tracks in the Ogg format. The function
1367 @code{emms-info-ogginfo} provided by @file{emms-info-ogginfo.el}
1368 accepts an Emms track @var{track} as a single argument. It uses
1369 @command{ogginfo} utility to extract a list of key-value metadata
1370 pairs from the file represented by @var{track}. Next, it sets the
1371 appropriate info symbols for @var{track} by calling
1372 @code{emms-track-set}. Info symbols are interned from the extracted
1373 keys. Those keys can be arbitrary strings, but they typically
1374 coincide with the keys listed above; for example ``album'' and
1375 ``artist'' form info symbols @code{info-album} and @code{info-artist}.
1376
1377 @c -------------------------------------------------------------------
1378 @node Interactive Playlists
1379 @chapter Interactive Playlists
1380
1381 @cindex Interactive Playlists
1382
1383 Emms provides a visual, interactive playlist mode as well as the
1384 ability to use playlists without ever looking at then. This visual,
1385 interactive mode is called the `emms-playlist-mode' and is defined in
1386 @file{emms-playlist-mode.el}.
1387
1388 The interactive playlist mode is enabled by default in the `emms-all'
1389 setup level. For more information about Emms setup levels see
1390 @xref{Setup}.
1391
1392 @defun emms-playlist-mode-go
1393 Switch to the current emms-playlist buffer and use emms-playlist-mode.
1394 @end defun
1395
1396 If you wish to make this the default Emms playlist mode, add the
1397 following to your @file{.emacs}.
1398
1399 @lisp
1400 (setq emms-playlist-default-major-mode 'emms-playlist-mode)
1401 @end lisp
1402
1403 The interactive playlist buffer shows the tracks in the current Emms
1404 playlist in the order in which they will be played. The current track
1405 will be highlighted.
1406
1407 When in the interactive playlist mode we can perform different actions
1408 on the current playlist.
1409
1410 @table @kbd
1411
1412 @item a
1413 @findex emms-playlist-mode-add-contents
1414 Add files in the playlist at point to the current playlist buffer.
1415 If we are in the current playlist, make a new playlist buffer and
1416 set it as current.
1417
1418 @item i
1419 @findex emms-playlist-playlist-insert-track
1420 Insert track at point into active playlist.
1421
1422 @item b
1423 @findex emms-playlist-set-playlist-buffer
1424 Set the current playlist buffer.
1425
1426 @item n
1427 @findex emms-next
1428 Start playing the next track in the playlist.
1429
1430 @item p
1431 @findex emms-next
1432 Start playing the previous track in the playlist.
1433
1434 @item s
1435 @findex emms-stop
1436 Stop playing.
1437
1438 @item P
1439 @findex emms-pause
1440 Pause.
1441
1442 @item >
1443 @findex emms-seek-forward
1444 Seek ten seconds forward.
1445
1446 @item <
1447 @findex emms-seek-backward
1448 Seek ten seconds backward.
1449
1450 @item f
1451 @findex emms-show
1452 Describe the currently playing track in the minibuffer.
1453
1454 @item c
1455 @findex emms-playlist-mode-center-current
1456 Display the current track in the center of the screen.
1457
1458 @item RET
1459 @findex emms-playlist-mode-play-current-track
1460 Start playing the track under point. Note that this is also available
1461 with @kbd{<mouse-2>}.
1462
1463 @item SPC
1464 @findex scroll-up
1465 Scroll up a near full page.
1466
1467 @item M-<
1468 @findex emms-playlist-mode-first
1469 Go to the first track in the playlist.
1470
1471 @item M->
1472 @findex emms-playlist-mode-last
1473 Go to the last track in the playlist.
1474
1475 @item r
1476 @findex emms-random
1477 Go to a randomly selected track in the playlist.
1478
1479 @item q
1480 @findex bury-buffer
1481 Put the interactive playlist buffer at the end of the list of all
1482 buffers.
1483
1484 @item C-x C-s
1485 @findex emms-playlist-save
1486 Save the current playlist buffer to a file. By default, Emms will ask
1487 you for confirmation before overwriting an existing playlist. You can
1488 silently overwrite existing playlist by setting
1489 @var{emms-source-playlist-ask-before-overwrite} to nil.
1490
1491 @item ?
1492 @findex describe-mode
1493 Describe the mode.
1494
1495 @item C-i
1496 @findex emms-playlist-mode-shift-track-up
1497 Shift the track at point up one line.
1498
1499 @item C-o
1500 @findex emms-playlist-mode-shift-track-down
1501 Shift the track at point down one line.
1502
1503 @item M-n
1504 @findex emms-playlist-mode-next
1505 Switch to the next playlist buffer.
1506
1507 @item M-p
1508 @findex emms-playlist-mode-previous
1509 Switch to the previous playlist buffer.
1510
1511
1512 @end table
1513
1514 We can also edit the playlist using familiar GNU/Emacs commands:
1515
1516 @table @kbd
1517
1518 @item C-k
1519 @findex emms-playlist-mode-kill-track
1520 Remove the track under point from the playlist buffer. Also available
1521 using the @kbd{d} key.
1522
1523 @item C-y
1524 @findex emms-playlist-mode-yank
1525 See the command @command{yank}
1526
1527 @item M-y
1528 @findex emms-playlist-mode-yank-pop
1529 See the command @command{yank-pop}.
1530
1531 @item C-j
1532 @findex emms-playlist-mode-insert-newline
1533 Insert a newline at point.
1534 @end table
1535
1536 We can use the regular GNU/Emacs killing and yanking commands to move
1537 and copy tracks in between playlist buffers. We can use the same
1538 commands to insert arbitrary text into the playlist buffers together
1539 with the playlist tracks. Text which is not a track is ignored by the
1540 program and can therefore be used to include titles and annotations
1541 within the playlist.
1542
1543
1544 @c -------------------------------------------------------------------
1545 @node Markable Playlists
1546 @chapter Markable Playlists
1547
1548 @cindex Markable Playlists
1549
1550 The Markable Playlists provided by the file @file{emms-mark.el} are an
1551 alternative to the default interactive playlists, @xref{Interactive
1552 Playlists}. They allow marking tracks with keybindings familiar to users
1553 of dired.
1554
1555 To enable the Markable Playlists you have to add
1556
1557 @lisp
1558 (require 'emms-mark)
1559 @end lisp
1560
1561 to your @file{.emacs}. Then you can activate @command{emms-mark-mode} by
1562 executing @command{M-x emms-mark-mode} in a playlist buffer. You can
1563 return to the default interactive playlist mode with @command{M-x
1564 emms-mark-mode-disable}.
1565
1566 If you wish to make this the default Emms playlist mode, add the
1567 following to your @file{.emacs}.
1568
1569 @lisp
1570 (setq emms-playlist-default-major-mode 'emms-mark-mode)
1571 @end lisp
1572
1573 @table @kbd
1574
1575 @item m
1576 @findex emms-mark-forward
1577 Marks the current track and sets point one line forward. If a prefix
1578 argument ARG is given, it will mark the next ARG tracks and set point
1579 accordingly. A negative argument marks backward.
1580
1581 @item U
1582 @findex emms-mark-unmark-all
1583 Unmarks all tracks in the playlist.
1584
1585 @item t
1586 @findex emms-mark-toggle
1587 Toggles mark on the current track.
1588
1589 @item u
1590 @findex emms-mark-unmark-forward
1591 Unmarks same way as @command{emms-mark-forward} marks.
1592
1593 @item % m
1594 @findex emms-mark-regexp
1595 Marks all tracks in the playlist matching the given regular
1596 expression. A prefix argument means to unmark them instead.
1597 @end table
1598
1599 When tracks are marked you can operate on them:
1600
1601 @table @kbd
1602
1603 @item D
1604 @findex emms-mark-delete-marked-tracks
1605 Deletes the marked tracks from the playlist.
1606
1607 @item K
1608 @findex emms-mark-kill-marked-tracks
1609 Deletes the marked tracks from the playlist and places them in the
1610 kill-ring, so that you can @command{yank} in into another playlist.
1611
1612 @item W
1613 @findex emms-mark-copy-marked-tracks
1614 Adds the marked tracks to the kill-ring, so that you can @command{yank}
1615 them into another playlist.
1616 @end table
1617
1618 emms-mark is also intent to provide a way for user to select tracks
1619 for other command to operate on them. Currently,
1620 @file{emms-tag-editor.el} uses the emms-mark to edit the tags of
1621 selected tracks. Two functions are useful for the elisp programer to
1622 handle marked tracks.
1623
1624 @defun emms-mark-do-with-marked-track
1625 This function take a function to perform on all marked tracks. A
1626 optional argument `move-flag' to tell the function to move forward
1627 line after calling given function. If the given function didn't change
1628 position, the second argument should set to non-nil.
1629 @end defun
1630
1631 @defun emms-mark-mapcar-marked-track
1632 This function is very similar to `emms-mark-do-with-marked-track'
1633 except it collects result of given function (that's why named with
1634 `mapcar').
1635 @end defun
1636
1637
1638
1639 @c -------------------------------------------------------------------
1640 @node Extending Emms
1641 @chapter Extending Emms
1642
1643 @cindex new players
1644 @cindex defining players
1645 @cindex new players, defining
1646
1647 Emms introduces a high abstraction layer for playing music so you can
1648 customise it to your needs.
1649
1650 @menu
1651 * New Player:: How to define a new player.
1652 * Simple Player for `play':: An example player using @command{play}.
1653 * More Complex Player:: Example of a complex player using @command{mpg321}.
1654 @end menu
1655
1656
1657
1658 @node New Player
1659 @section New Player
1660
1661 @cindex new player
1662 @cindex defining new players
1663
1664 The file @file{emms-player-simple.el} defines some easy players to
1665 start with, but it shouldn't be hard to provide a function for your
1666 favourite player. We will start with an easy example that shows how
1667 we can use the @command{play} command under Unix to play our WAV files.
1668
1669
1670
1671 @node Simple Player for `play'
1672 @section Simple Player for `play'
1673
1674 @cindex simple player
1675 @cindex primitive player
1676 @cindex basic player
1677
1678 Play is a very easy command line player for various format. If you
1679 want your emms to play WAV files just put the following lines in you
1680 @file{.emacs}:
1681
1682 @lisp
1683 (require 'emms-player-simple)
1684 (define-emms-simple-player play '(file) "\\.wav$" "play")
1685 @end lisp
1686 @noindent
1687
1688 Huh! Wasn't that easy?
1689
1690 The macro function @command{define-emms-simple-player} takes a minimum
1691 of three arguments. The first argument (@emph{play} in our example)
1692 defines the name of the player. It's used to name the player
1693 functions. The second is a regexp, that defines which files to play
1694 with our player. @emph{\\.wav$} matches any filename ending with a dot
1695 and the string wav. The last argument is the actual command line
1696 command we use to play our files. You can also add the path but we
1697 just assume that the command is in your path. All arguments you add to
1698 these three are optional. They define the command line arguments you
1699 want to add to your argument. If you want to hear the wav file of your
1700 favourite artist in the most possible volume use the following line:
1701
1702 @lisp
1703 (require 'emms-player-simple)
1704
1705 (define-emms-simple-player play
1706 '(file)
1707 "\\artist-*.wav$"
1708 "play"
1709 "--volume=100")
1710 @end lisp
1711 @noindent
1712
1713 Please notice that you have to add the arguments as strings!
1714
1715 The command line tool you use for @command{define-emms-simple-player}
1716 has to take one song as argument and stop after playing that
1717 particular song. For any other concept you will need to customise
1718 emms a bit more...
1719
1720
1721
1722 @node More Complex Player
1723 @section More Complex Player
1724
1725 @cindex complex player
1726 @cindex advanced player
1727
1728 The most players you use will be simple players so you don't need to
1729 read this chapter. But if you are curious how you can use (almost) every
1730 player in emms read further...
1731
1732 In this chapter we will use mpg321 to construct a player that
1733 actually can pause a track, restart it and show rest time. We won't
1734 implement all of that, but after that chapter you will know how to
1735 define it.
1736
1737 The command @command{define-emms-simple-player} is just a abstraction
1738 layer for @command{define-emms-player}, which is a little bit more
1739 complicated but much more powerful!
1740
1741 @lisp
1742 (define-emms-player "emms-mpg321-remote"
1743 :start 'emms-mpg321-remote-start
1744 :stop 'emms-mpg321-remote-stop
1745 :playablep 'emms-mpg321-remote-playable-p)
1746 @end lisp
1747 @noindent
1748
1749 So, that is almost all! @command{define-emms-player} takes a minimum
1750 of three arguments. The first is the name of the player. The rest are
1751 methods with functions to call. Three methods are required: start,
1752 stop and playable. Start says Emms how to start a track (sic!), stop
1753 how to stop a player and playablep should return non-nil if the player
1754 can play the track.
1755
1756 So we just need these three functions to get our mpg321-remote:
1757
1758 First we code the start function. We will check if there's a open
1759 process and start one otherwise. Then we send a string to the process
1760 with the filename and set a filter.
1761
1762 @lisp
1763 (defun emms-mpg321-remote-start ()
1764 (unless (get-process ``mpg321-remote'')
1765 (setq emms-mpg321-remote-process
1766 (start-process "mpg321-remote-process"
1767 "*mpg321*" "mpg321" "-R" "abc"))
1768 (process-send-string "mpg321-remote-process"
1769 (concat "l " (emms-track-name track)))
1770 (set-process-filter emms-mpg321-remote-process 'emms-mpg321-remote-filter)))
1771 @end lisp
1772 @noindent
1773
1774 We need the filter, as mpg321-remote won't quit after playing the
1775 track as the simple player do. We wait until the process sends the
1776 output ``(at-sign)P 0'' (the signal of mpg321 that the song ended) to the
1777 filter and call emms-mpg321-remote-stop.
1778
1779 @lisp
1780 (defun emms-mpg321-remote-filter (process output)
1781 (when (string-match "(at-sign)P 0" output)
1782 (emms-mpg321-remote-stop)))
1783 @end lisp
1784 @noindent
1785
1786 @command{emms-mpg321-remote-stop} won't do anything interesting. It
1787 just test if there are other files to play and close the process otherwise.
1788
1789 @lisp
1790 (defun emms-mpg321-remote-stop ()
1791 (unless emms-playlist
1792 (process-send-string "mpg321-remote-process" "Q\n"))
1793 @end lisp
1794 @noindent
1795
1796 And to make that a playable example I also added
1797 @command{emms-mpg321-remote-playablep}, which I really just steal
1798 from @file{emms-player-simple.el}
1799
1800 @lisp
1801 (defun emms-mpg321-remote-playablep (track)
1802 "Return non-nil when we can play this track."
1803 (and (emms-track-file-p track)
1804 @end lisp
1805 @noindent
1806
1807 Now we have a ready player and we could add commands like
1808 @command{emms-mpg321-remote-pause} for example.
1809
1810
1811
1812 @c -------------------------------------------------------------------
1813 @node The Browser
1814 @chapter The Browser
1815
1816 The Browser allows you to browse the metadata cache and add tracks to
1817 your playlist. It includes a powerful interactive mode.
1818
1819 The Browser is defined in @file{emms-browser.el} and is included in
1820 the @command{emms-all} setup level. For more information about Emms
1821 setup levels see @xref{Setup}.
1822
1823 You can also manually add the Browser to your Emms setup by loading it
1824 explicitly with:
1825
1826 @lisp
1827 (require 'emms-browser)
1828 @end lisp
1829
1830 To be properly useful, you should do M-x
1831 @command{emms-add-directory-tree} to all the files you own at least
1832 once so that the cache is fully populated.
1833
1834 @menu
1835 * Browser Interface:: The interactive browser interface.
1836 * Displaying Covers:: Displaying album covers in the browser interface.
1837 * Changing Looks:: Changing the tree structure, display format and faces.
1838 * Filtering Tracks - deprecated:: Displaying a subset of the tracks.
1839 @end menu
1840
1841
1842
1843 @node Browser Interface
1844 @section Browser Interface
1845
1846 The browser interface allows you to display and interact with your
1847 tracks in many different ways. There are a number of ways to start the
1848 browser.
1849
1850 @defun emms-smart-browse
1851 Display browser and playlist. Toggle between selecting browser,
1852 playlist or hiding both. Tries to behave sanely if the user has
1853 manually changed the window configuration.
1854 @end defun
1855
1856 @defun emms-browse-by-artist
1857 Display the browser and order the tracks by artist.
1858 @end defun
1859
1860 @defun emms-browse-by-album
1861 Display the browser and order the tracks by album.
1862 @end defun
1863
1864 @defun emms-browse-by-genre
1865 Display the browser and order the tracks by genre.
1866 @end defun
1867
1868 @defun emms-browse-by-year
1869 Display the browser and order the tracks by year.
1870 @end defun
1871
1872 @defun emms-browser-show-searches
1873 Show Search crumbs of the active searches.
1874 @end defun
1875
1876 @defun emms-browser-render-last-search
1877 Render the results for the last search with current settings.
1878 @end defun
1879
1880 Once the Browser is displayed you can use it to managed your track
1881 collection and playlists. The Browser is interactive and has its own
1882 keybindings.
1883
1884 @table @kbd
1885
1886 @item C-j
1887 @kindex C-j (emms-browser)
1888 @findex emms-browser-add-tracks-and-play
1889 Add all tracks at point, and play the first added track.
1890
1891 @item RET
1892 @kindex RET (emms-browser)
1893 @findex emms-browser-add-tracks
1894 Add all tracks at point.
1895
1896 @item SPC
1897 @kindex SPC (emms-browser)
1898 @findex emms-browser-toggle-subitems
1899 Show or hide (kill) subitems under the current line.
1900
1901 @item 1
1902 @kindex 1 (emms-browser)
1903 @findex emms-browser-collapse-all
1904 Collapse everything.
1905
1906 @item 2
1907 @kindex 2 (emms-browser)
1908 @findex emms-browser-expand-to-level-2
1909 Expand all top level items one level.
1910
1911 @item 3
1912 @kindex 3 (emms-browser)
1913 @findex emms-browser-expand-to-level-3
1914 Expand all top level items two levels.
1915
1916 @item 4
1917 @kindex 4 (emms-browser)
1918 @findex emms-browser-expand-to-level-4
1919 Expand all top level items three levels.
1920
1921 @item C
1922 @kindex C (emms-browser)
1923 @findex emms-browser-clear-playlist
1924 Clear the playlist.
1925
1926 @item E
1927 @kindex E (emms-browser)
1928 @findex emms-browser-expand-all
1929 Expand everything.
1930
1931 @item d
1932 @kindex d (emms-browser)
1933 @findex emms-browser-view-in-dired
1934 View the current directory in dired.
1935
1936 @item q
1937 @kindex q (emms-browser)
1938 @findex emms-browser-bury-buffer
1939 Bury the browser buffer.
1940
1941 @item r
1942 @kindex r (emms-browser)
1943 @findex emms-browser-goto-random
1944 Jump to a random track.
1945
1946 @item /
1947 @kindex / (emms-browser)
1948 @findex emms-isearch-buffer
1949 Isearch through the buffer.
1950
1951 @item <
1952 @kindex < (emms-browser)
1953 @findex emms-filters-previous-ring-filter
1954 Redisplay with the previous filter.
1955
1956 @item >
1957 @kindex > (emms-browser)
1958 @findex emms-filters-next-ring-filter
1959 Redisplay with the next filter.
1960
1961 @item ?
1962 @kindex ? (emms-browser)
1963 @findex describe-mode
1964 See the Emacs documentation for the function.
1965
1966 @item C-/
1967 @kindex C-/ (emms-browser)
1968 @findex emms-playlist-mode-undo
1969 Undo the previous playlist action.
1970
1971 @item <C-return>
1972 @kindex <C-return> (emms-browser)
1973 @findex emms-browser-add-tracks-and-play
1974 Add all tracks at point, and play the first added track.
1975
1976 @item <backtab>
1977 @kindex <backtab> (emms-browser)
1978 @findex emms-browser-prev-non-track
1979 Jump to the previous non-track element.
1980
1981 @item <tab>
1982 @kindex <tab> (emms-browser)
1983 @findex emms-browser-next-non-track
1984 Jump to the next non-track element.
1985
1986 @item s A
1987 @kindex s A (emms-browser)
1988 @findex emms-browser-search-by-album
1989 Search the collection by album.
1990
1991 @item s o
1992 @kindex s o (emms-browser)
1993 @findex emms-browser-search-by-albumartist
1994 Search the collection by artist.
1995
1996 @item s a
1997 @kindex s a (emms-browser)
1998 @findex emms-browser-search-by-artist
1999 Search the collection by artist.
2000
2001 @item s s
2002 @kindex s s (emms-browser)
2003 @findex emms-browser-search-by-names
2004 Search the collection by names.
2005
2006 @item s t
2007 @kindex s t (emms-browser)
2008 @findex emms-browser-search-by-title
2009 Search the collection by title.
2010
2011 @item s h
2012 @kindex s h (emms-browser)
2013 @findex emms-browser-show-searches
2014 Show the currently active searches in the search cache.
2015
2016 @item b 1
2017 @kindex b 1 (emms-browser)
2018 @findex emms-browse-by-artist
2019 Browse the collection by artist.
2020
2021 @item b 2
2022 @kindex b 2 (emms-browser)
2023 @findex emms-browse-by-album
2024 Browse the collection by album.
2025
2026 @item b 3
2027 @kindex b 3 (emms-browser)
2028 @findex emms-browse-by-genre
2029 Browse the collection by genre.
2030
2031 @item b 4
2032 @kindex b 4 (emms-browser)
2033 @findex emms-browse-by-year
2034 Browse the collection by year.
2035
2036 @item b 5
2037 @kindex b 5 (emms-browser)
2038 @findex emms-browse-by-composer
2039 Browse the collection by composer.
2040
2041 @item b 6
2042 @kindex b 6 (emms-browser)
2043 @findex emms-browse-by-performer
2044 Browse the collection by performer.
2045
2046 @item b 7
2047 @kindex b 5 (emms-browser)
2048 @findex emms-browse-by-albumartist
2049 Browse the collection by albumartist.
2050
2051 @item W a p
2052 @kindex W a p (emms-browser)
2053 @findex emms-browser-lookup-album-on-pitchfork
2054 Lookup the album using Pitchfork.
2055
2056 @item W o w
2057 @kindex W o w (emms-browser)
2058 @findex emms-browser-lookup-albumartist-on-wikipedia
2059 Lookup the album artist using Wikipedia.
2060
2061 @item W A w
2062 @kindex W A w (emms-browser)
2063 @findex emms-browser-lookup-artist-on-wikipedia
2064 Lookup the artist using Wikipedia.
2065
2066 @item W c w
2067 @kindex W c w (emms-browser)
2068 @findex emms-browser-lookup-composer-on-wikipedia
2069 Lookup the composer using Wikipedia.
2070
2071 @item W p w
2072 @kindex W p w (emms-browser)
2073 @findex emms-browser-lookup-performer-on-wikipedia
2074 Lookup the performer using Wikipedia.
2075
2076 @item W a w
2077 @kindex W a w (emms-browser)
2078 @findex emms-browser-lookup-album-on-wikipedia
2079 Lookup the album using Wikipedia.
2080
2081 @item +
2082 @kindex + (emms-browser)
2083 @findex emms-volume-raise
2084 Raise the volume
2085
2086 @item -
2087 @kindex - (emms-browser)
2088 @findex emms-volume-lower
2089 Lower the volume
2090
2091 @item i s
2092 @kindex i s (emms-browser)
2093 @findex emms-filters-status-print
2094 Print what is known about the filters and cache
2095
2096 @item i c
2097 @kindex i c (emms-browser)
2098 @findex emms-filters-show-cache-stack
2099 Show the current search cache stack.
2100
2101 @item i S
2102 @kindex i S (emms-browser)
2103 @findex emms-filters-show-cache-stash
2104 Show the cache names in the stash.
2105
2106 @item i f
2107 @kindex i f (emms-browser)
2108 @findex emms-filters-show-filters
2109 Show the filters there are.
2110
2111 @item i m
2112 @kindex i m (emms-browser)
2113 @findex emms-filters-show-filter-menu
2114 Show the menu tree of filters as a menu.
2115
2116 @item i F
2117 @kindex i F (emms-browser)
2118 @findex emms-filters-show-filter-factories
2119 Show the filter factories we have.
2120
2121 @item i r
2122 @kindex i r (emms-browser)
2123 @findex emms-filters-show-filter-ring
2124 Show the filters in the filter ring.
2125
2126 @item f q
2127 @kindex f q (emms-browser)
2128 @findex emms-filters-pop
2129 Pop the filter stack returning to last filter.
2130
2131 @item f r
2132 @kindex f r
2133 @findex emms-filters-swap (emms-browser)
2134 Reverse the last two entries in the filter stack.
2135
2136 @item f R
2137 @kindex f R (emms-browser)
2138 @findex emms-filters-swap-pop ; rotate-eject, ,pop-previous
2139 Reverse the last two entries in the filter stack, and pop the top one.
2140
2141 @item f S
2142 @kindex f S (emms-browser)
2143 @findex emms-filters-squash
2144 Squash the filter stack, keep the top entry.
2145
2146 @item f k
2147 @kindex f k (emms-browser)
2148 @findex emms-filters-keep
2149 Register the current filter into the list of filters for the session.
2150 If @var{emms-filters-multi-filter-save-file} is set, append the filter definition there.
2151
2152 @item f h
2153 @kindex f h (emms-browser)
2154 @findex emms-filters-hard-filter
2155 Build a cache from the current filter and push it to the cache stack.
2156
2157 @item f c
2158 @kindex f c (emms-browser)
2159 @findex emms-filters-clear
2160 Clear the meta filter stack and the current filter function.
2161
2162 @item >
2163 @kindex > (emms-browser)
2164 @findex emms-filters-next-ring-filter
2165 Move to the next filter in the filter ring.
2166
2167 @item <
2168 @kindex < (emms-browser)
2169 @findex emms-filters-previous-ring-filter
2170 Move to the previous filter in the filter ring.
2171
2172 @item f !
2173 @kindex f ! (emms-browser)
2174 @findex emms-filters-clear-ring-filter
2175 Set the ring filter to no filter.
2176
2177 @item f p
2178 @kindex f p (emms-browser)
2179 @findex emms-filters-push
2180 Push a filter to the meta-filter stack.
2181
2182 @item f s
2183 @kindex f s (emms-browser)
2184 @findex emms-filters-smash
2185 Clear the stack and select a filter to push to the stack.
2186
2187 @item f o
2188 @kindex f o (emms-browser)
2189 @findex emms-filters-or
2190 Add a filter to the current/last filter list in the current filter.
2191 Creates an OR.
2192
2193 @item f a
2194 @kindex f a (emms-browser)
2195 @findex emms-filters-and
2196 Select a filter to start a new list of filters, creates an AND.
2197
2198 @item f n
2199 @kindex f n (emms-browser)
2200 @findex emms-filters-and-not
2201 Select a filter to start a new list of filters, creates an AND-NOT list of filters.
2202
2203 @item c C
2204 @kindex c C (emms-browser)
2205 @findex emms-filters-clear-all
2206 Reset the cache stack, the filter stack and the filter-ring.
2207
2208 @item c p
2209 @kindex c p (emms-browser)
2210 @findex emms-filters-push-cache
2211 Cache/Store a filter and cache to the stack.
2212
2213 @item c z
2214 @kindex c z (emms-browser)
2215 @findex emms-filters-stash-pop-cache
2216 Stash the current cache for later, pop it from the stack.
2217
2218 @item c Z
2219 @kindex c Z (emms-browser)
2220 @findex emms-filters-stash-cache
2221 Stash the current cache for later.
2222
2223 @item c P
2224 @kindex c P (emms-browser)
2225 @findex emms-filters-pop-cache
2226 Pop the current cache from the stack.
2227
2228 @item c h
2229 @kindex c h (emms-browser)
2230 @findex emms-filters-hard-filter
2231 Create a cache from the current filter and push to the stack.
2232
2233 @item c r
2234 @kindex c r (emms-browser)
2235 @findex emms-filters-swap-cache
2236 Swap the top two caches on the stack.
2237
2238 @item c q
2239 @kindex c q (emms-browser)
2240 @findex emms-filters-pop-cache
2241 Pop the top cache from the stack.
2242
2243 @item c R
2244 @kindex c R (emms-browser)
2245 @findex emms-filters-swap-pop-cache
2246 Swap the top two caches on the stack, then pop the top one.
2247
2248 @item c S
2249 @kindex c S (emms-browser)
2250 @findex emms-filters-squash-caches
2251 Squash the cache stack, keep the top entry.
2252
2253 @item c c
2254 @kindex c c (emms-browser)
2255 @findex emms-filters-clear-caches
2256 Clear all the caches down to the main cache.
2257
2258 @item s o
2259 @kindex s o (emms-browser)
2260 @findex emms-filters-search-by-albumartist
2261 A fields search, quick one-shot for Album artist, push results to the cache stack.
2262
2263 @item s a
2264 @kindex s a (emms-browser)
2265 @findex mf-search-by-artist
2266 A fields search, quick one-shot for Artist, push results to the cache stack.
2267
2268 @item s c
2269 @kindex s c (emms-browser)
2270 @findex emms-filters-search-by-composer
2271 A fields search, quick one-shot for Composer, push results to the cache stack.
2272
2273 @item s p
2274 @kindex s p (emms-browser)
2275 @findex emms-filters-search-by-performer
2276 A fields search, quick one-shot for Permformer, push results to the cache stack.
2277
2278 @item s A
2279 @kindex s A (emms-browser)
2280 @findex emms-filters-search-by-album
2281 A fields search, quick one-shot for Album title, push results to the cache stack.
2282
2283 @item s t
2284 @kindex s t (emms-browser)
2285 @findex emms-filters-search-by-title
2286 A fields search, quick one-shot for Song title, push results to the cache stack.
2287
2288 @item s T
2289 @kindex s T (emms-browser)
2290 @findex emms-filters-search-by-titles
2291 A fields search, quick one-shot for Album and song titles, push results to the cache stack.
2292
2293 @item s n
2294 @kindex s n (emms-browser)
2295 @findex emms-filters-search-by-names
2296 A fields search, quick one-shot for all names, push results to the cache stack.
2297
2298 @item s s
2299 @kindex s s (emms-browser)
2300 @findex emms-filters-search-by-names-and-title
2301 A fields search, quick one-shot for all names and titles, push results to the cache stack.
2302
2303 @item s e
2304 @kindex s e (emms-browser)
2305 @findex emms-filters-search-by-all-text
2306 A fields search, quick one-shot in all text fields, push results to the cache stack.
2307
2308 @end table
2309
2310 @node Displaying Covers
2311 @section Displaying Covers
2312
2313 The browser will attempt to display cover images if they're
2314 available.
2315
2316 Customize @var{emms-browser-covers} to configure how EMMS should retrieve the
2317 covers.
2318
2319 By default it looks for images @file{cover_small.jpg}, @file{cover_med.jpg},
2320 etc. Note that you'll probably want to resize your existing covers to particular
2321 sizes. Suggested sizes are 100x100 for small, and 200x200 for medium.
2322
2323 The above behaviour demands manual processing on behalf of the user. Instead,
2324 you might prefer to automate the process by setting @var{emms-browser-covers} to
2325 'emms-browser-cache-thumbnail': covers matching 'emms-browser-thumbnail-filter'
2326 will be automatically resized if necessary and cached to
2327 @var{emms-browser-thumbnail-directory}. The cache gets automatically updated
2328 upon change in the source folder.
2329
2330 Customize @var{emms-browser-covers-file-extensions} to include or exclude
2331 specific extensions.
2332
2333 'emms-browser-cache-thumbnail' might be everytime a cover is queried, so
2334 to help with performance you can also set @var{emms-browser-covers} to
2335 'emms-browser-cache-thumbnail-async'. The latter is like the former
2336 except that it caches queries: every subsequent query will be much
2337 faster. The drawback is that it won't see changes made to covers after
2338 the first query. To force-refresh the thumbnail cache, you can run
2339 'emms-browser-clear-cache-hash'.
2340
2341 Also, Emacs by default will jump around a lot when scrolling a buffer
2342 with images. In order to prevent that, you can set
2343 @var{scroll-up-aggressively} and @var{scroll-down-aggressively} to the
2344 number ``0.0''.
2345
2346 To show a 'no cover' image for albums which don't have a cover, add
2347 the following code to your .emacs:
2348
2349 @lisp
2350 (setq emms-browser-default-covers
2351 (list "/path/to/cover_small.jpg" nil nil)
2352 @end lisp
2353
2354 The medium and large images can be set as well.
2355
2356 You can download an example @uref{http://repose.cx/cover_small.jpg,
2357 `no cover' image}.
2358
2359
2360
2361 @node Changing Looks
2362 @section Changing Looks
2363
2364 The Browser's look can be customised. You can change the way the tree
2365 structure looks, the display format and display faces.
2366
2367 @subheading Changing Tree Structure
2368
2369 You can change the way the tree is displayed by setting the value of
2370 @var{emms-browser-tree-node-map}
2371
2372 @lisp
2373 (setq emms-browser-tree-node-map emms-browser-tree-node-map-default)
2374 @end lisp
2375
2376 The node map specifies the tree as an alist.
2377 Follow the chain of fields from the starting browse type
2378 to see how the browser tree will be built. ie. Starting with
2379 album artist yields a tree with album artist, artist and album as nodes.
2380
2381 @lisp
2382 (defvar emms-browser-tree-node-map-default
2383 '((info-albumartist . info-artist)
2384 (info-artist . info-album)
2385 (info-composer . info-album)
2386 (info-performer . info-album)
2387 (info-album . info-title)
2388 (info-genre . info-artist)
2389 (info-year . info-artist)))
2390 @end lisp
2391
2392
2393 The following code displays artist->track instead of
2394 artist->album->track when you switch to the 'singles' filter:
2395
2396 @lisp
2397 (defadvice emms-browser-next-mapping-type
2398 (after no-album (current-mapping))
2399 (when (eq ad-return-value 'info-album)
2400 (setq ad-return-value 'info-title)))
2401 @end lisp
2402
2403 @lisp
2404 (defun toggle-album-display ()
2405 (if (string= emms-browser-current-filter-name "singles")
2406 (ad-activate 'emms-browser-next-mapping-type)
2407 (ad-deactivate 'emms-browser-next-mapping-type)))
2408
2409 ;; Deprecated use the emms-filters hook instead.
2410 ;; (add-hook 'emms-browser-filter-changed-hook 'toggle-album-display)
2411 (add-hook 'emms-filters-filter-changed-hook 'toggle-album-display)
2412 @end lisp
2413
2414 Furthermore, you can customize
2415 @var{emms-browser-get-track-field-function} to choose which the metadata
2416 fields used for the different tree nodes (@code{'info-artist},
2417 @code{info-year}, etc.). For instance, you can choose whether to
2418 organize the tree by artist, album artist or performer.
2419
2420 @subheading Changing Display Format
2421
2422 Format strings govern the way items are displayed in the browser and
2423 playlist. You can customize these if you wish.
2424
2425 @var{emms-browser-default-format} controls the format to use when no
2426 other format has been explicitly defined. By default, only track and
2427 albums deviate from the default.
2428
2429 To customise the format of a particular type, find the name of the
2430 field you want to use (eg `info-artist', `info-title', etc), and
2431 insert that into emms-browser-<type>-format or
2432 emms-browser-playlist-<type>-format. For example, if you wanted to
2433 remove track numbers from tracks in both the browser and playlist, you
2434 could do:
2435
2436 @lisp
2437 (defvar emms-browser-info-title-format "%i%n")
2438 (defvar emms-browser-playlist-info-title-format
2439 emms-browser-info-title-format)
2440 @end lisp
2441
2442 The format specifiers available include:
2443
2444 @itemize @w{}
2445
2446 @item
2447 %i indent relative to the current level
2448
2449 @item
2450 %n the value of the item - eg -info-artist might be ``pink floyd''
2451
2452 @item
2453 %y the album year
2454
2455 @item
2456 %A the album name
2457
2458 @item
2459 %a the artist name of the track
2460
2461 %o the album artist name
2462 @item
2463
2464 @item
2465 %t the title of the track
2466
2467 @item
2468 %o the genre of the track
2469
2470 @item
2471 %T the track number
2472
2473 @item
2474 %cS a small album cover
2475
2476 @item
2477 %cM a medium album cover
2478
2479 @item
2480 %cL a big album cover
2481 @end itemize
2482
2483 Note that if you use track-related items like %t, it will take the
2484 data from the first track.
2485
2486 @subheading Changing Display Faces
2487
2488 The faces used to display the various fields are also customizable.
2489 They are in the format emms-browser-<type>-face, where type is one of
2490 "year/genre", "artist", "album" or "track". Note that faces lack the
2491 initial "info-" part. For example, to change the artist face, type M-x
2492 @command{customize-face} @command{emms-browser-artist-face}.
2493
2494 @node Filtering Tracks - deprecated
2495 @section Filtering Tracks - deprecated
2496
2497 Note that these are the directions for creating filters from the browser
2498 API which now works through the Emms-filters system.
2499
2500 The Emms-filter system obsoletes this method of creating filters.
2501 However, it is still valid, and will work if you have filters defined
2502 in this way.
2503
2504 It is recommended that the new filter system is used directly rather
2505 than building filters in this way.
2506
2507 If you want to display a subset of your collection (such as a
2508 directory of 80s music, only avi files, etc.) then you can extend the
2509 Browser by defining ``filters''.
2510
2511 Show everything:
2512
2513 @lisp
2514 (emms-browser-make-filter "all" 'ignore)
2515 @end lisp
2516
2517 Set "all" as the default filter:
2518
2519 @lisp
2520 (emms-browser-set-filter (assoc "all" emms-browser-filters))
2521 @end lisp
2522
2523 Show all files (no streamlists, etc):
2524
2525 @lisp
2526 (emms-browser-make-filter
2527 "all-files" (emms-browser-filter-only-type 'file))
2528 @end lisp
2529
2530 Show only tracks in one folder:
2531
2532 @lisp
2533 (emms-browser-make-filter
2534 "80s" (emms-browser-filter-only-dir "~/Mp3s/80s"))
2535 @end lisp
2536
2537 Show all tracks played in the last month:
2538
2539 @lisp
2540 (emms-browser-make-filter
2541 "last-month" (emms-browser-filter-only-recent 30))
2542 @end lisp
2543
2544 After executing the above commands, you can use M-x
2545 emms-browser-show-all, emms-browser-show-80s, etc to toggle between
2546 different collections. Alternatively you can use '<' and '>' to cycle
2547 through the available filters.
2548
2549 The second argument to make-filter is a function which returns t if a
2550 single track should be filtered. You can write your own filter
2551 functions to check the type of a file, etc.
2552
2553 Show only tracks not played in the last year:
2554
2555 @lisp
2556 (emms-browser-make-filter "not-played"
2557 (lambda (track)
2558 (not (funcall (emms-browser-filter-only-recent 365) track))))
2559 @end lisp
2560
2561 Show all files that are not in the pending directory:
2562
2563 @lisp
2564 (emms-browser-make-filter
2565 "all"
2566 (lambda (track)
2567 (or
2568 (funcall (emms-browser-filter-only-type 'file) track)
2569 (not (funcall
2570 (emms-browser-filter-only-dir "~/Media/pending") track)))))
2571 @end lisp
2572
2573
2574 @c -------------------------------------------------------------------
2575 @node The Filter System
2576 @chapter The Filter System
2577
2578 The filter system allows you to filter the metadata cache in order search
2579 and narrow your track data. It is based on a very powerful interactive
2580 system consistenting of filter and cache stacks which allow
2581 the creation and manipulation of complex filters and results caches.
2582
2583 The Filter system is defined in @file{emms-filters.el} and is included as
2584 part of the Emms-Browser.
2585
2586 Emms-Filters allows you to filter and search the metadata cache.
2587 This manages the search and filter functionalities of emms-browser.
2588
2589 @menu
2590 * Filters and Searches:: A simple overview of the filter system.
2591 * Backward Compatibility:: Backward compatibility with the Emms Browser.
2592 * Filter Components:: Definitions of basic terminology used by the filter system.
2593 * Filter Factories:: Defining filter factories.
2594 * Factory Registration:: Registering Factories and using the prompting system.
2595 * Defined Factories:: The built-in factories available
2596 * Defining Filters:: Defining filters.
2597 * The Filter Stack:: The filter stack, how it works, how to use it.
2598 * The Cache Stack:: The cache stack, how to use it.
2599 * Showing State:: Showing the current state of the filter system.
2600 @end menu
2601
2602 @node Filters and Searches
2603 @section Filters and Searches
2604
2605 There is little difference between filtering and searching. Searching
2606 simply results in a data-cache which is smaller than the original.
2607
2608 The filter system has a cache stack where cached results are kept. All
2609 subsequent filters and searches use the most current cache.
2610
2611 Filtering results in a rendered view for a subset of what is in the
2612 data-cache. Complex filters are built interactively on a filter stack
2613 by combining existing filters and interactively created filters.
2614
2615 A small group of filter factories are used to create filter functions
2616 which are defined entirely as data. Those filters can be combined with
2617 each other and with interactively created filters on the filter stack
2618 with OR, AND, as well as AND-NOT. These more complex filters may also
2619 be saved and coded entirely as data. In addition the filter stack has
2620 various commands to manipulate it. Pop, swap, swap-pop, squash and clear,
2621 among others.
2622
2623 For the concept of searches there is a search cache stack which is a
2624 stack of emms-cache-db hash tables. The emms-cache-db is always present at
2625 the base of this stack. Any filtered result may be pushed to this stack
2626 at any time. Filters always operate against the cache at the top of the
2627 stack. A cache may be stashed for later, and the usual stack manipulation
2628 functions exist. Pop, swap, swap-pop, squash, clear, stash, and push.
2629
2630 Factories define filters from data and interactively.
2631 Factories are kept in a ring, and each has a ring of its filters.
2632 Interactively creating a new filter adds it to the ring for the session.
2633 Personal filter rings can also be easily added to the filter menu ring.
2634
2635 There is another filter ring, which can have any filters you like, and is
2636 selectable with < and >. The active filter on the ring combines with
2637 the filter stack to show the rendered results.
2638
2639 @node Backward Compatibility
2640 @section Backward Compatibility
2641
2642 Maintaining backward compatibily with the Emmms-browser's previous
2643 functionality was a prime goal in creating the filter system. Very little
2644 is left in common, but the Browser's search-by and filtering API remains
2645 intact and continues to behave as before. Anyone who has made filter
2646 functions will notice no change in behavior other than there is more
2647 flexibility in using their functions.
2648
2649 The filter system replaces both emms-browser filters and search-by
2650 functionalities. The Emms-browser API remains in place, however underneath
2651 the API it uses the filter system for all of its purposes.
2652
2653 Emms-browser-make-filter and emms-browser-search-by use emms-filters
2654 for their current functionality. The search-by functionality is quite
2655 simple. Emulating the browser filters was more complicated and has a
2656 thin compatibility layer in @file{emms-browser.el}.
2657
2658 In all cases, obtaining the same functionalities soley within emms-filters is
2659 simpler and and more powerful.
2660
2661 Emms-browser-filter functions are specified to return an
2662 inverted value. the old @command{emms-browser-make-filter}
2663 had a slightly different mechanism from the filter system's
2664 @command{emms-filters-make-filter}. emms-browser-make-filter has been modified to
2665 pass its filters to the emms-filter system. Those filters will be properly
2666 inverted and added to the known emms-filters-filters and to the emms-filters-filter-ring
2667 which emulates the original browser filter ring. This provides a
2668 seamless experience for previous users of emms-browser filtering. As
2669 the @var{emms-filters-filter-ring} is functionally equivalent to the browser's
2670 filter ring.
2671
2672 The browser's 'Search-by' was just one filter factory, which corresponds
2673 to the filter system's 'fields search' factory, and searches are not
2674 inverted. The only real difference between the browser's filter and a
2675 search was that a filter was rendered and a search was saved to a hash
2676 for subsequent filtering. Filters couldn't filter a search, and neither
2677 could work against anything but the Emms-cache-db. The equivalent to the
2678 emms-browser search-by is just a one shot interactive 'new fields-search'
2679 filter factory that saves a cache and then removes itself.
2680
2681 Emms-Filters is agnostic about the renderer. Currently there has been a
2682 lot of effor to maintain backward compatibity with the Emms-browser as
2683 its functionality was replaced. There are the following hooks that any
2684 renderer could use in order to leverage Emms-Filters.
2685
2686 To maintain independence there are three hook variables which allow
2687 emms-filters to interact with the Emms-Browsers functionality.
2688
2689 The first is a defcustom hook to mirror the browser's deprecated hook
2690 of the same name.
2691 The second hook happens just after, and is for any renderer
2692 that wishes to re-render when a filter changes.
2693 The third hook is to tell any renderer to expand its render if there is
2694 a filter or cache stack entry present.
2695
2696 This a defcustom hook that is run anytime the filters change
2697 @var{emms-filters-filter-changed-hook}
2698
2699 @lisp
2700 (add-hook 'emms-filters-filter-changed-hook 'my-filters-have-changed-function)
2701 @end lisp
2702
2703 The following two hooks are for the renderers which is currently
2704 just the Emms-Browser. These hooks are the mechanism used to
2705 actually filter and render the tracks.
2706
2707 When the filter or cache changes Emms-Filters needs to
2708 tell the renderer to re-build its hash and display it.
2709 For this purpose there is another hook, the
2710 @var{emms-filters-make-and-render-hash-hook}.
2711
2712 The Emms-browser function for this is emms-browse-by.
2713 This function applies the filters, creates a hash,
2714 and then populates and renders a tree of data.
2715 @lisp
2716 (add-hook 'emms-filters-make-and-render-hash-hook 'emms-browse-by)
2717 @end lisp
2718
2719 The last hook is the @var{emms-filters-expand-render-hook}.
2720 This is just so that Emms-Filters can tell the renderer to
2721 expand its tree when there is a filter or cache stack present
2722 and something has changed.
2723 For Emms-Browser this is the function emms-browser-expand-all
2724
2725 @lisp
2726 ;; (add-hook 'emms-filters-expand-render-hook 'emms-browser-expand-all)
2727 @end lisp
2728
2729 The filter system is much more powerful than the previous system of
2730 filtering and searching and is much easier to use both in code and interactively
2731 while searching your tracks.
2732
2733 Here is a summary of differences and features of the filter system.
2734
2735 @itemize @bullet
2736 @item Filters, no matter the complexity, are defined entirely as data.
2737 @item Filters can be combined with AND, OR as well as AND-NOT.
2738 @item Filters return true if they match the tracks.
2739 @item Filters are lambda functions created with factories from data.
2740 @item There is no difference between a search function and a filter function.
2741 @item The factory should wrap the lambda in a let with lexical-binding t.
2742 @item The factories and the filters must both be registered with Emms-filters.
2743 @item Registered factories have a built in interactive prompting system.
2744 @item Any results can be pushed to the cache stack for future filters and searches.
2745 @item Complex filters are created interactively on the filter stack.
2746 @item Searches are interactively created filters which leave a cache on the stack.
2747 @item Interactively created filters can be saved as data for later use.
2748 @item Interactively created filters remain in the filter selection menu for the session.
2749 @end itemize
2750
2751 @node Filter Components
2752 @section Filter Components
2753 -------------------------------------------------------------------
2754 The filter system consists of a few different mechanisms.
2755 There are factories to make filters. There is the filter stack
2756 to manage the creation and use of filters. Filters can be made of filters.
2757
2758 There is the cache stack to handle the saving of a set of filtered results
2759 into a reduced database cache for subsequent filters.
2760
2761 There is the filter ring for quickly switching between commonly used filters.
2762 This filter is combined with the current filter stack to render results.
2763
2764 @itemize @bullet
2765 @item Filter Factories - To make filter functions.
2766 @item Filters - Defined as data. Dynamically created lambda functions.
2767 @item Filter menu - A customizable ring of factories and their rings of filters.
2768 @item Multi-filter - A filter factory to create filters made of filters.
2769 @item Meta-filter - A multi-filter data definition.
2770 @item The filter stack - A meta-filter manipulator and multi-filter creator.
2771 @item The cache stack - A stack of database caches.
2772 @item The filter ring - A subset of convenient to use filters.
2773 @end itemize
2774
2775 @node Filter Factories
2776 @section Filter Factories
2777 -------------------------------------------------------------------
2778 Filter factories make filters which are simply test functions which
2779 take a track and return true or false.
2780
2781 Factories are registered with the Emms-filter system so that they have
2782 names that can be referenced later. Additionally, registration includes a
2783 prompt and parameter definition. This allows the Emms-filters prompting
2784 system to provide an interactive interface to any filter factory in
2785 order to create new filters at any time.
2786
2787 Filter factories depend upon lexical context of their parameters. In
2788 order to have data values that stick after function creation there
2789 is let with lexical-binding to ensure the factory behaves as expected.
2790 This transfers the values to local values and uses them as normal
2791 within the returned #'(lambda (track)...) anonymous function.
2792
2793 As an example, here is the generic field-compare function.
2794 It takes an operator function, a field name and the value to compare.
2795 This single function can be a new factory for any data field
2796 using any comparison function we would like.
2797
2798 @lisp
2799 (defun emms-filters-make-filter-field-compare (operator-func field compare-val)
2800 "Make a filter that compares FIELD to COMPARE-VALUE with OPERATOR-FUNC.
2801 Works for number fields and string fields provided the appropriate
2802 type match between values and the comparison function. Partials can
2803 easily make more specific factory functions from this one."
2804 (let ((local-operator operator-func)
2805 (local-field field)
2806 (local-compare-val compare-val))
2807 #'(lambda (track)
2808 (let ((track-val (emms-track-get track local-field)))
2809 (and
2810 track-val
2811 (funcall local-operator local-compare-val track-val))))))
2812 @end lisp
2813
2814
2815 @node Factory Registration
2816 @section Factory Registration
2817
2818 Registering a factory associates a name, a function and a list of prompt
2819 definitions so that we may create filters interactively by name. The
2820 prompting system will coerce the values given to the specified type
2821 providing select lists as indicated.
2822
2823 The factory prompt data is used to interactively create new filters.
2824 A prompt is (prompt (type . select-list)) if there is no
2825 select list we read the value and coerce the value to the
2826 type as needed.
2827
2828 These are the known coercion types.
2829
2830 @itemize @bullet
2831 @item :number
2832 @item :string
2833 @item :list
2834 @item :symbol
2835 @item :function
2836 @end itemize
2837
2838 Here is the Genre Factory which is actually made from the field-compare
2839 factory. This is a common pattern to create a simpler factory from a
2840 more complex one. It is simply a partial that is registered directly
2841 with a different set of prompts. In this case 'Genre:' is the prompt
2842 and it is expected to be a string.
2843
2844 @lisp
2845 (emms-filters-register-filter-factory
2846 "Genre"
2847 (apply-partially 'emms-filters-make-filter-field-compare
2848 'string-equal-ignore-case 'info-genre)
2849 '(("Genre: " (:string . nil))));;
2850 @end lisp
2851
2852 The registration for the compare field factory is more complex because of
2853 the prompting for all the parameters. By changing just the registration
2854 name and the prompts we can create two factories, one for numbers and
2855 one for strings. Note the use of the ` and , to force the select lists
2856 to resolve within the lambda.
2857
2858 Here is the registration for the number field compare factory. The
2859 operator function has a select list of number comparison functions. The
2860 field name has a select list of known numeric field names and the value
2861 to compare must be a number and will be coerced as needed.
2862
2863 @lisp
2864 (emms-filters-register-filter-factory "Number field compare"
2865 'emms-filters-make-filter-field-compare
2866 ;; prompts
2867 `(("Compare Function: "
2868 (:function . ,emms-filters-number-compare-functions))
2869 ("Field name: "
2870 (:symbol . ,emms-filters-number-field-names))
2871 ("Compare to: "
2872 (:number . nil))))
2873 @end lisp
2874
2875
2876 @node Defined Factories
2877 @section Defined Factories
2878
2879 There are a number of defined factories derived from just a few functions.
2880 Most common filters can be easily made with these.
2881 There are a few predifined filters, but that has been kept to a minimum
2882 as filters can be a very personal thing. There are already filters for every
2883 track type and there many common genres and year range filters by decade.
2884
2885 Filter factories like artist, album artist, composer, Names, etc.
2886 are all just specialized field compare or the fields search factories.
2887
2888 Filter factories include the following.
2889
2890 @itemize @bullet
2891 @item Album
2892 @item Album-artist
2893 @item All text fields
2894 @item Artist
2895 @item Artists
2896 @item Artists and composer
2897 @item Composer
2898 @item Directory
2899 @item Duration less
2900 @item Duration more
2901 @item Fields search
2902 @item Genre
2903 @item Greater than Year
2904 @item Less than Year
2905 @item Multi-filter
2906 @item Names
2907 @item Names and titles
2908 @item Not played since
2909 @item Notes
2910 @item Number field compare
2911 @item Orchestra
2912 @item Performer
2913 @item Played since
2914 @item String field compare
2915 @item Title
2916 @item Titles
2917 @item Track type
2918 @item Year range
2919 @end itemize
2920
2921
2922 @node Defining Filters
2923 @section Defining Filters
2924
2925 Making a filter in elisp from a factory is easy.
2926
2927 (emms-filters-make-filter <Factory Name> <Filter Name> <Factory Parameters>)
2928
2929 The Genre Factory takes one string argument.
2930 @lisp
2931 (emms-filters-make-filter "Genre" "My Genre filter" "Somevalue")
2932 @end lisp
2933
2934 Make a lot of filters at once with emms-filters-make-filters.
2935
2936 @lisp
2937 (emms-filters-make-filters '(("Genre" "Waltz" "waltz")
2938 ("Genre" "Salsa" "salsa")
2939 ("Genre" "Blues" "blues")
2940 ("Genre" "Jazz" "jazz")))
2941 @end lisp
2942
2943 Filters can be easily created interactivly.
2944 Just push a filter onto the stack with @command{emms-filters-push},
2945 @command{emms-filters-and}, @command{emms-filters-or}, @command{emms-filters-and-not},
2946 or @command{emms-filters-squash},
2947 select 'new filter' then your factory and follow the prompts.
2948
2949 Filters are added by name to their respective factory's filter ring.
2950 Here are some more complex filter definitions including some
2951 Multi-filter definitions, or meta-filters which are simply lists
2952 of filters by name, they are functionally equivalent to what
2953 is being built by the filter stack.
2954
2955 @lisp
2956 (setq tango-filters
2957 '(("Year range" "1900-1929" 1900 1929)
2958 ("Year range" "1929-1937" 1929 1937)
2959
2960 ("Directory" "tangotunes" "tangotunesflac")
2961
2962 ("Genre" "Vals" "vals")
2963 ("Genre" "Tango" "tango")
2964 ("Genre" "Milonga" "milonga")
2965
2966 ("Multi-filter"
2967 "1900-1937"
2968 (("1900-1929" "1929-1937")))
2969
2970 ("Multi-filter"
2971 "Vals | milonga"
2972 (("Vals" "Milonga")))
2973
2974 ("Multi-filter"
2975 "Vals 1900-1929"
2976 (("Vals") ("1900-1929")))
2977
2978 ("Multi-filter"
2979 "Not vals"
2980 ((:not "Vals")))
2981
2982 ("Multi-filter"
2983 "Vals or milonga 1900-1937"
2984 (("Vals" "Milonga")
2985 ("1900-1929" "1929-1937")))
2986 ))
2987
2988 (emms-filters-make-filters tango-filters)
2989 @end lisp
2990
2991 A new entry in the Factory ring along with it's filters
2992 can also be easily added. This function deconstructs the definitions
2993 to facilitate the ease of addition. It can also be made from a
2994 simple list of names as well. The filters will appear both under their
2995 respective factories, and under this new menu item 'Tango'.
2996 They are not recreated, but simply listed by their names to be chosen.
2997
2998 @lisp
2999 (emms-filters-add-to-filter-menu-from-filter-list "Tango" tango-filters)
3000 @end lisp
3001
3002 Here is the easiest way to make the filter ring as used by the Browser.
3003 It is just a list of filter names.
3004
3005 @lisp
3006 (emms-filters-make-filter-ring '("Tango" "Vals" "Milonga"))
3007 @end lisp
3008
3009 The filter menu is automatically constructed as a ring of factory names
3010 as 'folders' that have a ring of filters. This filter menu tree can be
3011 added to in various ways. 'Keeping' a filter on the filter stack will
3012 temporarily add the multi-filter defined by the filter stack to the
3013 multi-filter ring.
3014
3015 There are other ways to add to the filter menu tree.
3016 @command{emms-filters-add-to-filter-menu-from-filter-list} is used to deconstruct
3017 a variable holding filter defintions as in the example above in order
3018 to create a new ring in the menu tree.
3019
3020 In turn that function uses @command{emms-filters-add-to-filter-menu} which takes
3021 a folder name and a filter or list of filters to place in the ring.
3022 The function @command{emms-filters-add-name-to-filter-menu} will add a filter by
3023 name to an existing filter folder/factory.
3024
3025 It is also possible to view the filter menu tree as a message with
3026 @command{emms-filters-show-filter-menu}
3027
3028
3029 @node The Filter Stack
3030 @section The Filter Stack
3031
3032 The filter stack builds more complex filters as you push filters to
3033 it. Adding to the filter or replacing it with another push creates a new
3034 meta-filter and it's multi-filter function to the filter stack. To return
3035 to the previous filter simply pop the stack. Each change to the stack, creates
3036 a meta-filter and it's corresponding constructed meta-filter. Any change
3037 results in a new 'current' multi-filter. The filters are represesented
3038 as are constructed names of the filters that created it.
3039
3040 The filter stack uses meta-filters in a cons
3041 like this; (name . meta-filter).
3042 Filter names for meta-filters can be easily constructed from the filters
3043 they are made from. They aren't short but they work well enough.
3044
3045 To use a filter, @command{emms-filters-push} it to create a new current filter
3046 on the stack. It will become a meta-filter on the filter stack and the
3047 current active filter will be a multi-filter version of it. The functions
3048 required to construct the current multi-filter are resolved at this time
3049 in a new multi-filter lambda function.
3050
3051 The filter ring works independently of the filter stack. Each re-filtering
3052 of tracks uses the current ring filter and the current filter together.
3053
3054 A filter on the stack can be 'kept'. The function @command{emms-filters-keep}
3055 will create and register a multi-filter of the current filter, adding
3056 it to the multi-filter menu. This only lasts until the current Emacs
3057 session ends. If @var{emms-filters-multi-filter-save-file} is set, keep will
3058 append a usable filter definition to the file for reuse as you wish.
3059
3060 Other commands for manipulating the stack are listed here. Most
3061 should be self explanatory, Squash clears the stack, leaving the
3062 topmost filter. Smash is a clear followed by a push.
3063
3064 @itemize @bullet
3065 @item @command{emms-filters-pop}
3066 @item @command{emms-filters-squash}
3067 @item @command{emms-filters-smash}
3068 @item @command{emms-filters-clear}
3069 @item @command{emms-filters-swap}
3070 @item @command{emms-filters-swap-pop}
3071 @item @command{emms-filters-keep}
3072 @end itemize
3073
3074 An initial filter can be created with
3075 @command{emms-filters-push} or @command{emms-filters-smash} which is a clear followed by a push.
3076
3077 Adding to the filter stack is done with
3078 @command{emms-filters-and}, @command{emms-filters-or}, @command{emms-filters-and-not},
3079
3080 @node The Cache Stack
3081 @section The Cache Stack
3082
3083 The cache stack is a simply a stack of emms-cache-db style hash tables.
3084 The full emms-cache-db is at the base of the stack and is always there.
3085 Each entry in the stack is a subset of the cache below it as a result
3086 of filtering. The stack entry names are constructed from the filters
3087 which created them.
3088
3089 Filtering and displaying of tracks is done against the top cache on the stack.
3090
3091 The function, @command{emms-filters-hard-filter} is the most common way to create
3092 an entry on the cache stack. It creates a cache from the current filter
3093 and cache, and pushes it to the stack. This does render the current filter
3094 as non-effective, so it can be cleared, or continue to grow depending
3095 on your desires. It can be useful to just keep going so that returning
3096 to the previous state is possible.
3097
3098 One of the driving forces with creating cache entries was the way that
3099 the Emms-browser has always done searching. To this end, additional
3100 functionality was created to better emulate the browser's way of doing
3101 things. However the cache stack provides a lot of flexibility and power
3102 in how you navigate and search your music. Simply being able to repeatedly
3103 search and narrow the data is quite powerful all by itself.
3104
3105 One-Shot filtering allows behavioral backward compatibility with the
3106 browser. One shots were created to emulate the browser's behavior of
3107 creating a subset cache from search-by. One shots push a filter, save
3108 to the cache stack and pop the filter, leaving only the cache.
3109
3110 Using @command{emms-filters-one-shot} will push a filter, push a cache,
3111 then pop the filter. It will interactively prompt for a factory, the
3112 filter, and then the filter parameters to create a filter if none is
3113 given. @command{emms-filters-quick-one-shot} takes a factory name, and invokes
3114 the interactive creation of a new filter with that factory directly.
3115 The command @command{emms-filters-fields-search-quick-one-shot} is a one-shot
3116 using the fields-search filter factory, while adding to the fields-search
3117 ring in the filter menu-tree. The fields-search factory is the filter
3118 system's way of emulating browser's search-by functionality.
3119
3120 These functions effectively allow the emulation of the browser's search
3121 behavior of quickly prompting, filtering and pushing a cache followed
3122 by a pop of the filter used. By the grace of that, simple wrapper
3123 functions for each of the browser's search functions were created
3124 using emms-filters-quick-one-shot. These functions are named after their browser
3125 equivalents as emms-filters-search-by-<field-names>. The browser search functions
3126 now call these filter system functions directly.
3127
3128 Manipulating the cache stack is similar to manipulating the filter stack,
3129 The usual stack commands are:
3130 @itemize @bullet
3131 @item @command{emms-filters-pop-cache}
3132 @item @command{emms-filters-squash-caches}
3133 @item @command{emms-filters-clear-caches}
3134 @item @command{emms-filters-swap-cache}
3135 @item @command{emms-filters-swap-pop-cache}
3136 @item @command{emms-filters-push-cache}
3137 @item @command{emms-filters-stash-cache}
3138 @item @command{emms-filters-stash-pop-cache}
3139 @end itemize
3140
3141 The functions @command{emms-filters-push-cache}, @command{emms-filters-stash-cache} and
3142 @command{emms-filters-stash-pop-cache} allow for a cache to be stashed and then
3143 later pushed back to the stack. The current cache on the stack can be
3144 stashed at anytime. The stashed caches will be a selection ring
3145 for @command{emms-filters-push-cache}.
3146
3147
3148 @node Showing State
3149 @section Showing State
3150
3151 There are various functions that enable a view of all that is going
3152 on within the filter system. At the top level these are simply emacs
3153 messages which can be easily dismissed. Just below them, are equivalent
3154 functions that give formatted string versions for use as you like.
3155
3156 The registered filter factories can be shown with
3157 @command{emms-filters-show-filter-factories}, the registered
3158 filters can be shown with @command{emms-filters-show-filters}.
3159 The @command{emms-filters-show-filter-menu} will show the current filter menu tree.
3160
3161 The current filter ring can be shown with @command{emms-filters-show-filter-ring}
3162 and the filter stack can be shown with @command{emms-filters-current-meta-filter}.
3163
3164 In code, the current filter name can be obtained with the
3165 @command{emms-filters-current-meta-filter-name}.
3166 The current ring filter name can be obtained with
3167 @command{emms-filters-current-ring-filter-name}
3168
3169 Showing the cache stack is done with @command{emms-filters-show-cache-stack}.
3170 Any stashed caches can be seen with @command{emms-filters-show-cache-stash}
3171 which will also appear in the menu invoked by @command{emms-filters-push-cache}.
3172
3173 Finally for a more complete report of the system use @command{emms-filters-status-print}
3174 which is a message of the formatted string given by @command{emms-filters-status}.
3175
3176 In turn, the @command{emms-filters-status} is simply a format of the following four
3177 functions that give formatted strings of the moving parts of the filter system.
3178
3179 @itemize @bullet
3180 @item @command{emms-filters-current-ring-filter}
3181 @item @command{emms-filters-current-meta-filter}
3182 @item @command{emms-filters-format-stack}
3183 @item @command{emms-filters-format-cache-stack}
3184 @end itemize
3185
3186
3187 @c -------------------------------------------------------------------
3188 @node Sorting Playlists
3189 @chapter Sorting Playlists
3190
3191 @cindex sort
3192 @cindex track order
3193
3194 The `emms-playlist-sort' module, defined in the
3195 @file{emms-playlist-sort.el} package provides functions for sorting
3196 Emms playlists, as well as keyboard shortcuts for invoking the
3197 functions in the playlist buffer. Most of the functions will sort in
3198 reverse order if the command is preceded by a
3199 prefix. `emms-playlist-sort' can be loaded by invoking:
3200
3201 @lisp
3202 (require 'emms-playlist-sort)
3203 @end lisp
3204
3205 @defun emms-playlist-sort-by-info-artist
3206 Sort by artist name.
3207 @end defun
3208
3209 @defun emms-playlist-sort-by-info-albumartist
3210 Sort by albumartist name.
3211 @end defun
3212
3213 @defun emms-playlist-sort-by-play-count
3214 Sort by number of times the track has been played.
3215 @end defun
3216
3217 @defun emms-playlist-sort-by-info-album
3218 Sort by album name.
3219 @end defun
3220
3221 @defun emms-playlist-sort-by-last-played
3222 Sort by time the track was played last.
3223 @end defun
3224
3225 @defun emms-playlist-sort-by-info-title
3226 Sort by track title.
3227 @end defun
3228
3229 @defun emms-playlist-sort-by-file-extension
3230 Sort by filename extension.
3231 @end defun
3232
3233 @defun emms-playlist-sort-by-info-performer
3234 Sort by performer name.
3235 @end defun
3236
3237 @defun emms-playlist-sort-by-info-year
3238 Sort by year.
3239 @end defun
3240
3241 @defun emms-playlist-sort-by-info-note
3242 Sort by track notes.
3243 @end defun
3244
3245 @defun emms-playlist-sort-by-info-composer
3246 Sort by composer.
3247 @end defun
3248
3249 @defun emms-playlist-sort-by-name
3250 Sort by track name.
3251 @end defun
3252
3253 @defun emms-playlist-sort-by-file-mtime
3254 Sort by file mtime.
3255 @end defun
3256
3257 @defun emms-playlist-sort-by-random
3258 Sort randomly. Alias for `emms-shuffle'.
3259 @end defun
3260
3261 @defun emms-playlist-shuffle
3262 Alias for `emms-playlist-sort-by-random' and `emms-shuffle'.
3263 @end defun
3264
3265
3266 @c -------------------------------------------------------------------
3267 @node Persistent Playlists
3268 @chapter Persistent Playlists
3269
3270 The Emms module @file{emms-history.el} makes playlists persistent over
3271 emacs sessions. To make use of this feature put this into your
3272 ~/.emacs.
3273
3274 @lisp
3275 (require 'emms-history)
3276 @end lisp
3277
3278 When you kill emacs all playlists will be saved in the file given by the
3279 variable:
3280
3281 @defopt emms-history-file
3282 The file to save playlists in. It defaults to
3283 "~/.emacs.d/emms-history".
3284 @end defopt
3285
3286 After you started up emacs again, you can restore all saved playlists
3287 with this function.
3288
3289 @defun emms-history-load
3290 Restore all playlists in `emms-history-file'.
3291 @end defun
3292
3293 If that should be done automatically on each startup, put these lines
3294 into your ~/.emacs.
3295
3296 @lisp
3297 (require 'emms-history)
3298 (emms-history-load)
3299 @end lisp
3300
3301 Normally @code{emms-history} only restores playlists. If you want it to
3302 start playback afterwards, you can tweak this variable.
3303
3304 @defopt emms-history-start-playing
3305 If non-nil emms starts playing the current track after
3306 `emms-history-load' was invoked. The default value is nil.
3307 @end defopt
3308
3309
3310 @c -------------------------------------------------------------------
3311 @node Editing Tracks
3312 @chapter Editing Tracks
3313
3314 @cindex track editor
3315
3316 Using @file{emms-tag-editor.el}, emms can set tag informations of tracks
3317 and write them back to the file with the help of external programs, such
3318 as `mid3v2' and `vorbiscomment'.
3319
3320 Use the keybinding @kbd{E} to edit the tags of track under point in the
3321 playlist or all marked tracks (@pxref{Markable Playlists} for how to
3322 mark tracks). The track's tag informations are listed in a special
3323 buffer `*Emms-TAGS*' in text format. Field names are marked in bold
3324 face and are not editable. Any tag information is placed behind an
3325 equal sign and is changable. A special field `name' is the track's file
3326 name. If any change is made in this field, the track's file will be
3327 renamed to the new name. When you finished editing the tag infos use
3328 @kbd{C-c C-c} (which calls @code{emms-tag-editor-submit-and-exit}) to
3329 submit the changes and close the `*Emms-TAGS*' buffer.
3330
3331 There are a few commands to perform changes on all tracks.
3332
3333 @defun emms-tag-editor-set-all tag value
3334 Set TAG to VALUE in all tracks.
3335
3336 If transient-mark-mode is turned on, you can apply the command to a
3337 selected region.
3338
3339 If `transient-mark-mode' is on and the mark is active, the changes will
3340 only take effect on the tracks in the region.
3341 @end defun
3342
3343 @defun emms-tag-editor-replace-in-tag tag from to
3344 Query and replace text in selected TAG.
3345
3346 For example, if the info-title tag is selected, then only perform
3347 replacement in title tags.
3348
3349 If `transient-mark-mode' is on and the mark is active, the changes will
3350 only take effect on the tracks in the region.
3351 @end defun
3352
3353 @defun emms-tag-editor-transpose-tag tag1 tag2
3354 Transpose value of TAG1 and TAG2.
3355
3356 If `transient-mark-mode' is on and the mark is active, the changes will
3357 only take effect on the tracks in the region.
3358 @end defun
3359
3360 @defun emms-tag-editor-submit arg
3361 Make modified tags take affect.
3362
3363 With prefix argument, bury the tag edit buffer.
3364 @end defun
3365
3366 If you want to extend the tag editor to work with file formats other
3367 than `mp3' and `ogg', have a look at these variables.
3368
3369 @defvr {Variable} emms-tag-editor-formats
3370 This variable determine how to insert track fields to
3371 `emms-tag-editor-edit-buffer'. Emms tag info editable fields is usually
3372 determined by the extension of track name. The variable
3373 `emms-tag-editor-tags' contains all tags that emms track may have. A
3374 single charactar is assigned to the tag to make the
3375 `emms-tag-editor-formats' easier to generate.
3376 @end defvr
3377
3378 @defvr {Variable} emms-tag-editor-tagfile-functions
3379 To write tags to track file, an extern program should specified in this
3380 variable.
3381 @end defvr
3382
3383 @heading Renaming Files
3384 The tag editor is also capable to rename the file of the track at point
3385 or all files of the marked tracks according to the value this variable.
3386
3387 @defopt emms-tag-editor-rename-format
3388 When `emms-tag-editor-rename' is invoked the track's file will be
3389 renamed according this format specification. The file extension will be
3390 added automatically.
3391
3392 It uses the format specs defined in @code{emms-tag-editor-tags}.
3393
3394 The default value is "%a - %l - %n - %t", so that files are named
3395
3396 <Artist> - <Album> - <Tracknumber> - <Title>.<extension>
3397
3398 after renaming.
3399 @end defopt
3400
3401 @defopt emms-tag-editor-file-rename-alist
3402 For each pair in this alist, the first string will replaced by the
3403 second. This can be used to replace filename elements, spaces, or
3404 other unwanted strings or characters automatically whenever renaming a
3405 file.
3406 @end defopt
3407
3408 To perform the renaming put point on the track you want to rename or
3409 mark some tracks. Then hit @kbd{R} which calls this function:
3410
3411 @defun emms-tag-editor-rename
3412 Rename the file corresponding to track at point or all marked tracks
3413 according to the value of @code{emms-tag-editor-rename-format}.
3414 @end defun
3415
3416
3417 @c -------------------------------------------------------------------
3418 @node Emms Mode Line
3419 @chapter Emms Mode Line
3420
3421 @cindex mode line
3422 @cindex display emms information
3423
3424 We can display information about the currenty playing track on the
3425 Emacs mode line using the package `emms-mode-line' which is provided
3426 by the file @file{emms-mode-line.el}.
3427
3428 To activate this feature invoke:
3429
3430 @lisp
3431 (require 'emms-mode-line)
3432 (emms-mode-line 1)
3433 @end lisp
3434
3435 It is also possible to display the amount of time a track has been
3436 playing. This feature is defined in the `emms-playing-time' package
3437 which is provided by the file @file{emms-playing-time.el}.
3438
3439 To use this feature invoke:
3440
3441 @lisp
3442 (require 'emms-playing-time)
3443 (emms-playing-time 1)
3444 @end lisp
3445
3446 A graphical icon can be displayed in the modeline when Emms is
3447 playing. This feature is provided by @file{emms-mode-line-icon.el}. To
3448 enable invoke the following and make sure that
3449 @var{emms-mode-line-icon-enabled-p} is set to a non-nil value:
3450
3451 @lisp
3452 (require emms-mode-line-icon)
3453 @end lisp
3454
3455 Note: `(emms-playing-time -1)' will disable emms-playing-time module
3456 completely, and is not recommended. (since some other emms modules may
3457 rely on it)
3458
3459 Instead, to toggle displaying playing time on mode line, one could call
3460 `emms-playing-time-enable-display' and
3461 `emms-playing-time-disable-display'."
3462
3463 @defun emms-playing-time-enable-display
3464 Display playing time on mode line.
3465 @end defun
3466
3467 @defun emms-playing-time-disable-display
3468 Remove playing time from mode line.
3469 @end defun
3470
3471
3472 @c -------------------------------------------------------------------
3473 @node Limiting
3474 @chapter Limiting
3475
3476 @cindex limiting
3477 @cindex playlist
3478
3479 The package `emms-playlist-limit', provided by
3480 @file{emms-playlist-limit.el}, allows creating a new
3481 playlist derived from the playlist in the current
3482 buffer. For instance, it is possible to create a new
3483 playlist containing only a certain artist or genre from the
3484 playlist in the current buffer.
3485
3486 If the playlist in the current buffer is the emms current
3487 playlist then the derived playlist becomes current.
3488
3489 @table @kbd
3490 @item / a
3491 @kindex / a
3492 @findex emms-playlist-limit-to-info-artist
3493 Create a new playlist buffer and populate it with tracks
3494 whose artist info field matches the given regular
3495 expression (default: the artist info field of the
3496 track at point).
3497
3498 @item / A
3499 @kindex / A
3500 @findex emms-playlist-limit-to-info-albumartist
3501 Create a new playlist buffer and populate it with tracks
3502 whose album artist info field matches the given regular
3503 expression (default: the album artist info field of the
3504 track at point).
3505
3506 @item / b
3507 @kindex / b
3508 @findex emms-playlist-limit-to-info-album
3509 Create a new playlist buffer and populate it with tracks
3510 whose album info field matches the given regular
3511 expression (default: the album info field of the
3512 track at point).
3513
3514 @item / c
3515 @kindex / c
3516 @findex emms-playlist-limit-to-info-composer
3517 Create a new playlist buffer and populate it with tracks
3518 whose composer info field matches the given regular
3519 expression (default: the composer info field of the
3520 track at point).
3521
3522 @item / d
3523 @kindex / d
3524 @findex emms-playlist-limit-to-description
3525 Create a new playlist buffer and populate it with tracks
3526 whose track description matches the given regular
3527 expression (default: the track description of the
3528 track at point).
3529
3530 @item / g
3531 @kindex / g
3532 @findex emms-playlist-limit-to-info-genre
3533 Create a new playlist buffer and populate it with tracks
3534 whose genre info field matches the given regular
3535 expression (default: the genre info field of the
3536 track at point).
3537
3538 @item / n
3539 @kindex / n
3540 @findex emms-playlist-limit-to-name
3541 Create a new playlist buffer and populate it with tracks
3542 whose name matches the given regular expression (default:
3543 the name of the track at point).
3544
3545 @item / p
3546 @kindex / p
3547 @findex emms-playlist-limit-to-info-performer
3548 Create a new playlist buffer and populate it with tracks
3549 whose performer info field matches the given regular
3550 expression (default: the performer info field of the
3551 track at point).
3552
3553 @item / t
3554 @kindex / t
3555 @findex emms-playlist-limit-to-info-title
3556 Create a new playlist buffer and populate it with tracks
3557 whose title info field matches the given regular
3558 expression (default: the title info field of the
3559 track at point).
3560
3561 @item / y
3562 @kindex / y
3563 @findex emms-playlist-limit-to-info-year
3564 Create a new playlist buffer and populate it with tracks
3565 whose year info field matches the given regular
3566 expression (default: the year info field of the
3567 track at point).
3568
3569 @item / /
3570 @kindex / /
3571 @findex emms-playlist-limit-to-all
3572 Switch to the original playlist buffer (if it still exists).
3573 @end table
3574
3575
3576 @c -------------------------------------------------------------------
3577 @node Music Player Daemon
3578 @chapter Music Player Daemon
3579
3580 @cindex music player daemon
3581 @cindex remote interface
3582 @cindex mpd
3583
3584 Emms provides an interface to the @uref{http://www.musicpd.org/, Music
3585 Player Daemon}(MusicPD) software. The package is called `emms-player-mpd' and
3586 is provided by the file @file{emms-player-mpd.el}.
3587
3588 The advantages of using MusicPD as an Emms backend include the
3589 following.
3590
3591 @itemize @bullet
3592
3593 @item minimal CPU usage
3594
3595 @item fast access of track information
3596
3597 @item optional crossfade
3598 @end itemize
3599
3600 @subheading Setup
3601
3602 To load `emms-player-mpd' invoke:
3603
3604 @lisp
3605 (require 'emms-player-mpd)
3606 @end lisp
3607
3608 Set the variables @var{emms-player-mpd-server-name} and
3609 @var{emms-player-mpd-server-port} to the location and port
3610 (respectively) of your MusicPD server. For example:
3611
3612 @lisp
3613 (setq emms-player-mpd-server-name "localhost")
3614 (setq emms-player-mpd-server-port "6600")
3615 @end lisp
3616
3617 If your MusicPD setup requires a password, you will to set
3618 @var{emms-player-mpd-server-password} as follows.
3619
3620 @lisp
3621 (setq emms-player-mpd-server-password "mypassword")
3622 @end lisp
3623
3624 To get track information from MusicPD, invoke the following:
3625
3626 @lisp
3627 (add-to-list 'emms-info-functions 'emms-info-mpd)
3628 @end lisp
3629
3630 Adding `emms-player-mpd' to your Emms player list is accomplished by
3631 invoking:
3632
3633 @lisp
3634 (add-to-list 'emms-player-list 'emms-player-mpd)
3635 @end lisp
3636
3637 Unless your MusicPD is configured to use absolute file names, you must
3638 set the emms-player-mpd-music-directory variable to the value of
3639 'music_directory' in your MusicPD configuration. There are
3640 additional options available as well, but the defaults should be
3641 sufficient for most uses.
3642
3643 Once you've done the above, run the @kbd{M-x
3644 emms-cache-set-from-mpd-all} command to fill the Emms cache with the
3645 contents of your MusicPD database. The music in your MusicPD database
3646 should then be accessible via the Emms browser.
3647
3648 You can set @var{emms-player-mpd-sync-playlist} to nil if your master
3649 Emms playlist contains only stored playlists.
3650
3651 In order for Emms to synchronize track information correctly with
3652 MusicPD, you must set the MusicPD server runtime 'consume' option to
3653 'off'. This can be accomplished with the mpc command line MusicPD client
3654 using the command @command{mpc consume off}.
3655
3656 @subheading Commands provided
3657
3658 @defun emms-player-mpd-connect
3659 Connect to MusicPD and retrieve its current playlist. Afterward, the
3660 status of MusicPD will be tracked.
3661 @end defun
3662
3663 @defun emms-player-mpd-disconnect
3664 Terminate the MusicPD client process and disconnect from MusicPD.
3665 @end defun
3666
3667 @defun emms-player-mpd-show &optional insertp
3668 Describe the current Emms track in the minibuffer. If INSERTP is
3669 non-nil, insert the description into the current buffer instead. This
3670 function uses @var{emms-show-format} to format the current track. It
3671 differs from @command{emms-show} in that it asks MusicPD for the
3672 current track, rather than Emms.
3673 @end defun
3674
3675 @subsubheading Updating the MusicPD database
3676
3677 @defun emms-player-mpd-update-directory dir
3678 Cause the tracks in DIR to be updated in the MusicPD database.
3679 @end defun
3680
3681 @defun emms-player-mpd-update-all
3682 Cause all tracks in the MusicPD music directory to be updated in
3683 the MusicPD database.
3684 @end defun
3685
3686 @subsubheading emms-cache.el integration
3687
3688 @defun emms-cache-set-from-mpd-directory dir
3689 Dump all MusicPD data from DIR into the Emms cache.
3690 This is useful to do when you have recently acquired new music.
3691 @end defun
3692
3693 @defun emms-cache-set-from-mpd-all
3694 Dump all MusicPD data into the Emms cache.
3695 This is useful to do once, just before using emms-browser.el, in
3696 order to prime the cache.
3697 @end defun
3698
3699 @subsubheading emms-volume.el integration
3700
3701 To activate this, add the following to your .emacs.
3702
3703 @lisp
3704 (require 'emms-volume)
3705 (setq emms-volume-change-function 'emms-volume-mpd-change)
3706 @end lisp
3707
3708
3709 @c -------------------------------------------------------------------
3710 @node Lyrics
3711 @chapter Lyrics
3712
3713 @cindex lyrics
3714
3715 We can display the lyrics of a song in time with the music using the
3716 `emms-lyrics' package provided by the file @file{emms-lyrics.el}.
3717
3718 The lyrics files should have the extention ``.lrc'', and can be placed
3719 under either the same directory as the music files or
3720 @var{emms-lyrics-dir}.
3721
3722 To add this feature we invoke:
3723
3724 @lisp
3725 (require 'emms-lyrics)
3726 (emms-lyrics 1)
3727 @end lisp
3728
3729 Synchronized lyrics files can be obtained manually from various
3730 sources, or fetched automatically for new tracks from an LRCLIB server
3731 (@url{https://lrclib.net}) by adding the following function to
3732 @var{emms-track-initialize-functions}:
3733
3734 @defun emms-lyrics-lrclib-get &optional track force interactive
3735 Search for synchronized lyrics for @var{track} through LRCLIB’s API.
3736 If @var{track} is omitted or nil, use the selected track in the
3737 current playlist.
3738 When used as a track initialization function, @var{track} is set to
3739 the track being initialized.
3740 The lyrics are saved in an ``.lrc'' file alongside the track, unless
3741 the file already exists (in which case the search isn’t performed).
3742 When called interactively (non-nil @var{interactive}), display
3743 informative messages, and with prefix argument @var{force}, ask to
3744 overwrite existing ``.lrc'' files.
3745 @end defun
3746
3747 There are a number of variables we can set to define the way that
3748 `emms-lyrics' behaves, we can set these directly or by using the
3749 Customize feature in Emacs.
3750
3751 @defvr {User Option} emms-lyrics-display-on-minibuffer
3752 If non-nil, display lyrics on minibuffer.
3753 @end defvr
3754
3755 @defvr {User Option} emms-lyrics-display-on-modeline
3756 If non-nil, display lyrics on modeline.
3757 @end defvr
3758
3759 @defvr {User Option} emms-lyrics-dir
3760 Local lyrics repository.
3761 @command{emms-lyrics-find-lyric} will look for lyrics in current
3762 directory(i.e., same as the music file) and this directory.
3763 @end defvr
3764
3765 @defvr {User Option} emms-lyrics-display-format
3766 Format for displaying lyrics. "%s" will be replaced by the lyrics
3767 string.
3768 @end defvr
3769
3770 @defvr {User Option} emms-lyrics-coding-system
3771 Coding system used in the output of lyrics.
3772 @end defvr
3773
3774 @defvr {User Option} emms-lyrics-scroll-p
3775 Non-nil value will enable lyrics scrolling.
3776 @end defvr
3777
3778 @defvr {User Option} emms-lyrics-scroll-timer-interval
3779 Interval between scroller timers. The shorter, the faster.
3780 @end defvr
3781
3782 @defvr {User Option} emms-lyrics-lrclib-url
3783 Base URL for LRCLIB API requests.
3784 @end defvr
3785
3786 We can control `emms-lyrics' with the help of the following functions:
3787
3788 @defun emms-lyrics-start
3789 Start displaying lyrics.
3790 @end defun
3791
3792 @defun emms-lyrics-stop
3793 Stop displaying lyrics.
3794 @end defun
3795
3796 @defun emms-lyrics-toggle-display-on-minibuffer
3797 Toggle display lyrics on minibufer.
3798 @end defun
3799
3800 @defun emms-lyrics-toggle-display-on-modeline
3801 Toggle display lyrics on mode line.
3802 @end defun
3803
3804 @defun emms-lyrics-enable
3805 Enable displaying Emms lyrics.
3806 @end defun
3807
3808 @defun emms-lyrics-disable
3809 Disable displaying Emms lyrics.
3810 @end defun
3811
3812 @defun emms-lyrics-toggle
3813 Toggle displaying Emms lyrics.
3814 @end defun
3815
3816
3817 @c -------------------------------------------------------------------
3818 @node Volume
3819 @chapter Volume
3820
3821 @cindex volume
3822
3823 We can use the `emms-volume' package, as provided by the
3824 @file{emms-volume.el} file, to manipulate the volume.
3825
3826 @defopt emms-volume-change-amount
3827 The amount to use when raising or lowering the volume using the
3828 emms-volume interface.
3829
3830 This should be a positive integer.
3831 @end defopt
3832
3833 @defun emms-volume-raise
3834 Increase the volume.
3835 @end defun
3836
3837 @defun emms-volume-lower
3838 Decrease the volume.
3839 @end defun
3840
3841 If you feel like binding those two functions to global keys --- don't do
3842 it or you'll miss the convenience of `emms-volume-minor-mode'. Instead,
3843 bind the following two commands to some keys that you like.
3844
3845 @defun emms-volume-mode-plus
3846 Raise volume and enable or extend the `emms-volume-minor-mode' timeout.
3847 @end defun
3848
3849 @defun emms-volume-mode-minus
3850 Lower volume and enable or extend the `emms-volume-minor-mode' timeout.
3851 @end defun
3852
3853 Example:
3854
3855 @lisp
3856 (global-set-key (kbd "C-c +") 'emms-volume-mode-plus)
3857 (global-set-key (kbd "C-c -") 'emms-volume-mode-minus)
3858 @end lisp
3859
3860 Whenever you use one of these keys or call these functions with
3861 @kbd{M-x}, Emms will be put into `emms-volume-minor-mode' for a short
3862 period defined by `emms-volume-mode-timeout'.
3863
3864 @defopt emms-volume-mode-timeout
3865 The timeout in amount of seconds used by `emms-volume-minor-mode'.
3866 @end defopt
3867
3868 In this interval you can raise/lower the volume simply by pressing
3869 @kbd{+} or @kbd{-}, which will also reset the timer to its initial
3870 value. So instead of pressing @kbd{C-c +} six times to increase volume
3871 by six steps of @code{emms-volume-change-amount}, you would simply type
3872 @kbd{C-c + + + + + +}.
3873
3874 Emms can change volume with amixer, mpd, PulseAudio and mixerctl out
3875 of the box, see @var{emms-volume-change-function}.
3876
3877
3878 @c -------------------------------------------------------------------
3879 @node Streaming Audio
3880 @chapter Streaming Audio
3881
3882 @cindex streaming audio
3883 @cindex internet radio
3884
3885 Emms is a great way to play streaming audio and internet radio. It is
3886 possible to add streaming playlists and URLs to any playlist, but Emms
3887 also comes with a built-in, eclectic list of streaming audio
3888 stations. @footnote{Emms has no affiliation of any kind with the
3889 streaming audio stations included, nor is their inclusion an
3890 endorsement of these stations. Instead, this is a collection of
3891 stations submitted to the project over the years by people who enjoy
3892 Emms. We hope you will enjoy them too, and invite you to send in your
3893 suggestions to add to the list.}
3894
3895 The @file{emms-streams.el} package provides the command
3896 @command{emms-streams}.
3897
3898 Invoking @command{emms-streams} will pull up an Emms playlist buffer
3899 and populate it with the built-in list of streaming audio sources.
3900
3901 If you are using the mpv player, defined by @file{emms-player-mpv.el},
3902 then you can display the currently streaming track title (if the
3903 station provides that information) by configuring:
3904
3905 @lisp
3906 (customize-set-variable 'emms-player-mpv-update-metadata t)
3907 @end lisp
3908
3909
3910 @c -------------------------------------------------------------------
3911 @node Radio Browser
3912 @chapter Radio Browser
3913
3914 @cindex streaming audio
3915 @cindex internet radio
3916
3917 We can find new internet radio stations to stream by
3918 searching the database at
3919 @url{https://www.radio-browser.info}. The
3920 @file{emms-radio-browser.el} package provides the following commands
3921 to do this:
3922
3923 @defun emms-radio-browser-search-by-name
3924 Prompts for a station NAME and returns a playlist of
3925 matching streams.
3926 @end defun
3927
3928 @defun emms-radio-browser-search-by-url
3929 Prompts for a station URL and returns a playlist of
3930 matching streams.
3931 @end defun
3932
3933 @defun emms-radio-browser-full-search
3934 Pops up a form to search by name, tags, country or language.
3935 Returns a playlist of matching streams.
3936 @end defun
3937
3938 To activate @file{emms-radio-browser.el}, do
3939
3940 @lisp
3941 (require 'emms-radio-browser)
3942 @end lisp
3943
3944 You will need the @file{transient.el} package to be installed (this is
3945 built-in since emacs v28.1).
3946
3947 @c -------------------------------------------------------------------
3948 @node APE / FLAC Commands
3949 @chapter APE / FLAC Commands
3950
3951 Often, a single APE or FLAC file contains a complete album. We can
3952 still play next or previous track in the album with the help of
3953 @file{emms-cue.el} package, provided there is a corresponding cue
3954 sheet file. This package also defines @code{emms-info-cueinfo} for
3955 retreiving the track information for APE / FLAC itself.
3956
3957 To load @file{emms-cue.el}:
3958
3959 @lisp
3960 (require 'emms-cue)
3961 (add-to-list 'emms-info-functions 'emms-info-cueinfo)
3962 @end lisp
3963
3964 @defun emms-cue-next
3965 Play next track from .cue file
3966 @end defun
3967 @defun emms-cue-previous
3968 Play previous track from .cue file
3969 @end defun
3970
3971
3972
3973 @c -------------------------------------------------------------------
3974 @node Bookmarks
3975 @chapter Bookmarks
3976
3977 Emms can save a ``temporal bookmark'' in a media file via
3978 emms-bookmarks. The file @file{emms-bookmarks.el} provides the package
3979 emms-bookmarks.
3980
3981 While some media is playing, invoking @kbd{M-x emms-bookmarks-add}
3982 will first pause the playback and then prompt for a name describing
3983 the bookmark. Tracks can have multiple bookmarks associated with them.
3984
3985 To jump to the next and previous bookmarks in the current track invoke
3986 @kbd{M-x emms-bookmarks-next} and @kbd{M-x emms-bookmarks-prev}
3987 respectively.
3988
3989 To clear all of the bookmarks for the current track invoke @kbd{M-x
3990 emms-bookmarks-clear}.
3991
3992
3993 @c -------------------------------------------------------------------
3994 @node Managing Playlists
3995 @chapter Managing Playlists
3996
3997 Emms can have multiple playlists, since a playlist is just another
3998 buffer with a list of tracks. You can manage multiple playlists using
3999 `emms-metaplaylist-mode', provided by the file
4000 @file{emms-metaplaylist-mode}.
4001
4002 Start the playlist manager with @kbd{M-x
4003 emms-metaplaylist-mode-go}. The playlist manager will list the
4004 playlists and mark the current one. The following commands are
4005 available:
4006
4007 @table @kbd
4008
4009 @item RET
4010 @kindex RET
4011 @findex emms-metaplaylist-mode-goto-current
4012 Make the buffer at point the Emms playlist buffer and switch to it.
4013
4014 +@item V
4015 @kindex v
4016 @findex emms-metaplaylist-mode-goto
4017 Visit the playlist at point.
4018
4019 @item SPC
4020 @kindex SPC
4021 @findex emms-metaplaylist-mode-set-active
4022 Make the buffer at point the Emms playlist buffer (but do not switch
4023 to it).
4024
4025 @item n
4026 @kindex n
4027 @findex next-line
4028 Move point to the next playlist.
4029
4030 @item p
4031 @kindex p
4032 @findex previous-line
4033 Move point to the previous playlist.
4034
4035 @item g
4036 @kindex g
4037 @findex emms-metaplaylist-mode-update
4038 Update the playlist manager buffer.
4039
4040 @item C
4041 @kindex C
4042 @findex emms-metaplaylist-mode-new-buffer
4043 Create a new Emms playlist buffer.
4044
4045 @item C-k
4046 @kindex C-k
4047 @findex emms-metaplaylist-mode-kill-buffer
4048 Kill the Emms playlist buffer at point.
4049
4050 @item c
4051 @kindex c
4052 @findex emms-metaplaylist-mode-center-current
4053 Move point to the current playlist buffer.
4054
4055 @item q
4056 @kindex q
4057 @findex kill-this-buffer
4058 Kill the playlist manager.
4059
4060 @end table
4061
4062
4063 @c -------------------------------------------------------------------
4064 @node GNU FM
4065 @chapter GNU FM
4066
4067 @cindex GNU FM
4068
4069 @url{https://www.gnu.org/software/gnufm/, GNU FM} is free software for
4070 running music community websites. It was created for the music
4071 community site, @url{http://libre.fm/, Libre.fm}.
4072
4073 Emms can send track information, and stream music from GNU FM servers
4074 using @file{emms-librefm-scrobbler.el} and
4075 @file{emms-librefm-stream.el}, respectively.
4076
4077 Emms is configured by default to use @url{http://libre.fm/, Libre.fm},
4078 but can work with any GNU FM server by configuring the variable
4079 @var{emms-librefm-scrobbler-handshake-url} to the URL of the GNU FM
4080 server.
4081
4082 The recommended way of providing your credentials to the GNU FM server
4083 is by using an authinfo file. Add authentication to your auth-info
4084 file, typically @file{~/.authinfo.gpg}, as:
4085 @smallexample
4086 machine libre.fm login USERNAME password PASSWORD
4087 @end smallexample
4088 If you are using some other server than libre.fm, change
4089 ``@samp{libre.fm}'' to match
4090 @var{emms-librefm-scrobbler-handshake-url}.
4091
4092 Alternatively, you can save the password in plaintext in your init-file
4093 by setting these variables:
4094
4095 @lisp
4096 (setq emms-librefm-scrobbler-username "USERNAME"
4097 emms-librefm-scrobbler-password "PASSWORD")
4098 @end lisp
4099
4100 @menu
4101 * Uploading Track Information:: How to submit listened track information.
4102 * GNU FM Streaming:: Streaming music from a GNU FM server.
4103 @end menu
4104
4105
4106
4107 @node Uploading Track Information
4108 @section Uploading Track Information
4109
4110 GNU FM servers, such as Libre.fm can optionally store a user's
4111 listening habits using information sent to the website's server from
4112 the Emms. By utilizing the records of users' listening habits, the
4113 website aims to be able to recommend music to users by analyzing their
4114 musical taste.
4115
4116 Load the feature into Emms with:
4117
4118 @lisp
4119 (require 'emms-librefm-scrobbler)
4120 @end lisp
4121
4122 This feature can also be enabled via @xref{Setup}, in the `emms-all'
4123 setup level.
4124
4125 Enable uploading the details of the tracks Emms plays to the GNU FM
4126 server with @kbd{emms-librefm-scrobbler-enable}. The track's details
4127 will be uploaded to the server when the track's playback ends. You can
4128 disable this behavior with @kbd{emms-librefm-scrobbler-disable}.
4129
4130
4131
4132
4133 @node GNU FM Streaming
4134 @section GNU FM Streaming
4135
4136 If the GNU FM server provides a streaming music service you can take
4137 advantage of it by loading:
4138
4139 @lisp
4140 (require 'emms-librefm-stream)
4141 @end lisp
4142
4143 This feature can also be enabled via @xref{Setup}, in the `emms-all'
4144 setup level.
4145
4146 Then invoke @kbd{emms-librefm-stream} and enter the URL of the station
4147 you wish to listen to, for example ``librefm://globaltags/Classical''.
4148
4149 @c -------------------------------------------------------------------
4150 @node Listenbrainz
4151 @chapter Listenbrainz
4152
4153 @cindex Listenbrainz
4154
4155 Listenbrainz offers an alternative store of listening habits
4156 using information sent by the Emms.
4157
4158 To use this service, you will need to obtain a user token
4159 from @url{https://listenbrainz.org/settings/}. You
4160 should store this token in @file{ ~/.authinfo.gpg} or an
4161 equivalent file understood by auth-source with a line like
4162 this:
4163
4164 @smallexample
4165 machine api.listenbrainz.org password 0abc1de2-245-67fa-8906b-bc123d4dbdaa
4166 @end smallexample
4167
4168 Alternatively, you can store the token in plain-text in your
4169 init file by setting the variable
4170 @kbd{emms-listenbrainz-scrobbler-token}:
4171
4172 @lisp
4173 (setq emms-listenbrainz-scrobbler-token "0abc1de2-245-67fa-8906b-bc123d4dbdaa")
4174 @end lisp
4175
4176 Once this is done, you can load the feature with
4177
4178 @lisp
4179 (require 'emms-listenbrainz-scrobbler)
4180 @end lisp
4181
4182 Enable uploading the details of the tracks Emms plays to the listenbrainz
4183 server with @kbd{emms-listenbrainz-scrobbler-enable}. The track's details
4184 will be uploaded to the server when the track's playback ends. You can
4185 disable this behavior with @kbd{emms-listenbrainz-scrobbler-disable}.
4186
4187 @c -------------------------------------------------------------------
4188 @node D-Bus
4189 @chapter D-Bus
4190
4191 @cindex D-Bus
4192
4193 Emms can provide an MPRIS interface which allows it to be
4194 controlled over D-Bus.
4195
4196 To enable this, first load the feature:
4197
4198 @lisp
4199 (require 'emms-mpris)
4200 @end lisp
4201
4202
4203 and then turn it on with @kbd{emms-mpris-enable}. You can
4204 turn it off with @kbd{emms-mpris-disable}.
4205
4206 At present, the Emms implementation of the @url{
4207 https://specifications.freedesktop.org/mpris-spec/latest/index.html,
4208 MPRIS specification} is not complete: changing the volume
4209 is not currently supported.
4210
4211
4212 @c including the relevant licenses
4213 @include gpl.texi
4214 @include fdl.texi
4215
4216
4217
4218 @node Concept Index
4219 @unnumbered Concept Index
4220 @printindex cp
4221
4222
4223
4224 @node Function Index
4225 @unnumbered Function Index
4226 @printindex fn
4227
4228
4229
4230 @node Variable Index
4231 @unnumbered Variable Index
4232 @printindex vr
4233
4234
4235
4236 @node Keybinding Index
4237 @unnumbered Keybinding Index
4238 @printindex ky
4239
4240 @bye