aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md7
-rwxr-xr-xgetytmd21
2 files changed, 28 insertions, 0 deletions
diff --git a/README.md b/README.md
index 1a58c7d..d81106d 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/getytmd b/getytmd
new file mode 100755
index 0000000..1f6c07a
--- /dev/null
+++ b/getytmd
@@ -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