Skip to content

Commit 2c0684b

Browse files
author
kRHYME7
committed
task: added more logging for get hash map
1 parent 37ff77d commit 2c0684b

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

Configs/.local/lib/hyde/globalcontrol.sh

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@ get_hashmap() {
4545
[ "${wallSource}" == "--no-notify" ] && no_notify=1 && continue
4646
[ "${wallSource}" == "--skipstrays" ] && skipStrays=1 && continue
4747
[ "${wallSource}" == "--verbose" ] && verboseMap=1 && continue
48-
48+
[ -e "${wallSource}" ] || {
49+
print_log -err "ERROR:" -b "wallpaper source does not exist:" "${wallSource}" -y " skipping..."
50+
continue
51+
}
4952
wallSource="$(realpath "${wallSource}")"
50-
[ -e "${wallSource}" ] || continue
5153

52-
[ "${LOG_LEVEL}" == "debug" ] && print_log -g "DEBUG:" -b "wallpaper source:" "${wallSource}"
54+
[ "${LOG_LEVEL}" == "debug" ] && print_log -g "DEBUG:" -b "wallSource path:" "${wallSource}"
5355

5456
list_extensions() {
5557
# Define supported file extensions
@@ -72,11 +74,15 @@ get_hashmap() {
7274
fi
7375

7476
local find_command
75-
find_command="find \"${wallSource}\" -type f \\( $(list_extensions) \\) ! -path \"*/logo/*\" -exec \"${hashMech}\" {} + 2>/dev/null"
77+
find_command="find \"${wallSource}\" -type f \\( $(list_extensions) \\) ! -path \"*/logo/*\" -exec \"${hashMech}\" {} +"
7678

7779
[ "${LOG_LEVEL}" == "debug" ] && print_log -g "DEBUG:" -b "Running command:" "${find_command}"
7880

79-
eval "${find_command}" | sort -k2
81+
tmpfile=$(mktemp)
82+
eval "${find_command}" 2>"$tmpfile" | sort -k2
83+
error_output=$(<"$tmpfile") && rm -f "$tmpfile"
84+
[ -n "${error_output}" ] && print_log -err "ERROR:" -b "found an error: " -r "${error_output}" -y " skipping..."
85+
8086
}
8187

8288
hashMap=$(find_wallpapers "${wallSource}") # Enable debug mode for testing
@@ -100,6 +106,7 @@ get_hashmap() {
100106
# Notify the list of directories without compatible wallpapers
101107
if [ "${#no_wallpapers[@]}" -gt 0 ]; then
102108
[ -n "${no_notify}" ] && notify-send -a "HyDE Alert" "WARNING: No compatible wallpapers found in: ${no_wallpapers[*]}"
109+
print_log -warn "No compatible wallpapers found in:" "${no_wallpapers[*]}"
103110
fi
104111

105112
if [ -z "${#wallList[@]}" ] || [[ "${#wallList[@]}" -eq 0 ]]; then

0 commit comments

Comments
 (0)