[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Add a list of urls
From: |
Yuchen Pei |
Subject: |
Add a list of urls |
Date: |
Wed, 13 Oct 2021 15:44:11 +1100 |
User-agent: |
mu4e 1.4.13; emacs 27.2 |
Hello,
I have two functions in my init file that help me add a bunch of
urls to the current emms playlist:
(defun emms-add-ytdl-playlist (url buffer-name)
"Adds all videos on a web playlist from URL using youtube-dl.
(defun emms-add-url-region (from to)
"Adds a list of urls to emms separated by newlines."
I've been using them for a while and found them pretty handy.
Does either one look like it may fit in emms? If so I'll be happy
to work on a patch to add them in.
(defun emms-add-process-output-url (process output)
"A process filter extracting url from a jq output."
(let ((left (string-match "\".*\"" output)))
(emms-add-url (substring output (1+ left) (1- (match-end
0))))))
(defun emms-add-ytdl-playlist (url buffer-name)
"Adds all videos on a web playlist from URL using youtube-dl.
URL could be link to a playlist, a playlist id, videos of a
channel, or a
list of playlists on a channel:
- https://youtube.com/playlist?list=<youtube-playlist-id>
- <youtube-playlist-id>
- https://youtube.com/channel/<youtube-channel-id>/videos
- https://youtube.com/channel/<youtube-channel-id>/playlists
- https://www.dailymotion.com/playlist/<daily-motion-playlist-id>
etc.
"
(interactive "syoutube-dl playlist url: \nsemms buffer name: ")
(emms-playlist-set-playlist-buffer
(emms-playlist-new buffer-name))
(set-process-filter
(start-process-shell-command
"ytdl-emms" nil
(format "youtube-dl -j %s | jq '.webpage_url'" url))
'emms-add-process-output-url))
(defun emms-add-url-region (from to)
"Adds a list of urls to emms separated by newlines."
(interactive (list (region-beginning) (region-end)))
(mapc 'emms-add-url (split-string (buffer-substring from to) "
")))
--
Best,
Yuchen
PGP Key: 47F9 D050 1E11 8879 9040 4941 2126 7E93 EF86 DFD0
<https://ypei.me/assets/ypei-pubkey.txt>
signature.asc
Description: PGP signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Add a list of urls,
Yuchen Pei <=