diff --git a/.local/bin/tutorialvids b/.local/bin/tutorialvids index 8d1dc471..fca6d918 100755 --- a/.local/bin/tutorialvids +++ b/.local/bin/tutorialvids @@ -1,26 +1,14 @@ -#!/bin/sh +#!/bin/bash -# This gives the user a list of videos they can select and watch without a -# browser. If you want to check a tutorial video, it makes it easy. I'll -# add/remove videos from this list as I go on. +CHANNEL_URL="https://www.youtube.com/@LukeSmithxyz/videos" +DATA_FILE="$HOME/.cache/lukesmithyt.tsv" -vidlist=" -dwm (window manager) https://videos.lukesmith.xyz/videos/watch/f6b78db7-b368-4647-bc64-28c08fff1988 -dwmblocks (status bar) https://videos.lukesmith.xyz/w/mmxHMbqZZEr5FManB57Yy1 -pacman (installing/managing programs) https://videos.lukesmith.xyz/videos/watch/8e7cadb9-0fed-47ce-a2a8-6635fa48614b -sxiv (image viewer) https://videos.lukesmith.xyz/videos/watch/ad4c8d85-90c3-4f3d-a1f3-89129e64a3c2 -st (terminal) https://videos.lukesmith.xyz/videos/watch/efddd39d-bac5-4599-b572-177beb4ce6e8 -i3 (old window manager) https://videos.lukesmith.xyz/videos/watch/b861525c-7ada-40ee-a2bb-b5e1ffe0f48b -neomutt (email) https://videos.lukesmith.xyz/videos/watch/83122e83-52d9-4278-ae1a-7d1beeb50c8e -ncmpcpp (music player) https://videos.lukesmith.xyz/videos/watch/b5ac6f0d-a220-4433-88e3-e98fc791dc0a -newsboat (RSS reader) https://videos.lukesmith.xyz/videos/watch/bd2c3fff-40fa-47ea-aa98-5b1ec0c903b6 -lf (file manager) https://videos.lukesmith.xyz/w/rKeHsF5ZHDNDbR1buUKB1c -zathura (pdf viewer) https://videos.lukesmith.xyz/videos/watch/c780f75a-11f6-48a9-a191-d079ebc36ea4 -gpg keys https://videos.lukesmith.xyz/videos/watch/040f5530-4830-4583-9ddc-2080b421531b -calcurse (calendar) https://videos.lukesmith.xyz/videos/watch/4b937e8b-7654-46e3-8d01-79392ec5b3d1 -urlview https://videos.lukesmith.xyz/videos/watch/31a4918f-633b-4bd6-b08e-956ac75d0324 -colorschemes with pywal https://videos.lukesmith.xyz/videos/watch/1b476003-61b2-4609-ac4b-820c3d128643 -vi mode in shell https://videos.lukesmith.xyz/videos/watch/228aa50c-836f-456f-9f0d-a45157fe4313 -pass (password manager) https://videos.lukesmith.xyz/videos/watch/432fc942-5e28-4682-9beb-f5cb237a1dd6 -" -echo "$vidlist" | grep -P "^$(echo "$vidlist" | grep "https:" | sed 's/\t.*//g' | dmenu -i -p "Learn about what? (ESC to cancel)" -l 20 | awk '{print $1}')\s" | sed 's/.*\t//' | xargs -r mpv +[ ! -f "$DATA_FILE" ] && yt-dlp -j --flat-playlist --skip-download "$CHANNEL_URL" | jq -r '[.title, .id] | @tsv' > "$DATA_FILE" + +[ "$(echo -e "No\nYes" | dmenu -i -l 2 -p "Update?")" == "Yes" ] && yt-dlp -j --flat-playlist --skip-download "$CHANNEL_URL" | jq -r '[.title, .id] | @tsv' > "$DATA_FILE" + +video_info=$(cat "$DATA_FILE") + +selected_title=$(echo "$video_info" | cut -f1 | dmenu -i -l 20 -p "Video:") + +[ -n "$selected_title" ] && mpv "https://www.youtube.com/watch?v=$(echo "$video_info" | grep -Fw "$selected_title" | cut -f2)"