Created
July 17, 2018 15:24
-
-
Save johnrizzo1/940e6d14d602435c2fa2a72e0f1ef815 to your computer and use it in GitHub Desktop.
Windows 10 Bing Image Archiver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Copy any of the bing downloaded images that are used on the windows 10 lock screen. | |
# Once you set this up you can then set your background to slideshow and point it | |
# to the archive directory | |
# | |
# This was taken from somewhere I'd like to attribute but can't find the URL. | |
# If this is yours please let me know and I'll attribute you. | |
IMAGE_FOLDER="/mnt/c/Users/jrizzo/AppData/Local/Packages/Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy/LocalState/Assets" | |
LIST_SOURCE="/mnt/c/tmp/spotlight/listsource.txt" | |
LIST_TARGET="/mnt/c/tmp/spotlight/listtarget.txt" | |
ls -1 $IMAGE_FOLDER | sort > $LIST_SOURCE | |
ls -1 /mnt/c/tmp/spotlight/*.jpg | awk -F "/" '{gsub(".jpg","",$6);print $6}' | sort > $LIST_TARGET | |
# egrep -vf $LIST_SOURCE $LIST_TARGET | awk '{system ("rm -f "$1".jpg")}' | |
for i in `cat $LIST_SOURCE | egrep -vf $LIST_TARGET` | |
do | |
varfile="$IMAGE_FOLDER/$i" | |
file $varfile | grep JPEG | awk -F, '{gsub(" ","",$8);print $8}' | awk -Fx -v vfile=$i -v vfilefull=$varfile '{if ($1>$2 && $1>1280) system("cp "vfilefull" /mnt/c/tmp/spotlight/"vfile".jpg")}' | |
done | |
ls -1 /mnt/c/tmp/spotlight/*.png | awk -F "/" '{gsub(".png","",$6);print $6}' | sort > $LIST_TARGET | |
# egrep -vf $LIST_SOURCE $LIST_TARGET | awk '{system ("rm -f "$1".png")}' | |
for i in `cat $LIST_SOURCE | egrep -vf $LIST_TARGET` | |
do | |
varfile="$IMAGE_FOLDER/$i" | |
file $varfile | grep PNG | awk -F, '{gsub(" ","",$8);print $8}' | awk -Fx -v vfile=$i -v vfilefull=$varfile '{if ($1>$2 && $1>1280) system("cp "vfilefull" /mnt/c/tmp/spotlight/"vfile".png")}' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment