aboutsummaryrefslogtreecommitdiff
path: root/getytmd
diff options
context:
space:
mode:
Diffstat (limited to 'getytmd')
-rwxr-xr-xgetytmd8
1 files changed, 4 insertions, 4 deletions
diff --git a/getytmd b/getytmd
index 4c9a563..93cbfa4 100755
--- a/getytmd
+++ b/getytmd
@@ -1,9 +1,9 @@
-#!/bin/bash
-script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
+#!/bin/sh
+script_dir="$( cd "$( dirname "$0" )" > /dev/null 2>&1 && pwd )"
playlist=$1
-if [ "$playlist" == "" ]; then
+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'")"
@@ -15,7 +15,7 @@ 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*)"
+ 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 - ![thumb](%s)\n" "$item" "$ytid" "$thumb" >> ytlist-thumb.md
done