diff --git a/README.md b/README.md index 7658856..35ffcc2 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ Install customscripts on linux with * `pyenv_setup` * `xrdp-start` * `add_apache2_site` +* `download_file_list` ### Windowwz #### git helpers diff --git a/customscripts/download_file_list b/customscripts/download_file_list index 04dcaf9..245c9fe 100644 --- a/customscripts/download_file_list +++ b/customscripts/download_file_list @@ -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