diff options
Diffstat (limited to '.local/bin/import-pape')
-rwxr-xr-x | .local/bin/import-pape | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/.local/bin/import-pape b/.local/bin/import-pape new file mode 100755 index 0000000..b72c169 --- /dev/null +++ b/.local/bin/import-pape @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +readonly PAPEDIR="$HOME/pictures/wallpapers" + +main() { + for s in "$@" + do + local format="$(identify -format "%m" "$s" | awk '{ print(tolower($0)) }')" + local resolution="$(identify -format "%wx%h" "$s")" + local hash="$(sha1sum "$s" | awk '{ print $1 }')" + local destination="$PAPEDIR/$resolution/$hash.$format" + + mkdir -pv -- "$PAPEDIR/$resolution" + printf "Importing %s to %s\n" "$s" "$destination" + mv -- "$s" "$destination" + done +} + +main "$@" |