[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emms-patches] darcs patch: browse subcategories (eg artist->album->titl
From: |
Damien Elmes |
Subject: |
[Emms-patches] darcs patch: browse subcategories (eg artist->album->title) |
Date: |
Sat, 10 Jun 2006 04:04:27 +0900 (JST) |
Sat Jun 10 03:59:50 JST 2006 Damien Elmes <address@hidden>
* browse subcategories (eg artist->album->title)
- subcategories can now be expanded and contracted, and added to
playlist
- see the new keybindings at the top of the file
- add new faces for the various sublevels (only the dark background
colours are useful at the moment - any light background users want
to fix that?)
- fix a bug in emms-smart-browse with (recenter)
New patches:
[browse subcategories (eg artist->album->title)
Damien Elmes <address@hidden>**20060609185950
- subcategories can now be expanded and contracted, and added to
playlist
- see the new keybindings at the top of the file
- add new faces for the various sublevels (only the dark background
colours are useful at the moment - any light background users want
to fix that?)
- fix a bug in emms-smart-browse with (recenter)
] {
hunk ./emms-browser.el 47
-;; SPC - add all the tracks on the current line to the playlist
-;; RET - do the same, and start the first added track playing
+;; SPC - expand/contract current item
+;; RET - add current artist/album/title/etc
+;; C-RET - as above, but select the first added file and play
hunk ./emms-browser.el 123
+(defvar emms-browser-current-mapping-type nil
+ "The current mapping type, eg. 'info-artist")
+(make-variable-buffer-local 'emms-browser-current-mapping-type)
+
hunk ./emms-browser.el 133
- (define-key map (kbd "RET") 'emms-browser-add-tracks-and-play)
- (define-key map (kbd "SPC") 'emms-browser-add-tracks)
+ (define-key map (kbd "C-/") 'emms-playlist-mode-undo)
+ (define-key map (kbd "SPC") 'emms-browser-toggle-subitems)
+ (define-key map (kbd "RET") 'emms-browser-add-tracks)
+ (define-key map (kbd "<C-return>") 'emms-browser-add-tracks-and-play)
hunk ./emms-browser.el 142
- (:foreground "plum"))
+ (:foreground "#aaaaff"))
+ (((class color) (background light))
+ (:foreground "Blue"))
+ (((type tty) (class mono))
+ (:inverse-video t))
+ (t (:background "Blue")))
+ "Face for the tracks in a playlist buffer."
+ :group 'emms-browser-mode)
+
+(defface emms-browser-tracks-sub-face-1
+ '((((class color) (background dark))
+ (:foreground "#7777ff"))
+ (((class color) (background light))
+ (:foreground "Blue"))
+ (((type tty) (class mono))
+ (:inverse-video t))
+ (t (:background "Blue")))
+ "Face for the tracks in a playlist buffer."
+ :group 'emms-browser-mode)
+
+(defface emms-browser-tracks-sub-face-2
+ '((((class color) (background dark))
+ (:foreground "#4444ff"))
+ (((class color) (background light))
+ (:foreground "Blue"))
+ (((type tty) (class mono))
+ (:inverse-video t))
+ (t (:background "Blue")))
+ "Face for the tracks in a playlist buffer."
+ :group 'emms-browser-mode)
+
+(defface emms-browser-tracks-sub-face-3
+ '((((class color) (background dark))
+ (:foreground "#3333ff"))
hunk ./emms-browser.el 266
-(defmacro emms-browser-add-category (name track-type)
+(defmacro emms-browser-add-category (name track-type &optional expand-func)
hunk ./emms-browser.el 276
- (emms-browser-display-by ,track-type)
+ (emms-browser-display-by ,track-type ,expand-func)
hunk ./emms-browser.el 279
-(emms-browser-add-category "artist" 'info-artist)
-(emms-browser-add-category "album" 'info-album)
-(emms-browser-add-category "genre" 'info-genre)
-(emms-browser-add-category "year" 'info-year)
+(emms-browser-add-category "artist" 'info-artist 'emms-browser-show-albums)
+(emms-browser-add-category "album" 'info-album 'emms-browser-show-titles)
+(emms-browser-add-category "genre" 'info-genre 'emms-browser-show-artists)
+(emms-browser-add-category "year" 'info-year 'emms-browser-show-artists)
hunk ./emms-browser.el 290
- (setq field (emms-track-get track field-type "missing-tag"))
+ (setq field (emms-track-get track field-type "misc"))
hunk ./emms-browser.el 298
-(defun emms-browser-display-by (field-type)
- "Render a mapping into a browser buffer."
+(defun emms-browser-display-by (field-type &optional expand-func)
+ "Render a mapping into a browser buffer.
+Optional EXPAND-FUNC is a function to call when expanding a
+line."
hunk ./emms-browser.el 303
- (maphash (lambda (field track)
- (emms-browser-insert-entry field track))
+ (maphash (lambda (desc data)
+ (emms-browser-insert-entry desc data expand-func))
hunk ./emms-browser.el 324
-(defun emms-browser-insert-entry (entry tracks)
- "Add a single ENTRY -> TRACKS mapping to the buffer."
+(defun emms-browser-insert-entry (entry tracks &optional expand-func)
+ "Add a single ENTRY -> TRACKS mapping to the buffer.
+EXPAND-FUNC is an optional func to call when expanding a line."
hunk ./emms-browser.el 330
- 'emms-tracks tracks
+ 'emms-browser-data tracks
+ 'emms-browser-level 1
+ 'emms-browser-expand-func expand-func
hunk ./emms-browser.el 338
- (let ((tracks (emms-browser-tracks-at))
+ (let ((tracks (emms-browser-data-at))
hunk ./emms-browser.el 379
-(defun emms-browser-tracks-at (&optional pos)
+(defun emms-browser-data-at (&optional pos)
hunk ./emms-browser.el 388
- 'emms-tracks))))
+ 'emms-browser-data))))
hunk ./emms-browser.el 396
+;; --------------------------------------------------
+;; Expansion/subitem support (experimental)
+;; --------------------------------------------------
+
+(defmacro emms-browser-add-show-category (name field-type &optional
expand-func)
+ "Create an interactive function emms-browser-show-FIELD-TYPE.
+EXPAND-FUNC is used to further expand subitems."
+ (let ((fname (intern (concat "emms-browser-show-" name)))
+ (fdesc (concat "Show " name " under current line")))
+ `(defun ,fname ()
+ ,fdesc
+ (interactive)
+ (let ((data (emms-browser-make-alist-from-field
+ ,field-type
+ (emms-browser-data-at))))
+ ;; FIXME: sort data
+ (emms-browser-insert-subitems data ,expand-func)))))
+
+(emms-browser-add-show-category
+ "albums" 'info-album 'emms-browser-show-titles)
+(emms-browser-add-show-category
+ "artists" 'info-artist 'emms-browser-show-albums)
+(emms-browser-add-show-category
+ "titles" 'info-title)
+
+(defun emms-browser-level-at-point ()
+ "Return the current level at point.
+Actually this function returns the value of the first character
+on the line, because if point is on a trailing \n it will fail.
+Returns 0 if the current line is not an entry."
+ (let ((val
+ (get-text-property (line-beginning-position)
+ 'emms-browser-level)))
+ (if val
+ val
+ 0)))
+
+(defun emms-browser-find-entry-more-than-level (level)
+ "Move point to next entry more than LEVEL and return point.
+If no entry exits, return nil.
+Returns point if currently on a an entry more than LEVEL."
+ (let ((old-pos (point))
+ level-at-point)
+ (re-search-forward "\n" nil t)
+ (if (> (emms-browser-level-at-point) level)
+ (point)
+ (goto-char old-pos)
+ nil)))
+
+(defun emms-browser-subitems-exist ()
+ "True if there are any subentries under point."
+ (let ((current-level (emms-browser-level-at-point))
+ new-level)
+ (save-excursion
+ (re-search-forward "\n" nil t)
+ (when (setq new-level (emms-browser-level-at-point))
+ (> new-level current-level)))))
+
+(defun emms-browser-toggle-subitems ()
+ "Show or hide (kill) subitems under the current line."
+ (interactive)
+ (if (emms-browser-subitems-exist)
+ (emms-browser-kill-subitems)
+ (emms-browser-show-subitems)))
+
+(defun emms-browser-show-subitems ()
+ "Show subitems under the current line."
+ (let ((func (get-text-property (line-beginning-position)
+ 'emms-browser-expand-func)))
+ (if func
+ (funcall func)
+ (message "Can't expand further!"))))
+
+(defun emms-browser-kill-subitems ()
+ "Remove all subitems under the current line.
+Stops at the next line at the same level, or EOF."
+ (let ((current-level (emms-browser-level-at-point))
+ (kill-whole-line t))
+ (save-excursion
+ (emms-with-inhibit-read-only-t
+ (while (emms-browser-find-entry-more-than-level current-level)
+ (kill-line)
+ (previous-line))))))
+
+(defun emms-browser-insert-subitems (subitems &optional expand-func)
+ "Insert SUBITEMS under the current item.
+SUBITEMS is a list of cons cells (desc . data).
+emms-browser-level will be set to 1 more than the current level."
+ (let ((new-level (1+ (emms-browser-level-at-point)))
+ desc data)
+ (save-excursion
+ (next-line)
+ (beginning-of-line)
+ (emms-with-inhibit-read-only-t
+ (dolist (item subitems)
+ (setq desc (car item))
+ (setq data (cdr item))
+ (insert
+ (emms-propertize (concat (make-string (* 2 (1- new-level)) ?\ )
desc)
+ 'emms-browser-data data
+ 'emms-browser-level new-level
+ 'emms-browser-expand-func expand-func
+ 'face
+ (intern
+ (concat
+ "emms-browser-tracks-sub-face-"
+ (int-to-string
+ (1- new-level)))))
+ "\n"))))))
+
+(defun emms-browser-make-alist-from-field (field-type tracks)
+ "Make an alist mapping of FIELD-TYPE -> TRACKS.
+Items with no metadata for FIELD-TYPE will be placed in 'misc'"
+ (let (db key existing)
+ (dolist (track tracks)
+ (setq key (emms-track-get track field-type "misc"))
+ (setq existing (assoc key db))
+ (if existing
+ (setcdr existing (cons track (cdr existing)))
+ (push (cons key (list track)) db)))
+ db))
+
hunk ./emms-browser.el 541
- (when emms-browser-switch-to-playlist-on-add
- (emms-smart-browse))
- ;; recenter
- (with-selected-window
- (emms-browser-get-linked-window)
- ;; FIXME: how do we achieve the same behaviour as
- ;; c-u when calling interactively?
- (recenter))))
+ (let (playlist-window)
+ (when emms-browser-switch-to-playlist-on-add
+ (emms-smart-browse))
+ ;; recenter
+ (when
+ (setq playlist-window
+ (emms-browser-get-linked-window))
+ (with-selected-window
+ playlist-window
+ ;; FIXME: how do we achieve the same behaviour as
+ ;; c-u when calling interactively?
+ (recenter))))))
hunk ./emms-browser.el 631
+;(defun emms
}
Context:
[update emms-cache.el commentary
Damien Elmes <address@hidden>**20060609064935]
[emms-player-mpd: Add functionality to dump MusicPD data into the EMMS cache.
This allows for easy integration with emms-browser.el.
Michael Olson <address@hidden>**20060609043831]
[emms-player-mpd: Rename volume functions to better match the namespace created
by emms-volume.el.
Michael Olson <address@hidden>**20060609043643]
[emms-player-mpd: Fix minor bug when importing the current MusicPD playlist
into EMMS.
Michael Olson <address@hidden>**20060609043538]
[emms-setup: Get rid of pointless compiler warning.
Michael Olson <address@hidden>**20060609042002]
[emms-cache: Small compiler fix.
Michael Olson <address@hidden>**20060609041606]
[emms-cache: Add standard enable/disable/toggle interface and do a docfix for
emms-cache-set-function.
Michael Olson <address@hidden>**20060609040108]
[Standardize copyright notices. Add COPYING file. Mention license in README.
Michael Olson <address@hidden>**20060608194123]
[Fix compiler warnings in emms-cache.el.
Michael Olson <address@hidden>**20060608184612]
[emms-metaplaylist-mode: Fix bug introduced by the recent emms-playlist-mode
overhaul. Add faces for light backgrounds.
Michael Olson <address@hidden>**20060608143846]
[NEWS is new
address@hidden
[emms-playlist-mode: Facify tracks on startup.
address@hidden
[refactor browser mode creation code
Damien Elmes <address@hidden>**20060608123618
- make the rendering function (browse-by-artist, etc) responsible for
the mode name
- fix a bug where the wrong buffer is used
]
[browser sorting, and bug fixes
Damien Elmes <address@hidden>**20060608105253
- sort tracks when they're added to the playlist
- fix a bug where we didn't uniquify the buffer
- distinguish between files and urls
- modify emms-playlist-sort to accept an optional region
]
[update modeline when changing browsing method
Damien Elmes <address@hidden>**20060608094037]
[avoid rebuilding the browser window each time
Damien Elmes <address@hidden>**20060608092623]
[fix RET on trailing \n
Damien Elmes <address@hidden>**20060608090703
\n isn't propertized which means hitting RET on a playlist or browser
entry fails. this patch moves the point before trying to read the
properties.
]
[add a metadata browser - emms-browser.el
Damien Elmes <address@hidden>**20060608084400
* preliminary work on a metadata browser - still alpha, but it's
useable for me
* also updated my email address in emms-cache.el (whoops)
]
[small typo fix
Damien Elmes <address@hidden>**20060608032546]
[emms.el: Change directory to / before starting the player.
address@hidden
[emms-playlist-mode: When making new overlays, do not allow the rear to
advance. This prevents some display issues. If we really need to modify the
text there, we should be using (insert-before-markers).
Michael Olson <address@hidden>**20060607215212]
[Make emms-property-region bulletproof.
Michael Olson <address@hidden>**20060607215113]
[Fix typo in emms-property-region
address@hidden
[emms.el, simplified emms-property-region considerably.
address@hidden
[Very basic support for recording the time you last played a track.
address@hidden
* emms-last-played.el: New file.
Nothing fancy right now, more to come soon.
* emms-setup.el: emms-devel now requires and setups emms-last-played.
]
[Mark the cache as dirty for each modification.
address@hidden
[emms.el: The currently playing marker now should stay where it is, even for
yanks
address@hidden
[emms-playlist-mode: Stop overlay from being attached to text inserted before it
address@hidden
[fix damien elmes's email address
Damien Elmes <address@hidden>**20060607154000]
[emms sources now switch add/play behavior when a prefix argument is supplied.
address@hidden
[Add autoloads to emms-setup.el
address@hidden
[Typo, defvar => defcustom for emms-cache-set-function
address@hidden
[Cleaned up the cached code in emms.el a bit
address@hidden
[refactor caching code into emms-cache.el
Damien Elmes <address@hidden>**20060607125345
* caching support is now provided via two function vars in emms.el,
emms-cache-get-function and emms-cache-set-function
* (emms-standard) or above will enable caching support
* you'll need to remove .emms-cache or s/emms-info-cache/emms-cache-db/
]
[emms-info: Fix bug that occurs after clearing the current playlist and trying
to re-add songs to it.
Michael Olson <address@hidden>**20060606144439]
[emms-playlist-mode doesn't need overlay compatibility anymore
address@hidden
[emms-playlist-mode.el - now with less overlay!
address@hidden
[AUTHORS: fixed Lucas' e-mail address
address@hidden
[AUTHORS: Damien Elmes address updated
address@hidden
[info-cache-dirty/coding
Damien Elmes <address@hidden>**20060605163339
* mark the info cache as dirty when it's modified, so we don't have to
write it out all the time
* save the cache as mule-utf-8 - comments? i'm not sure if this is
correct
]
[emms-info caching (thanks to Damien Elmes)
address@hidden
[Sort file names from `emms-source-file-directory-tree-function'.
address@hidden
[Add some sources for inserting playlists without inserting their contents, and
likewise for directories of playlist files. Exclude some files and directories
from being added when walking directories.
Michael Olson <address@hidden>**20060604195602]
[emms-player-mpd: Differentiate between files and URLs when it makes sense to
do so.
Michael Olson <address@hidden>**20060604195449]
[Miscellaneous minor cleanups.
Michael Olson <address@hidden>**20060604195311]
[Make sure we never have an empty track description when inserting a song into
a playlist buffer.
Michael Olson <address@hidden>**20060604194940]
[Remove debian-extras package as requested by ftpmasters (debian)
address@hidden
[Put volume options in their own customize group.
Martin Schoenmakers <address@hidden>**20060601193853
Added a separate emms-volume group for customize and put things there instead
of in the main thing.
]
[Make handling of multiple playlist buffers less error-prone.
Michael Olson <address@hidden>**20060531203810]
[emms-volume.el: Cosmetic stuff, defvar -> defcustom
address@hidden
[emms-volume.el: Minor cosmetic cleanup
address@hidden
[emms-volme.el: Add some requires.
address@hidden
[emms-volume-amixer.el: Provide a way to set the control for amixer
address@hidden
[AUTHORS: Add Martin Schoenmakers. Welcome! :-)
address@hidden
[Add emms-volume and emms-volume-amixer.
Martin Schoenmakers <address@hidden>**20060530223500
New files: emms-volume.el provides some general volume changing things,
including a minor mode to more easily change volume when not in the
EMMS buffer. emms-volume-amixer.el is a backend using amixer.
]
[emms-streams: Re-add space after prompt and use completion for type.
Michael Olson <address@hidden>**20060530190620]
[emms-streams: When the user wants emms-streams to play the selected stream
instead of add it, create our own playlist buffer. When quitting, if we own
the current playlist buffer, kill it.
Michael Olson <address@hidden>**20060530144243]
[allow nonzero ogginfo exit plus some reindenting
Martin Schoenmakers <address@hidden>**20060530130411
When ogginfo gave a nonzero value on exit, any valid data would get tossed
if there was any. This prevented emms from showing info for files that are
tagged but a bit odd.
Also reindented emms-info-ogginfo accordingly, which incidentally removed
some tabs in favour of spaces.
]
[emms-streams: Re-implement yank and kill so that they do the right thing with
emms-stream-list.
Michael Olson <address@hidden>**20060530045429]
[emms-streams: Implement kill and yank.
Michael Olson <address@hidden>**20060530040114]
[emms-streams: Make hitting RET on a URL do the right thing, improve cursor
movement, and mark the buffer as unmodified after performing a save.
Michael Olson <address@hidden>**20060529030043]
[emms-player-mpd: Make seek work correctly.
Michael Olson <address@hidden>**20060525033120]
[emms-player-mpd: Use more robust method of detecting whether we need to
force-feed MusicPD our playlist.
Michael Olson <address@hidden>**20060525014253]
[emms-playlist-mode: Make "d" kill the entire line. This seems to be a good
compromise of those who use C-k and those who want more standard object-killing
behavior.
foo**20060524200008]
[emms-player-mpd: When showing the currently-playing song, prepend the name of
the radio station, if it exists.
foo**20060524195911]
[emms-player-mpd: Fix bug that caused unconditional reloading of the entire
MusicPD playlist whenever the track was changed manually.
Michael Olson <address@hidden>**20060524061655]
[emms-player-mpd: Overhaul for streamlist support, and fix a few miscellaneous
issues.
Michael Olson <address@hidden>**20060524055707]
[emms-player-mpd: Add a few checks to make sure that the given buffer exists
before trying to do anything with it.
Michael Olson <address@hidden>**20060517035419]
[emms-source-playlist: Do not expand names of files in playlists, as this can
cause problems with emms-player-mpd in some configurations.
Michael Olson <address@hidden>**20060516081257]
[emms-playlist-mode: Implement the option (disabled by default) of opening a
new EMMS buffer for a playlist, when hitting RET on one.
Michael Olson <address@hidden>**20060510040730]
[emms-playlist-mode.el: Don't put a period after the mode map. This hangs 21.4
on display.
address@hidden
[TAG 2.0
address@hidden
Patch bundle hash:
7d63080525d85cd9924b8e5bbb72aef5e326a9bb
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emms-patches] darcs patch: browse subcategories (eg artist->album->title),
Damien Elmes <=