i thiiiiink download_file_list be workan-ish

This commit is contained in:
2025-08-19 22:54:33 -06:00
parent 810a6cda86
commit 4dad8c57c0
2 changed files with 10 additions and 5 deletions
+1
View File
@@ -40,6 +40,7 @@ Install customscripts on linux with
* `pyenv_setup`
* `xrdp-start`
* `add_apache2_site`
* `download_file_list`
### Windowwz
#### git helpers
+9 -5
View File
@@ -1,7 +1,8 @@
#!/bin/bash
# manually created arrays for file types and extensions
types_arr=('MPEG' 'JPEG' 'PNG' 'GIF' 'WebM' 'RIFF')
exts_arr=('mp4' 'jpg' 'png' 'gif' 'webm' 'webp')
## notes: from twitter downloader mp4 files show as ISO?
types_arr=('MPEG' 'ISO' 'JPEG' 'PNG' 'GIF' 'WebM' 'RIFF')
exts_arr=('mp4' 'mp4' 'jpg' 'png' 'gif' 'webm' 'webp')
tmp_file="$1/download.tmp"
# check for existance of $1 or if $2 is a file
@@ -20,8 +21,11 @@ fi
# read the input file and loop through it
cat "$2" | \
while read line; do
# get default basename of downloaded file
file_basename=$(basename "$line")
# download the file to a tmp
echo "Downloading $line to $1"
echo "Downloading $line to $1/$file_basename"
curl -s -o "$tmp_file" "$line"
# get the file type
@@ -39,11 +43,11 @@ cat "$2" | \
if [[ "$item" == "$type" ]]; then
# rename the downloaded file
new_name="$1/$namehash.$(echo ${exts_arr[$count]})"
echo "Renaming $tmp_file to $new_name"
echo -e "\tRenaming $file_basename to $new_name\n"
mv "$tmp_file" "$new_name"
fi
else
echo "$(basename $line) not a supported format: $type! Deleting"
echo -e "\n$file_basename not a supported format: $(file $tmp_file)! Deleting\n"
rm -f "$tmp_file"
fi