Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
cfgnunes committed Dec 17, 2024
1 parent 7cefeb3 commit 0f16ebd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,18 @@ _main_task() {

# Run the main process.
std_output=$(exiftool -- "$input_file" 2>/dev/null)
std_output="$input_file:"$'\n'"$std_output"

# FORMAT THE OUTPUT:
# Prepend the filename.
std_output="--> File: \"$input_file\""$'\n'"$std_output"
# Remove any extra spaces before colons ":".
# shellcheck disable=SC2001
std_output=$(sed "s| \+: |: |g" <<<"$std_output")
# Remove irrelevant information.
std_output=$(grep --ignore-case -v "^ExifTool Version Number: " <<<"$std_output")
std_output=$(grep --ignore-case -v "^File name: " <<<"$std_output")
std_output=$(grep --ignore-case -v "^Directory: " <<<"$std_output")
# Remove any occurrence of the current working directory.
std_output=$(_text_remove_pwd "$std_output")

_storage_text_write_ln "$std_output"$'\n'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,19 @@ _main_task() {

# Run the main process.
std_output=$(mediainfo -- "$input_file" 2>/dev/null)
std_output="$input_file:"$'\n'"--> $std_output"

# FORMAT THE OUTPUT:
# Prepend the filename.
std_output="--> File: \"$input_file\""$'\n'"$std_output"
# Remove any extra spaces before colons ":".
# shellcheck disable=SC2001
std_output=$(sed "s| \+: |: |g" <<<"$std_output")
# Replace 2+ consecutive newlines with 1 newline.
# shellcheck disable=SC2001
std_output=$(sed ':a;N;$!ba;s/\n\n/\n--> /g' <<<"$std_output")
std_output=$(sed -z "s|\n\{2,\}|\n|g" <<<"$std_output")
# Remove irrelevant information.
std_output=$(grep --ignore-case -v "^Complete name: " <<<"$std_output")
# Remove any occurrence of the current working directory.
std_output=$(_text_remove_pwd "$std_output")

_storage_text_write_ln "$std_output"$'\n'
Expand Down
39 changes: 0 additions & 39 deletions Image/Optimize/Strip metadata (exiftool)

This file was deleted.

0 comments on commit 0f16ebd

Please sign in to comment.