Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; Copyright (C) 2015
- ;; This file is free software; you can redistribute it and/or modify
- ;; it under the terms of the GNU General Public License as published by
- ;; the Free Software Foundation; either version 3 of the License, or
- ;; (at your option) any later version.
- ;; This file is distributed in the hope that it will be useful,
- ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
- ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ;; GNU General Public License for more details.
- ;; You should have received a copy of the GNU General Public License
- ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
- ;;; Jump to a random line
- ; sburke@cpan.org
- (defun goto-random-line ()
- "Go to a random line in this buffer."
- ; good for electrobibliomancy.
- (interactive)
- (goto-line (1+ (random (buffer-line-count)))))
- (defun buffer-line-count ()
- "Return the number of lines in this buffer."
- (count-lines (point-min) (point-max)))
- (defun emms-random-album-enqueue ()
- (interactive)
- (emms-browse-by-album)
- (goto-random-line)
- (emms-browser-add-tracks))
- (defun emms-random-albums-enqueue (desired-number)
- "Enqueue a desired number of random albums"
- (interactive "How many albums you want enqueued: ")
- (message "Number of albums added: %d" desired-number)
- (setq count 0)
- (emms-browse-by-album)
- (while (< count desired-number)
- (goto-random-line)
- (emms-browser-add-tracks)
- (setq count (+ 1 count)))
- )
- (defun emms-random-albums-play (desired-number)
- "Play a desired number of random albums"
- (interactive "nHow many albums you want played: ")
- (message "Number of albums added: %d" desired-number)
- (emms-browse-by-album)
- (goto-random-line)
- (emms-browser-add-tracks-and-play)
- (setq count 1)
- (while (< count desired-number)
- (goto-random-line)
- (emms-browser-add-tracks)
- (setq count (+ 1 count)))
- )
- (provide 'emms-random-album)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement