made markdown generator
This commit is contained in:
parent
796b4c064f
commit
882a75c50c
|
@ -30,6 +30,13 @@ 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
|
||||
|
|
|
@ -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) \n" "$item" "$ytid" "$thumb" >> ytlist-thumb.md
|
||||
done
|
Loading…
Reference in New Issue