diff options
author | Patrick Spek <p.spek@tyil.nl> | 2024-02-21 08:28:13 +0100 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2024-02-23 15:37:13 +0100 |
commit | 1ac06838b35cf7c7d7dde702a94c4d88a535dbd1 (patch) | |
tree | b0aa462f319d948e2bd0f529dea8823c6789bdc4 | |
parent | b19a9f718da2643bc20817aebd178a6b74f8a635 (diff) |
Add utility to easily import new wallpapers
-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 "$@" |