summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-07-01 08:27:06 +0300
committerThanos Apollo <[email protected]>2023-07-01 08:27:06 +0300
commitb04af718702c0a88de9653817f6217b3ffd4f03f (patch)
treeee8a83043efce372df0b6bb4bcdd01eeb3d5784c
parentb5fbc8e553468d2637fc4478f6a8b1a08620ed37 (diff)
Add customs
- yt-search-for: Defining the amount of search results - yt-player: Define video player as command using a string - yt-download-directory: Define download directory
-rw-r--r--yeetube.el29
1 files changed, 25 insertions, 4 deletions
diff --git a/yeetube.el b/yeetube.el
index b9e6bea..df7ca64 100644
--- a/yeetube.el
+++ b/yeetube.el
@@ -27,11 +27,17 @@
(require 'url)
(require 'org-element)
+(defcustom yt-search-for 10
+ "Define the amount of search results."
+ :type 'number
+ :safe #'numberp
+ :group 'yeetube)
(defcustom yt-search-query "https://www.youtube.com/results?search_query="
"Search URL."
:type 'string
- :group 'youtube)
+ :safe #'stringp
+ :group 'yeetube)
(defcustom yt-download-audio-format nil
"Select download video as audio FORMAT.
@@ -40,17 +46,32 @@ If nil yt-download-videos output will be the default format.
Example Usage:
(setq yt-download-audio-format \"m4a\")"
:type 'string
- :group 'youtube)
+ :safe #'stringp
+ :group 'yeetube)
+(defcustom yt-player "mpv"
+ "Select default video player as command.
+
+Example Usage:
+ (setq yt-player \"vlc\")
+ (setq yt-player \"mpv --no-audio\")"
+ :type 'string
+ :safe #'stringp
+ :group 'yeetube)
+
+(defcustom yt-download-directory "~/Downloads"
+ "Default directory to downlaod videos."
+ :type 'string
+ :safe #'stringp
+ :group 'yeetube)
-;; TODO: Make a defcustom for video player
(defun yt-play ()
"Open the link at point in an `'org-mode buffer with `'mpv."
(interactive)
(let ((url (org-element-property
:raw-link (org-element-context))))
(when (string-prefix-p "http" url)
- (async-shell-command (format "mpv %s" url))
+ (async-shell-command (format "%s %s" yt-player url))
(message "Opening %s with mpv" url))))