Compare commits
5 Commits
main
...
42306e4287
Author | SHA1 | Date | |
---|---|---|---|
42306e4287 | |||
f3cb825981 | |||
1db8c0b7b0 | |||
116087928d | |||
b6e820570f |
@@ -60,7 +60,8 @@ while getopts ":s:l:rfFdcAhx" opt; do
|
||||
F) super_force="Y" ;;
|
||||
d) delete="Y" ;;
|
||||
c) clean="Y" ;;
|
||||
A) recurse="Y" && search="find" && force="Y" && delete="Y" && clean="Y" ;;
|
||||
e) expand="Y" ;;
|
||||
A) recurse="Y" && search="find" && force="Y" && delete="Y" && expand="Y" ;;
|
||||
h) usage 0 ;;
|
||||
x) set -x ;;
|
||||
*) echo "ERROR: Option $OPTARG not recognized." >&2 && usage 1 ;;
|
||||
@@ -74,7 +75,7 @@ if [[ -n "$in_size" && "$size" != "$in_size" ]]; then
|
||||
usage 1
|
||||
fi
|
||||
|
||||
convert_exe="`which convert`"
|
||||
convert_exe="`which convert` -strip"
|
||||
if [[ "$convert_exe" == "" ]]; then
|
||||
echo "ERROR: 'convert' command could not be found, "
|
||||
echo "please install 'imagemagick'."
|
||||
@@ -123,13 +124,31 @@ $search "$location" | sort | while read image; do
|
||||
new_image_clean="${new_image_clean//-/}"
|
||||
new_image_clean="${new_image_clean// /}"
|
||||
|
||||
# Add directory back to the full path.
|
||||
## Expanded Filename ##
|
||||
# Add back in the dashes so that the year, month, date, and time are exposed.
|
||||
TEMP="$new_image_clean"
|
||||
# Date Data
|
||||
new_image_exp="${TEMP:0:4}-${TEMP:4:2}-${TEMP:6:2}"
|
||||
# Time Data
|
||||
new_image_exp="${new_image_exp}_${TEMP:8:2}-${TEMP:10:2}-${TEMP:12:2}"
|
||||
# Remainder Data
|
||||
if [[ "${TEMP:14:1}" == "." ]]; then
|
||||
SEP=""
|
||||
else
|
||||
SEP="_"
|
||||
fi
|
||||
new_image_exp="${new_image_exp}${SEP}${TEMP:14}"
|
||||
unset TEMP SEP
|
||||
|
||||
# Add directory back to the full paths.
|
||||
new_image_clean="$image_dirname/$new_image_clean"
|
||||
new_image_exp="$image_dirname/$new_image_exp"
|
||||
|
||||
# Delete the existing shrunk image if we are forcing a new compression.
|
||||
if [[ -n "$force" && (-e "$new_image" || -e $new_image_clean) ]]; then
|
||||
if [[ -n "$force" &&
|
||||
(-e "$new_image" || -e $new_image_clean || -e $new_image_exp ) ]]; then
|
||||
echo -n " FORCE: "
|
||||
rm -v "$new_image" "$new_image_clean" 2>/dev/null
|
||||
rm -v "$new_image" "$new_image_clean" "$new_image_exp" 2>/dev/null
|
||||
fi
|
||||
|
||||
# Skip if a compressed image was already created today.
|
||||
@@ -138,10 +157,14 @@ $search "$location" | sort | while read image; do
|
||||
continue
|
||||
fi
|
||||
|
||||
# Whether or not to use the cleaned version or the normal version.
|
||||
# Whether or not to use the cleaned version.
|
||||
if [[ -n $clean ]]; then
|
||||
new_image="$new_image_clean"
|
||||
# Whether or not to use the expanded version.
|
||||
elif [[ -n $expand ]]; then
|
||||
new_image="$new_image_exp"
|
||||
fi
|
||||
# Otherwise uses the same name as before.
|
||||
|
||||
###### TBD Instead of this, only alter the file names, and set a dirname var?
|
||||
#### Create a new directory if the directory names were altered.
|
||||
|
@@ -33,13 +33,13 @@ function usage {
|
||||
If nothing is provided, current directory (.) is assumed.
|
||||
-v bitrate : The video bitrate to convert to.
|
||||
Defaults are based on the size passed.
|
||||
>= 2160: '30M'
|
||||
>= 1440: '12M'
|
||||
>= 1080: '5M'
|
||||
>= 720: '2000k'
|
||||
>= 480: '750k'
|
||||
>= 360: '250k'
|
||||
< 360: '100k'
|
||||
>= 2160: '30M'
|
||||
>= 1440: '12M'
|
||||
>= 1080: '5M'
|
||||
>= 720: '2000k'
|
||||
>= 480: '750k'
|
||||
>= 360: '250k'
|
||||
< 360: '100k'
|
||||
-a bitrate : The audio bitrate to convert to.
|
||||
Defaults to '192k'.
|
||||
-c vcodec : The video codec you'd like to use, such as libopenh264.
|
||||
|
@@ -547,6 +547,7 @@
|
||||
done
|
||||
echo -e "\nDone!"
|
||||
'
|
||||
alias code-sync='code-check'
|
||||
alias_code_reset: |
|
||||
alias code-reset='
|
||||
ls -d ~/Code/* | while read project
|
||||
@@ -573,6 +574,7 @@
|
||||
nodejs-social-traveler-server dev
|
||||
misc-spare-change main
|
||||
flutter-buddy-website dev
|
||||
flutter-sunset-alarm dev
|
||||
EOF
|
||||
}
|
||||
function code-reseed {
|
||||
|
Reference in New Issue
Block a user