pages tagged kuvva http://meng6net.localhost/tag/kuvva/ <p><small>Copyright © 2005-2020 by <code>Meng Lu &lt;lumeng3@gmail.com&gt;</code></small></p> Meng Lu's home page ikiwiki Tue, 16 May 2017 23:59:39 +0000 Save Kuvva wallpaper images automatically http://meng6net.localhost/blog/save_kuvva_wallpaper_images_automatically/ http://meng6net.localhost/blog/save_kuvva_wallpaper_images_automatically/ bash image kuvva script wallpaper Tue, 16 May 2017 23:59:39 +0000 2017-05-16T23:59:39Z <p>This is a note on how to save Kuvva wallpaper images automatically.</p> <p><a href="http://www.kuvva.com/">Kuvva</a> is a desktop wallpaper app. It automatically streams beautiful images to one's computer as wallpapers. Every week they introduce a <a href= "http://blog.kuvva.com/">featured artist</a> whose selected work is streamed. I've used the service for a while and like the selection much.</p> <p>On Mac 10.8+, one can find information of the desktop wallpaper images with the following command</p> <pre> <code>$ plutil -p ~/Library/Preferences/com.apple.desktop.plist </code></pre> <p>More concise result with only image file paths:</p> <pre> <code>$ plutil -p ~/Library/Preferences/com.apple.desktop.plist | grep "\"ImageFilePath\"" | sed 's/^ *//' | sort "ImageFilePath" =&gt; "/Users/lumeng/Library/Caches/com.kuvva.Kuvva-Wallpapers/Wallpapers/2728c21dc3d845f1b05c209cded453a3" "ImageFilePath" =&gt; "/Users/lumeng/Library/Caches/com.kuvva.Kuvva-Wallpapers/Wallpapers/ba94b2bd2056554428d9792fe6523877" "ImageFilePath" =&gt; "/Users/lumeng/Library/Caches/com.kuvva.Kuvva-Wallpapers/Wallpapers/ba94b2bd2056554428d9792fe6523877" "ImageFilePath" =&gt; "/Users/lumeng/Library/Caches/com.kuvva.Kuvva-Wallpapers/Wallpapers/ba94b2bd2056554428d9792fe6523877" "ImageFilePath" =&gt; "/Users/lumeng/Library/Containers/com.kuvva.Kuvva-Wallpapers/Data/Library/Application Support/Kuvva/1ac5adfe90bd5b73367769111329ddf9de396d3e" "ImageFilePath" =&gt; "/Users/lumeng/Library/Containers/com.kuvva.Kuvva-Wallpapers/Data/Library/Application Support/Kuvva/1ac5adfe90bd5b73367769111329ddf9de396d3e" "ImageFilePath" =&gt; "/Users/lumeng/Library/Containers/com.kuvva.Kuvva-Wallpapers/Data/Library/Application Support/Kuvva/1ac5adfe90bd5b73367769111329ddf9de396d3e" "ImageFilePath" =&gt; "/Users/lumeng/Library/Containers/com.kuvva.Kuvva-Wallpapers/Data/Library/Application Support/Kuvva/2f47f6bcbb93acb1729beeb9177e2a64c3b688dc" </code></pre> <p>It turns out every image used as wallpaper will be cached in</p> <pre> <code>/Users/lumeng/Library/Containers/com.kuvva.Kuvva-Wallpapers/Data/Library/Application Support/Kuvva/ </code></pre> <p>I then added cron job to save the images in a different directory:</p> <pre><code>$ crontab -l ## save newest Kuvva wallpaper image @hourly rsync -qrihp "/Users/lumeng/Library/Containers/com.kuvva.Kuvva-Wallpapers/Data/Library/Application Support/Kuvva/" "/Users/lumeng/Dropbox/Image/Wallpaper/kuvva_wallpaper/new/" ## copy new images out @daily rsync -qrihp "/Users/lumeng/Dropbox/Image/Wallpaper/kuvva_wallpaper/new/" "/Users/lumeng/Dropbox-x4430/Dropbox/DataSpace-Dropbox/Image/Wallpaper/kuvva_wallpaper/" ## add filename extesion to image files names @daily add-filename-extesion-to-image-files.sh -d "/Users/lumeng/Dropbox-x4430/Dropbox/DataSpace-Dropbox/Image/Wallpaper/kuvva_wallpaper/" </code></pre> <p>The original file names don't have extension. One can use ImageMagick's <code>identify</code> utility to detect the image file type and add file name extension accordingly. The Bash script I'm using to do that <a href= "https://github.com/lumeng/repogit-mengapps/blob/master/file-system/add-filename-extension-to-image-files.sh"> <code>add-filename-extension-to-image-files.sh</code></a>:</p> <pre><code>#!/usr/bin/env bash ## Summary: identify image file type and add filename extension appropriately when applicable ## Example: ## $ add-filename-extension-to-image-files.sh -d ~/temp IMAGE_FILE_DIR= while getopts d:d opt; do case $opt in d) IMAGE_FILE_DIR=$OPTARG ;; esac done if &lt;span class="createlink"&gt; -d &amp;#36;IMAGE FILE DIR &lt;/span&gt;; then FILES=`find $IMAGE_FILE_DIR -maxdepth 1 -type f` else FILES=() fi IMAGEMAGICK_IDENTIFY_BIN="/opt/local/bin/identify" for file in $FILES do filename=$(basename "$file") extension="${filename##*.}" if [ "$extension" == "$filename" ]; then newextension=`$IMAGEMAGICK_IDENTIFY_BIN $file | cut -d ' ' -f 2 | tr '[:upper:]' '[:lower:]'` rsync -qrthp $file "$file.$newextension" rm $file fi done ## END </code></pre> /blog/save_kuvva_wallpaper_images_automatically/#comments