[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/mpv 69beddcf57 2/3: Add mpv-playlist-append and mpv-playli
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/mpv 69beddcf57 2/3: Add mpv-playlist-append and mpv-playlist-append-url |
Date: |
Mon, 1 Aug 2022 10:59:01 -0400 (EDT) |
branch: elpa/mpv
commit 69beddcf5795f803d2a4425450a74857429f4a46
Author: Johann Klähn <johann@jklaehn.de>
Commit: Johann Klähn <johann@jklaehn.de>
Add mpv-playlist-append and mpv-playlist-append-url
---
mpv.el | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/mpv.el b/mpv.el
index 1c5fd46b06..309e01acbb 100644
--- a/mpv.el
+++ b/mpv.el
@@ -477,18 +477,16 @@ See `mpv-start' if you need to pass further arguments and
(mpv-start url))
;;;###autoload
-(defun mpv-playlist-append (url &rest args)
- "Append URL to the current mpv playlist.
+(defun mpv--playlist-append (thing &rest args)
+ "Append THING to the current mpv playlist.
If ARGS are provided, they are passed as per-file options to mpv."
- (interactive "sURL: ")
- (mpv-run-command "loadfile" url "append"
+ (mpv-run-command "loadfile" thing "append"
(string-join
(mapcar (lambda (arg)
(string-trim-left arg "--"))
args)
","))
-
(thread-last
(mpv-get-property "playlist-count")
1-
@@ -496,6 +494,22 @@ If ARGS are provided, they are passed as per-file options
to mpv."
(mpv-get-property)
(message "Added `%s' to the current playlist")))
+(defun mpv-playlist-append (path &rest args)
+ "Append the file at PATH to the current mpv playlist.
+
+If ARGS are provided, they are passed as per-file options to mpv."
+ (interactive "fFile: ")
+ (apply 'mpv--playlist-append (expand-file-name path) args))
+
+(defun mpv-playlist-append-url (url &rest args)
+ "Append URL to the current mpv playlist.
+
+If ARGS are provided, they are passed as per-file options to mpv."
+ (interactive "sURL: ")
+ (unless (mpv--url-p url)
+ (user-error "Invalid argument: `%s' (must be a valid URL)" url))
+ (apply 'mpv--playlist-append url args))
+
;;;###autoload
(defun mpv-quit (watch-later)
"Exit the current mpv process.