diff options
author | Thanos Apollo <[email protected]> | 2023-07-04 07:35:22 +0300 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2023-07-04 07:35:22 +0300 |
commit | 4265ae3e455aded7337580ae39750386d40c3377 (patch) | |
tree | a349ebc312e0da3dff48e59372f6f45780755e8a | |
parent | a1601e6ad68db1bd717d8f93b1e1f28bf21a5d84 (diff) |
Add yeetube-change-download-audio-format
Create an interactive function to change download audio format &
watch for its value using variable watchers using yeetube-update-info
-rw-r--r-- | yeetube.el | 22 |
1 files changed, 17 insertions, 5 deletions
@@ -219,8 +219,9 @@ then run this command interactively." "Insert default keybindings at *Yeetube Search* buffer." (insert "\n\n** Info" - (format "\nDownload Directory: %s" yeetube-download-directory) - (format "\nYeetube Player: %s" yeetube-player)) + (format "\nDownload Directory: *%s*" yeetube-download-directory) + (format "\nDownload as audio format: *%s*" yeetube-download-audio-format) + (format "\nYeetube Player: *%s*" yeetube-player)) (when yeetube-display-info-keys (insert "\n\n*** Keybindings" @@ -234,7 +235,16 @@ then run this command interactively." (defun yeetube-change-download-directory () "Change download directory." (interactive) - (setq yeetube-download-directory (read-directory-name "Select a directory: "))) + (setq yeetube-download-directory + (read-directory-name "Select a directory: "))) + +(defun yeetube-change-download-audio-format () + "Change download audio format." + (interactive) + (setq yeetube-download-audio-format + (read-string "Specify audio format(no for nil): ")) + (when (equal yeetube-download-audio-format "no") + (setq yeetube-download-audio-format nil))) (defun yeetube-update-info (symbol-name new-value _operation _where) "Update information for SYMBOL-NAME with NEW-VALUE. @@ -249,7 +259,8 @@ OPERATION & WHERE are required to work with 'add-variable-watcher." (let ((to-change (pcase symbol-name ('yeetube-player "Yeetube Player:") - ('yeetube-download-directory "Download Directory:")))) + ('yeetube-download-directory "Download Directory:") + ('yeetube-download-audio-format "Download as audio format:")))) (switch-to-buffer (get-buffer "*Yeetube Search*")) (setq-local buffer-read-only nil) (goto-char (point-min)) @@ -257,7 +268,7 @@ OPERATION & WHERE are required to work with 'add-variable-watcher." (beginning-of-visual-line) (kill-visual-line) (insert - (format "%s %s" to-change new-value)) + (format "%s *%s*" to-change new-value)) (goto-char (point-min)) (search-forward yeetube-results-prefix) (setq-local buffer-read-only t) @@ -268,6 +279,7 @@ OPERATION & WHERE are required to work with 'add-variable-watcher." ;; Variable to watch (add-variable-watcher 'yeetube-download-directory #'yeetube-update-info) (add-variable-watcher 'yeetube-player #'yeetube-update-info) +(add-variable-watcher 'yeetube-download-audio-format #'yeetube-update-info) (provide 'yeetube) ;;; yeetube.el ends here |