made markdown generator

This commit is contained in:
iceyrazor 2025-06-17 03:38:49 -05:00
parent 796b4c064f
commit e344210ada
2 changed files with 26 additions and 0 deletions

View File

@ -30,6 +30,11 @@ that should pretty much do everything.
- if you want to de a specific "category" or playlist. do ``getyt playlistname``
- if you want too then delete download.txt and download_err.txt and thumberr.txt
# getytmd
generates a md file of the whole db or a category. one with thumbnails and one without.
intended to be used with neovim ``markdown preview`` + ``3rd image``. but anything that can view a markdown file and load the thumbnails is fine. even a browser md viewer.
``getytmd playlistname[optional]``
# config
- In ``getyt`` there is the preview lines and columns. Idk if I can autodetect this because something something fzf doesn't do something something
- If you want to change anything else you would have to change the script. Feel free to make your own config system

21
getytmd Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
playlist=$1
if [ "$playlist" == "" ]; then
ytid_arr="$(sqlite3 "$script_dir/youtube_stuffs.db" "select id from ytlist")"
else
ytid_arr="$(sqlite3 "$script_dir/youtube_stuffs.db" "select id from ytlist where category='$playlist'")"
fi
printf "# yt list gen\n\n" > ytlist.md
printf "# yt list gen\n\n" > ytlist-thumb.md
for ytid in $ytid_arr; do
item="$(sqlite3 -- "$script_dir/youtube_stuffs.db" "select rowid,title from ytlist where id='$ytid'" | sed 's/*/\\*/g')"
thumb="$(find -- $script_dir/thumbnails/$ytid*)"
printf -- "- [%s](https://youtube.com/watch?v=%s)\n" "$item" "$ytid" >> ytlist.md
printf -- "- [%s](https://youtube.com/watch?v=%s) ![thumb](%s)\n" "$item" "$ytid" "$thumb" >> ytlist-thumb.md
done