mirror of
https://github.com/Radiquum/furaffinity-dl.git
synced 2025-04-06 00:04:38 +00:00
Address #24
Don't redownload files if they have already been downloaded Also added media file to .gitignore to prevent accidently commiting media
This commit is contained in:
parent
e29cbe22e9
commit
020f10502b
2 changed files with 35 additions and 12 deletions
18
.gitignore
vendored
18
.gitignore
vendored
|
@ -1,2 +1,18 @@
|
||||||
|
# Pictures
|
||||||
|
*.jpg
|
||||||
|
*.png
|
||||||
|
*.bmp
|
||||||
|
*.gif
|
||||||
|
# Audio
|
||||||
|
*.mp3
|
||||||
|
*.wav
|
||||||
|
*.wmv
|
||||||
|
# Flash
|
||||||
|
*.swf
|
||||||
|
# Documents
|
||||||
|
*.txt
|
||||||
|
*.pdf
|
||||||
|
*.doc
|
||||||
|
*.docx
|
||||||
|
# Swap files
|
||||||
*.swp
|
*.swp
|
||||||
|
|
|
@ -30,6 +30,7 @@ Arguments:
|
||||||
filename as on facdn
|
filename as on facdn
|
||||||
-n (N)unmber of images to download, starting from
|
-n (N)unmber of images to download, starting from
|
||||||
the most recent submission
|
the most recent submission
|
||||||
|
-w Over(Write) files if they already exist
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
$0 gallery/mylafox
|
$0 gallery/mylafox
|
||||||
|
@ -54,17 +55,19 @@ prefix="https:"
|
||||||
metadata=true
|
metadata=true
|
||||||
rename=true
|
rename=true
|
||||||
maxsavefiles="0"
|
maxsavefiles="0"
|
||||||
|
overwrite=false
|
||||||
while getopts 'o:c:iphrn:' flag; do
|
while getopts 'o:c:iphrn:' flag; do
|
||||||
case "${flag}" in
|
case "${flag}" in
|
||||||
o) outdir=${OPTARG};;
|
w) overwrite=true;;
|
||||||
c) cookiefile=${OPTARG};;
|
o) outdir=${OPTARG};;
|
||||||
i) prefix="http:";;
|
c) cookiefile=${OPTARG};;
|
||||||
p) metadata=false;;
|
i) prefix="http:";;
|
||||||
r) rename=false;;
|
p) metadata=false;;
|
||||||
n) maxsavefiles=${OPTARG};;
|
r) rename=false;;
|
||||||
h) help;;
|
n) maxsavefiles=${OPTARG};;
|
||||||
*) help;;
|
h) help;;
|
||||||
esac
|
*) help;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# Attempt to create the output directory
|
# Attempt to create the output directory
|
||||||
|
@ -146,7 +149,11 @@ https://github.com/Xerbo/furaffinity-dl/issues" >&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Download the image
|
# Download the image
|
||||||
wget "$image_url" -O "$file"
|
if [ ! -f "$file" ] || [ $overwrite = true ] ; then
|
||||||
|
wget "$image_url" -O "$file"
|
||||||
|
else
|
||||||
|
echo "File already exists, skipping. Use -w to skip this check"
|
||||||
|
fi
|
||||||
|
|
||||||
# Add metadata
|
# Add metadata
|
||||||
if [ $file_type == "mp3" ] || [ $file_type == "wav" ] || [ $file_type == "wmv" ] || [ $file_type == "ogg" ] || [ $file_type == "flac" ]; then
|
if [ $file_type == "mp3" ] || [ $file_type == "wav" ] || [ $file_type == "wmv" ] || [ $file_type == "ogg" ] || [ $file_type == "flac" ]; then
|
||||||
|
|
Loading…
Add table
Reference in a new issue