diff options
Diffstat (limited to 'livie.el')
-rw-r--r-- | livie.el | 50 |
1 files changed, 25 insertions, 25 deletions
@@ -59,16 +59,16 @@ :group 'livie) (defvar livie--insert-functions '((video . livie--insert-video) - (playlist . livie--insert-playlist) - (channel . livie--insert-channel))) + (playlist . livie--insert-playlist) + (channel . livie--insert-channel))) (defvar livie--default-action-functions '((video . livie--default-video-action) - (playlist . livie--default-playlist-action) - (channel . livie--default-channel-action)) + (playlist . livie--default-playlist-action) + (channel . livie--default-channel-action)) "Functions to call on an entry. To modify an action, set the appropiate variable instead.") (defvar livie--default-video-action #'(lambda () - (message (livie-video-title (livie-get-current-video)))) + (message (livie-video-title (livie-get-current-video)))) "Action to open a video. By default it just prints the title to the minibuffer.") (defvar livie--default-playlist-action #'livie--open-playlist @@ -383,7 +383,7 @@ too long)." "Switch to the next page of the current search. Redraw the buffer." (interactive) (setf livie-videos (livie--process-results (livie--query livie-search-term - (1+ livie-current-page)))) + (1+ livie-current-page)))) (setf livie-current-page (1+ livie-current-page)) (livie--draw-buffer)) @@ -392,7 +392,7 @@ too long)." (interactive) (when (> livie-current-page 1) (setf livie-videos (livie--process-results (livie--query livie-search-term - (1- livie-current-page)))) + (1- livie-current-page)))) (setf livie-current-page (1- livie-current-page)) (livie--draw-buffer))) @@ -533,7 +533,7 @@ If ARG is given, format it as a Invidious RSS feed." ;; Maybe type should be part of the struct. (cl-defstruct (livie-channel (:constructor livie-channel--create) - (:copier nil)) + (:copier nil)) "Information about a Youtube channel." (author "" :read-only t) (authorId "" :read-only t) @@ -541,7 +541,7 @@ If ARG is given, format it as a Invidious RSS feed." (videoCount 0 :read-only t)) (cl-defstruct (livie-playlist (:constructor livie-playlist--create) - (:copier nil)) + (:copier nil)) "Information about a Youtube playlist." (title "" :read-only t) (playlistId "" :read-only t) @@ -567,22 +567,22 @@ zero exit code otherwise the request body is parsed by `json-read' and returned. (json-read)))) (defun livie--query (string n) -"Query youtube for STRING, return the Nth page of results." -(let ((results (livie--API-call "search" `(("q" ,string) - ("sort_by" ,(symbol-name livie-sort-criterion)) - ("type" ,livie-type-of-results) - ("page" ,n) - ("fields" ,(pcase livie-type-of-results - ("video" livie-default-video-query-fields) - ("playlist" livie-default-playlist-query-fields) - ("channel" livie-default-channel-query-fields) - ;; I mean, it does get the job done... fix later. - ("all" (concat livie-default-channel-query-fields - "," - livie-default-playlist-query-fields - "," - livie-default-video-query-fields)))))))) - results)) + "Query youtube for STRING, return the Nth page of results." + (let ((results (livie--API-call "search" `(("q" ,string) + ("sort_by" ,(symbol-name livie-sort-criterion)) + ("type" ,livie-type-of-results) + ("page" ,n) + ("fields" ,(pcase livie-type-of-results + ("video" livie-default-video-query-fields) + ("playlist" livie-default-playlist-query-fields) + ("channel" livie-default-channel-query-fields) + ;; I mean, it does get the job done... fix later. + ("all" (concat livie-default-channel-query-fields + "," + livie-default-playlist-query-fields + "," + livie-default-video-query-fields)))))))) + results)) (defun livie--process-results (results &optional type) "Process RESULTS and turn them into objects, is TYPE is not given, get it from RESULTS." |