Fix pathes in gdl-update-todo.sh script

This commit is contained in:
Matheus Albino
2024-08-11 12:16:16 -03:00
parent e5e4128458
commit c200535990

View File

@@ -4,7 +4,7 @@
show_help() {
# echo "Usage: `basename $0` [--no-abort-on-found] [--parallel] [--custom-grep-search|-c <string>]"
echo "Usage: `basename $0` [--custom-grep-search|-c <string>]"
echo "Usage: $(basename $0) [--custom-grep-search|-c <string>]"
echo "Options:"
echo " --no-abort-on-found (optional) The script will not update each gallery download until it finds an already downloaded file."
echo " --no-parallel (optional) The script will update the found URLs in sequence"
@@ -18,18 +18,32 @@ custom_grep_search=''
while [ "$#" -gt 0 ]; do
case "$1" in
--help|-h) show_help; exit ;;
--no-abort-on-found) should_abort_on_found=false; shift ;;
--no-parallel|-n) parallel=false; shift ;;
--custom-grep-search|-c) custom_grep_search="$2"; shift 2 ;;
*) shift ;;
--help | -h)
show_help
exit
;;
--no-abort-on-found)
should_abort_on_found=false
shift
;;
--no-parallel | -n)
parallel=false
shift
;;
--custom-grep-search | -c)
custom_grep_search="$2"
shift 2
;;
*) shift ;;
esac
done
gallery_dl_path=/mnt/e/home/documents/data-hoarding
cd "$gallery_dl_path"
urls=($(grep -v "filter" -i "$gallery_dl_path/todo.md" | grep -Eo "(mastodon:)?(http|https)://[a-zA-Z0-9.(/~@)?=_%:-]*"))
todo_md_filepath='/mnt/e/home/clouds/google-drive/obsidian-vaults/notes/idk/furry/cool-artists.md'
urls=($(grep -v "filter" -i "$todo_md_filepath" | grep -Eo "(mastodon:)?(http|https)://[a-zA-Z0-9.(/~@)?=_%:-]*"))
if [ ! -z "$custom_grep_search" ]; then
filtered_urls=()
@@ -119,12 +133,15 @@ if false; then
echo " $command_to_run"
done
exit 0
fi
if $should_use_tmux; then
session_name="tmp_gdl-update-todo-`uuidgen | sed 's/[-]//g' | head -c 10; echo;`"
session_name="tmp_gdl-update-todo-$(
uuidgen | sed 's/[-]//g' | head -c 10
echo
)"
tmux new-session -d -s $session_name
@@ -135,7 +152,7 @@ if $should_use_tmux; then
for ((i = 0; i < ${#commands_list[@]}; i++)); do
command_to_run="${commands_list[$i]}"
if [ "$i" -eq 0 ] || [ $(( i % 4 )) -eq 0 ]; then
if [ "$i" -eq 0 ] || [ $((i % 4)) -eq 0 ]; then
if [ "$i" -ne 0 ]; then
tmux new-window -t $session_name
fi