From 0b2c3ffddabb798fa64cd349264e2bc06de3077f Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Tue, 10 May 2022 15:05:54 +1000 Subject: added torsocks support --- emms-info-ytdl.el | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'emms-info-ytdl.el') 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))) -- cgit v1.2.3