From 63fa469e2578810acb7e1b9fbb6ed100d3c51adb Mon Sep 17 00:00:00 2001 From: The-Repo-Club Date: Thu, 20 Oct 2022 15:28:42 +0100 Subject: [PATCH] Update --- ckb-next/.config/ckb-next/ckb-next.conf | 16 +- dconf/.config/dconf/user | Bin 11696 -> 11696 bytes fzf/.config/fzf/fzf-desktop.db | Bin 0 -> 8192 bytes fzf/.config/fzf/subs.ini | 39 ++++ fzf/.local/bin/fzf/fzf_youtube_subs | 269 ++++++++++++++++++++++++ i3/.config/i3/config | 2 +- localbin/.local/bin/autostart | 2 +- 7 files changed, 318 insertions(+), 10 deletions(-) create mode 100644 fzf/.config/fzf/fzf-desktop.db create mode 100644 fzf/.config/fzf/subs.ini create mode 100755 fzf/.local/bin/fzf/fzf_youtube_subs diff --git a/ckb-next/.config/ckb-next/ckb-next.conf b/ckb-next/.config/ckb-next/ckb-next.conf index e88e3dc94..12afe40e4 100644 --- a/ckb-next/.config/ckb-next/ckb-next.conf +++ b/ckb-next/.config/ckb-next/ckb-next.conf @@ -197,7 +197,7 @@ 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\0\Lighting\Keys\y=#ffffff 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\0\Lighting\Keys\z=#ffffff 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\0\Lighting\UseRealNames=true -0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\0\Modified=4364c31b +0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\0\Modified=3508de03 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\0\Name=Rainbow 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\0\Performance\AngleSnap=false 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\0\Performance\DPI\0=@Point(400 400) @@ -425,7 +425,7 @@ 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\1\Lighting\Keys\y=#ff0000 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\1\Lighting\Keys\z=#ff0000 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\1\Lighting\UseRealNames=true -0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\1\Modified=a0be9872 +0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\1\Modified=57083d7b 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\1\Name=Breathing 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\1\Performance\AngleSnap=false 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\1\Performance\DPI\0=@Point(400 400) @@ -675,7 +675,7 @@ 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\2\Lighting\Keys\y=#aa00ff 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\2\Lighting\Keys\z=#aa00ff 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\2\Lighting\UseRealNames=true -0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\2\Modified=c1cb8216 +0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\2\Modified=7ecd7df4 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\2\Name=Trippy 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\2\Performance\AngleSnap=false 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\2\Performance\DPI\0=@Point(400 400) @@ -733,7 +733,7 @@ 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\CurrentMode={51EB6E3A-27A0-4AD6-A35C-6B67E0329A3D} 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\HwModified=7ffd 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\ModeCount=3 -0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\Modified=1975e830 +0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\Modified=9777d5f0 0E029022AF4C18835CBDCC7EF5001BC3\%7B5B1E2E81-ED4F-4F79-9EB5-F8ACA67D1BF0%7D\Name=Multi 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\0\Binding\KeyMap=K68 GB 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\0\Binding\UseRealNames=true @@ -929,7 +929,7 @@ 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\0\Lighting\Keys\y=#ffffff 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\0\Lighting\Keys\z=#ffffff 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\0\Lighting\UseRealNames=true -0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\0\Modified=442a1fae +0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\0\Modified=ec072167 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\0\Name=Rainbow 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\0\Performance\AngleSnap=false 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\0\Performance\DPI\0=@Point(400 400) @@ -1157,7 +1157,7 @@ 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\1\Lighting\Keys\y=#ff0000 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\1\Lighting\Keys\z=#ff0000 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\1\Lighting\UseRealNames=true -0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\1\Modified=cdb0408f +0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\1\Modified=3104239e 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\1\Name=Breathing 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\1\Performance\AngleSnap=false 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\1\Performance\DPI\0=@Point(400 400) @@ -1407,7 +1407,7 @@ 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\2\Lighting\Keys\y=#aa00ff 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\2\Lighting\Keys\z=#aa00ff 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\2\Lighting\UseRealNames=true -0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\2\Modified=f70d32f9 +0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\2\Modified=b1ce4fea 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\2\Name=Trippy 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\2\Performance\AngleSnap=false 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\2\Performance\DPI\0=@Point(400 400) @@ -1465,7 +1465,7 @@ 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\CurrentMode={11C11AE3-3195-4DFC-B8AC-2FEA703414E5} 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\HwModified=40b6f054 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\ModeCount=3 -0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\Modified=1b741e2a +0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\Modified=79fc734f 0E029022AF4C18835CBDCC7EF5001BC3\%7BBA7FC152-2D51-4C26-A7A6-A036CC93D924%7D\Name=Demo [Popups] diff --git a/dconf/.config/dconf/user b/dconf/.config/dconf/user index 8a3a71ed6311716837a3bc0674fb7e85ccade15b..0573cdfd6a4180dd8d5f0ee626020ffdcd65934a 100644 GIT binary patch delta 196 zcmdlGy&-yo18<;>*W;od1_p++iVO@a3}p;Afb;_(-XqeZoeUHQv1Neb3`z_P%s^aI zH*ep1pg4%l!{Eap0HkGrcy9oIqXtl1X7fZ|W=6)m%~Sc(Ss3#s{}mDkazurd`51F2 zTPjXrPpwD=nLGK7qP}EWW=^VZQGQNNYLPy}Dxhc;5U&KuN-N21wov-P$h3)hvyn<3 aGh@!?h3frGOsAM98)^LmnrNt9&jbKn5i%eE delta 196 zcmdlGy&-yo18-nW-MoG485kJODl#zeF!(Us0n#sk*v9K|Q4dfY#AabAWB351e*p0w zksj@2pg4#v0~D7~VqlO4;=KXCF>)nHd>#Hc#bCXJO2l{8vaE$PpD*=3~s8 zY^gX!J}omRRktWVCnvQ?AEDlhMPfJ(Wt!^K=vz3fRRW@cKqJDaQx`f{EioZku7M10BI`qGE^cH^z0tg_000Iag zfB*srAbd3n*1;r-^yKo(y=dC94%6Emk~m8&i??ZF;l*ax`dK+EE4Q$`Y0MQb fHxIkHU-}6G2q1s}0tg_000IagfB*sr{IS3XN`4zH literal 0 HcmV?d00001 diff --git a/fzf/.config/fzf/subs.ini b/fzf/.config/fzf/subs.ini new file mode 100644 index 000000000..5fcb89971 --- /dev/null +++ b/fzf/.config/fzf/subs.ini @@ -0,0 +1,39 @@ +# Linux +UCVls1GmFKf6WlTraIb_IaJg # DistroTube +UC2eYFnH61tmytImy1mTYvhA # Luke Smith +UCld68syR8Wi-GY_n4CaoJGA # Brodie Robertson +UCg6gPGh8HU2U01vaFCAsvmQ # Chris Titus Tech +UCCIHOP7e271SIumQgyl6XBQ # OldTechBloke +UCJdmdUp5BrsWsYVQUylCMLg # Erik Dubois +UCdGFLV7h9RGeTUX7wa5rqGw # Manjaro Linux +UCoryWpk4QVYKFCJul9KBdyw # Switched to Linux +UC5UAwBUum7CPN5buc-_N1Fw # The Linux Experiment +UCX_WM2O-X96URC5n66G-hvw # EF Linux +UCZiL6BoryLWxyapUuVYW27g # Average Linux User +UCylGUf9BvQooEFjgdNudoQg # The Linux Cast +UC8ENHE5xdFSwx71u3fDH5Xw # ThePrimeagen +UCRE3NFNtdjR96-H4QG4U1Fg # HexDSL +# UCfp-lNJy4QkIGnaEE6NtDSg # Terminal For Life +UCmw-QGOHbHA5cDAvwwqUTKQ # Zaney + +#Minecraft +UChFur_NwVSbUozOcF_F2kMg # MumboJumbo +UC_GQ4mac4oN3wl1UdbFuTEA # ibxToyCat +UCRlEFn0L2G_DktbyvN0AZ5A # WadZee +UC9mvRrl9o7rG65ABsGVvDBw # Mysticat +UCuMJPFqazQI4SofSFEd-5zA # impulseSV + +#Spirit +UC_8fJz5gAnhRqZ740QXlzmw # Jen McCarty +UCAk3t7WHs2zjsZpopox8Taw # Jonna Jinton + +#Meditations +UCUSzc8BHGJPaYt0DjvscIzw # Woke Nation +UCM7XCXnxtYJkkMN0zf0tsSw # Meditation And Healing + +#Music +UCMvETSFFkMOADyrGBj3gbWA # NerdOut +UCXBcDYUr89ImtOLYaHPiiPg # Marcus Veltri + +# Myself +UCuKJ0LqxI8t2a9ATl1rWBGA # Myself diff --git a/fzf/.local/bin/fzf/fzf_youtube_subs b/fzf/.local/bin/fzf/fzf_youtube_subs new file mode 100755 index 000000000..ce055b5ad --- /dev/null +++ b/fzf/.local/bin/fzf/fzf_youtube_subs @@ -0,0 +1,269 @@ +#!/usr/bin/env bash +#-*-coding:utf-8 -*- +#Auto updated? +# Yes +#File: +# fzf_youtube_subs +#Author: +# The-Repo-Club [wayne6324@gmail.com] +#Github: +# https://github.com/The-Repo-Club/ +# +#Created: +# Sun 03 January 2021, 05:09:33 PM [GMT] +#Modified: +# Thu 20 October 2022, 03:27:18 PM [GMT+1] +# +#Description: +# Watch your youtube subscriptions without a youtube account +# via curl, fzf, browser and basic unix commands. +# +# The $SUBS_FILE is a text file containing usernames or channel IDs +# comments and blank lines are ignored. +# +# +#Dependencies: +# fzf +# + +fzf_menu() { + fzf --prompt="Select a video: " --border=rounded --margin=1% --color=dark --height 100% --reverse --header=" YOUTUBE SUBS MENU " --info=hidden --header-first +} + +# -/-/-/-/- Settings -/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/ +: "${SUBS_FILE:=${HOME}/.config/fzf/subs.ini}" +: "${SUBS_MENU_PROG:=fzf_menu}" +: "${SUBS:=${HOME}/.cache/subs}" +: "${SUBS_LINKS:=$SUBS/links}" +: "${SUBS_OPEN:=$(repo-exec videoplayer)}" +: "${SUBS_CACHE:=$SUBS/cache}" +: "${SUBS_SLEEP_VALUE:=0.05}" # raise this if you experience problems +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +SEP=^^^^^ # shouldn't need to change this +# -/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/ + +die() { + printf >&2 '%s\n' "$*" + exit 1 +} + +usage() { + die 'Usage: fzf_youtube_subs [-c cat_subs] [-g gen_links] [-u update_subs] [-d daemonize]' +} + +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +# Synopsis: $SUBS_FILE [txt] -> $SUBS_LINKS [xml links] +# +# Updates local cache of xml subscription links from the +# subscription file containing either usernames or channel ids. +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +gen_links() { + : >"$SUBS_LINKS" + + count=0 + total=$(sed -e '/^$/d' -e '/^#/d' <"$SUBS_FILE" | wc -l) + + while read -r line; do + + # ignore comments and blank lines + case $line in '' | ' ' | '#'*) continue ;; esac + + # strip off in-line comments and any trailing whitespace + line=${line%%#*} + line=${line%% *} + + count=$((count + 1)) + + case $line in + UC*) + # YT channel IDs always begin with 'UC' and are 24 chars long + printf "[%s/%s] using channel ID '%s' for xml link\n" "$count" "$total" "$line" + + [ ${#line} -eq 24 ] && + printf 'https://youtube.com/feeds/videos.xml?%s\n' \ + "channel_id=$line" >>"$SUBS_LINKS" + ;; + *) + # otherwise we are given a username, we must find out its channel ID + printf "fetching channel ID for %s...\n" "$line" + + curl -sfL --retry 10 "https://youtube.com/user/$line/about" | + while read -r line; do + case $line in + *channel/UC??????????????????????*) + line=${line##*channel/} + line=${line%%\"*} + printf "[%s/%s] using channel ID '%s' for xml link\n" "$count" "$total" "$line" + printf 'https://youtube.com/feeds/videos.xml?channel_id=%s\n' \ + "$line" >>"$SUBS_LINKS" + break + ;; + esac + done & + sleep "${SUBS_SLEEP_VALUE:-0}" + ;; + esac + + done <"$SUBS_FILE" + + count=0 + while [ "$count" -ne "$total" ]; do + count=$(wc -l <"$SUBS_LINKS") + printf "[%s/%s] waiting for jobs to complete...\n" "$count" "$total" + sleep 0.5 + done +} + +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +# Synopsis: $1 [LINK] -> $SUBS_CACHE/$chan_name/concat [CHANNEL INFO] +# +# Takes a channel rss feed link and creates a file +# with a line of its videos dates, titles, and urls. +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +get_vids() { + data=$(curl -sfL --retry 15 "$1") + + # hide the first tag which is the channel + # creation date + data=${data#*\<\/published\>} + + # trim off outer tags + chan=${data%%} + + printf "%s\n" "$data" | + while read -r line; do + case $line in + *'link rel='*) + line=${line#*href=\"} + line=${line%\"/\>} + line=https://${line#*www.} + url=$line + ;; + *''*) + line=${line%+00:*} + line=${line#*} + date=$line + ;; + *''*) + line=${line%} + title=$line + printf '%s\n' \ + "${date}${SEP}${chan}${SEP}${title}${SEP}${url}" \ + >>"$SUBS_CACHE/$chan" + ;; + esac + done +} + +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +# Updates the local cache of subscriptions. ([-u] flag) +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +update_subs() { + [ -f "$SUBS_LINKS" ] || die 'Subs links have not been generated.' + + rm -r "${SUBS_CACHE:-?}" 2>/dev/null || : + mkdir -p "$SUBS_CACHE" + + total=$(wc -l <"$SUBS_LINKS") + + count=0 + while read -r link; do + count=$((count + 1)) + printf 'starting job [%s/%s] for %s\n' "$count" "$total" "$link" + get_vids "$link" & + sleep "${SUBS_SLEEP_VALUE:-0}" + done <"$SUBS_LINKS" + + count=0 + while [ "$count" -ne "$total" ]; do + count=$(printf '%s\n' "$SUBS_CACHE"/* | wc -l) + printf "[%s/%s] waiting for fetch jobs to complete...\n" "$count" "$total" + sleep 0.5 + done + + printf '%s\n\n' 'done!' +} + +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +# Grab current cache of subscriptions, sort by date uploaded +# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +cat_subs() { + sort -r "$SUBS_CACHE"/* | + while read -r line; do + chan=${line#*$SEP} + chan=${chan%%$SEP*} + title=${line#*$chan$SEP} + title=${title%%$SEP*} + date=${line%%$SEP*} + date=${date#*-} + date=${date%T*} + printf '[%s %s] %s\n' "$date" "$chan" "$title" + done +} + +# Split the concatenated lines into entities, send to menu program. +# Finally, play the result with mpv. +get_sel() { + if [ -d "$SUBS_CACHE" ]; then + sel=$(cat_subs | $SUBS_MENU_PROG) + else + die 'Subs cache has not been retrieved.' + fi + + [ "$sel" ] || die Interrupted + + chan="${sel#* }" + chan="${chan%%] *}" + title=${sel#*"$chan"\] } + while read -r line; do + case $line in + *"$SEP$title$SEP"*) + url=${line##*$SEP} + if [ "$url" ]; then + printf 'playing: %s\n' "$url" + # Play the selection. + # shellcheck disable=2086 + exec devour $SUBS_OPEN "$url" + fi + break + ;; + esac + done <"$SUBS_CACHE/$chan" +} + +daemonize() { + # create a cached copy of the subs file to check for changes + # if changes occur, re-generate links automatically + daemon_file=${HOME}/.cache/subs_daemon.cache + if [ ! -f "$daemon_file" ]; then + cp -f "${SUBS_FILE:=${HOME}/.config/fzf/subs.ini}" "$daemon_file" + fi + + while true; do + if ! cmp "${SUBS_FILE:=${HOME}/.config/fzf/subs.ini}" "$daemon_file"; then + cp -f "${SUBS_FILE:=${HOME}/.config/fzf/subs.ini}" "$daemon_file" + fi + gen_links + update_subs + interval=${SUBS_DAEMON_INTERVAL:-$((10 * 60))} + printf 'Sleeping for %s seconds...\n' "$interval" + sleep "$interval" + done +} + +main() { + mkdir -p "$SUBS" + + case ${1#-} in + h) usage ;; + g) gen_links ;; + u) update_subs ;; + c) cat_subs ;; + d) daemonize ;; + *) get_sel ;; + esac +} + +main "$@" diff --git a/i3/.config/i3/config b/i3/.config/i3/config index a1e4454bd..ad054c4eb 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -878,7 +878,7 @@ $exe autostart # {{{ Settings -$exe repomenue_youtube_subs -d +$exe fzf_youtube_subs -d # setting variables for later use # use xrandr and/or arandr to know the names of your monitors diff --git a/localbin/.local/bin/autostart b/localbin/.local/bin/autostart index 219d35c98..15503c0be 100755 --- a/localbin/.local/bin/autostart +++ b/localbin/.local/bin/autostart @@ -12,7 +12,7 @@ #Created: # Mon 22 November 2021, 03:15:54 PM [GMT+1] #Modified: -# Sun 16 October 2022, 05:05:58 PM [GMT+1] +# Thu 20 October 2022, 03:26:36 PM [GMT+1] # #Description: #