summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-08-01 14:44:52 +0300
committerThanos Apollo <[email protected]>2023-08-01 15:00:28 +0300
commit4cd3bfeae40709b952120827372e4731e7351c77 (patch)
tree0655fd47fc2e9bca228c7c6314db218632586bf1
parent9b44d119a0af6444d55a723adc562827be4b1a02 (diff)
fix: Docstrings and Path
Update docstrings For (yeetube-load-saved-videos) add if statement to check if yeetube file exists
-rw-r--r--README.md5
-rw-r--r--yeetube.el23
2 files changed, 20 insertions, 8 deletions
diff --git a/README.md b/README.md
index 14d522d..f53e63d 100644
--- a/README.md
+++ b/README.md
@@ -26,6 +26,11 @@ git clone https://git.sr.ht/~thanosapollo/yeetube.el
(load-file "~/path/to/yeetube.el")
```
+- Make sure you have installed `mpv` and `yt-dlp` as well
+*Debian/Ubuntu*
+``` shell
+sudo apt install yt-dlp mpv
+```
## Contributing
diff --git a/yeetube.el b/yeetube.el
index f8be81d..a062879 100644
--- a/yeetube.el
+++ b/yeetube.el
@@ -150,12 +150,14 @@ It's recommended you keep it as the default value."
(defun yeetube-load-saved-videos ()
"Load saved videos."
(interactive)
- (let ((file-path (concat user-emacs-directory "yeetube-saved")))
- (with-temp-buffer
- (insert-file-contents file-path)
- (goto-char (point-min))
- (let ((contents (read (current-buffer))))
- (setq yeetube-saved-videos contents)))))
+ (let ((file-path (concat user-emacs-directory "yeetube")))
+ (if (file-exists-p file-path)
+ (with-temp-buffer
+ (insert-file-contents file-path)
+ (goto-char (point-min))
+ (let ((contents (read (current-buffer))))
+ (setq yeetube-saved-videos contents)))
+ (write-region "nil" nil file-path))))
(defun yeetube-save-video ()
"Save url at point."
@@ -473,8 +475,13 @@ OPERATION & WHERE are required to work with ='add-variable-watcher."
(goto-char (mark))))
(defun yeetube-update-saved-videos-list (_symbol new-value _where _environment)
- "Updated saved videos."
- (with-temp-buffer (find-file (concat user-emacs-directory "yeetube-saved"))
+ "Updated saved videos.
+
+SYMBOL-NAME is the name of the symbol to update.
+NEW-VALUE is the new value for the symbol.
+OPERATION is the operation to perform (e.g., insert or replace).
+WHERE indicates where in the buffer the update should happen."
+ (with-temp-buffer (find-file (concat user-emacs-directory "yeetube"))
(erase-buffer)
(setq yeetube-saved-videos new-value)
(insert (pp-to-string yeetube-saved-videos))