aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--emms-info-ytdl.el19
1 files changed, 14 insertions, 5 deletions
diff --git a/emms-info-ytdl.el b/emms-info-ytdl.el
index 9136860..88fd7d0 100644
--- a/emms-info-ytdl.el
+++ b/emms-info-ytdl.el
@@ -1,6 +1,6 @@
;;; emms-info-ytdl.el --- info-method for EMMS using ytdl -*- lexical-binding: t; -*-
-;; Copyright (C) 2020 Free Software Foundation, Inc.
+;; Copyright (C) 2022 Free Software Foundation, Inc.
;; Author: Yuchen Pei (ycp@gnu.org)
;; Keywords: multimedia
@@ -48,13 +48,18 @@
"Regexp to use ytdl to get info.")
(defvar emms-info-ytdl-exclude-regexp
- "\\(\\.\\w+$\\|/playlist\\|/channel\\)"
+ ;; "\\(\\.\\w+$\\|/playlist\\|/channel\\)"
+ "\\(/playlist\\|/channel\\)"
"Regexp not to use ytdl to get info.")
(defvar emms-info-ytdl-command
- "youtube-dl"
+ "yt-dlp"
"Command to run for emms-info-ytdl.")
+(defcustom emms-info-ytdl-using-torsocks
+ nil
+ "If t, use torsocks to get ytdl info")
+
(defun emms-info-ytdl (track)
"Set TRACK info using ytdl."
(when (and (eq (emms-track-type track) 'url)
@@ -65,8 +70,12 @@
(with-temp-buffer
(when (zerop
(let ((coding-system-for-read 'utf-8))
- (call-process emms-info-ytdl-command nil '(t nil) nil
- "-j" (emms-track-name track))))
+ (if emms-info-ytdl-using-torsocks
+ (call-process-with-torsocks
+ emms-info-ytdl-command nil '(t nil) nil "-j"
+ (emms-track-name track))
+ (call-process emms-info-ytdl-command nil '(t nil) nil
+ "-j" (emms-track-name track)))))
(goto-char (point-min))
(condition-case nil
(let ((json-fields (json-read)))