diff options
Diffstat (limited to 'yeetube.el')
-rw-r--r-- | yeetube.el | 46 |
1 files changed, 23 insertions, 23 deletions
@@ -1,11 +1,11 @@ -;;; yeetube.el --- Scrape YouTube - Play with mpv & Download with yt-dlp | -*- lexical-binding: t; -*- +;;; yeetube.el --- Scrape YouTube, Play with mpv & Download with yt-dlp -*- lexical-binding: t; -*- ;; Copyright (C) 2023-2024 Thanos Apollo ;; Author: Thanos Apollo <[email protected]> ;; Keywords: extensions youtube videos ;; URL: https://thanosapollo.org/projects/yeetube/ -;; Version: 2.1.6 +;; Version: 2.1.7 ;; Package-Requires: ((emacs "27.2") (compat "29.1.4.2")) @@ -29,10 +29,10 @@ ;; ;; Core features include: ;; -;; - Executing queries on YouTube -;; - Playing video URLs using default mpv -;; - Bookmark/Save video url for future reference -;; - Download video using yt-dlp +;; - Executing YouTube queries +;; - Playing videos, by default using MPV +;; - Downloading videos, using yt-dlp +;; - Bookmarking and saving video URLs ;; - A standalone, minimalist yt-dlp frontend ;;; Code: @@ -412,18 +412,18 @@ Image is inserted in BUFFER for ENTRY." (if yeetube-filter (format "&sp=%s" (yeetube-get-filter-code yeetube-filter)) "")))) (defun yeetube-channel-id-at-point () - "Return the channel name for the video at point." - (if-let ((entry (tabulated-list-get-entry))) - (get-text-property 0 :channel-id (aref entry 4)) - (error "No video at point"))) - -(defun yeetube-channel-videos (channel-id) - "View (some) videos for the channel with CHANNEL-ID." - (interactive (list (yeetube-channel-id-at-point))) + "Return yeetube channel id at point." + (if-let ((id (tabulated-list-get-id))) + (get-text-property 0 :channel-id (plist-get id :channel)) + (user-error "No video at point"))) + +(defun yeetube-channel-videos (&optional channel-id) + "View videos for the channel with CHANNEL-ID." + (interactive (list (or (yeetube-channel-id-at-point) (format "@%s" (read-string "Channel: "))))) (yeetube-display-content-from-url (format "https://youtube.com/%s/videos" channel-id))) (defun yeetube-channel-search (channel-id query) - "Search channel with CHANNEL-ID for vidoes matching QUERY." + "Search channel with CHANNEL-ID for videoes matching QUERY." (interactive (list (yeetube-channel-id-at-point) (yeetube-read-query))) (yeetube-display-content-from-url (format "https://youtube.com/%s/search?query=%s" @@ -680,27 +680,27 @@ FIELDS-FACE-PAIRS is a list of fields and faces." (let ((thumbnail-width (or thumbnail-width (/ (window-width) 10))) (title-width (or title-width (/ (window-width) 3))) (channel-width (or channel-width (/ (window-width) 8))) - (views-width (or views-width (/ (window-width) 8))) - (duration-width (or duration-width (/ (window-width) 8))) + (views-width (or views-width (/ (window-width) 10))) + (duration-width (or duration-width (/ (window-width) 10))) (date-width (or date-width (/ (window-width) 8)))) (setf tabulated-list-format - `[("Title" ,title-width t) + `[("Thumbnail" ,thumbnail-width nil) + ("Title" ,title-width t) ("Views" ,views-width yeetube--sort-views) ("Duration" ,duration-width yeetube--sort-duration) ("Date" ,date-width yeetube--sort-date) - ("Channel" ,channel-width t) - ("Thumbnail" ,thumbnail-width nil)] + ("Channel" ,channel-width t)] tabulated-list-entries (cl-map 'list (lambda (content) (list content (yeetube-propertize-vector content - :title 'yeetube-face-title + :image nil + :title 'yeetube-face-title :view-count 'yeetube-face-view-count :duration 'yeetube-face-duration :date 'yeetube-face-date - :channel 'yeetube-face-channel - :image nil))) + :channel 'yeetube-face-channel))) yeetube-content) tabulated-list-sort-key (cons yeetube-default-sort-column yeetube-default-sort-ascending)) |