2 Commits

Author SHA1 Message Date
fbt
67dc431aa2 Add a step that converts files if asked to
Signed-off-by: fbt <fbt@fleshless.org>
2025-05-25 11:14:31 +00:00
fbt
19f6c5249a remove debug stuff
Signed-off-by: fbt <fbt@fleshless.org>
2022-12-28 04:19:58 +00:00
2 changed files with 25 additions and 7 deletions

2
ufw
View File

@@ -422,8 +422,6 @@ main() {
shift
done
echo "Args: ${args[@]}"
xclip_args+=( -selection "$xclip_selector" )
# Catch the args after --

22
ufwd
View File

@@ -15,10 +15,29 @@ usage() {
printf ' -n # Enable notifications with notify-send. Must be installed.\n'
printf ' -d [path] # Set the dir that is to be watched.\n'
printf ' -s # Push the file url into the clipboard.\n'
printf ' --magick <type:format> # Convert files of `type` into `format` with magick.\n'
}
upload() {
declare file=$1; shift
declare file=$1 file_type _type _target upload_output upload_return
shift
if [[ $cfg_magick ]]; then
file_type=$(file -ib "$file")
file_type="${file_type%;*}"
for x in "${cfg_magick[@]}"; do
_type="${x%:*}"
_target="${x#*:}"
[[ $_type == "$file_type" ]] && {
magick "$file" "${file%.*}.$_target"
rm -v "$file"
exit 0 # The next instance of the script will pick the file up.
}
done
fi
upload_output=$( ufw -R "$@" "$file" )
upload_return=$?
@@ -47,6 +66,7 @@ main() {
(--clipboard|-c) flag_enable_clipboard=1;;
(--workdir|-d) cfg_workdir+=( "$2" ); shift;;
(--magick) cfg_magick+=( "$2" ); shift;;
(--) shift; break;;
(-*) err "Unknown key: $1"; usage; return 1;;