Hallo Ubuntu Gemeinde,
als großer Fan von Josha Sauer und seinen Comics (www.nichtlustig.de) habe ich bisher ein Tool vermisst, welches mir die aktuellen Comics als Wallpaper auf meinem HTPC Desktop setzt... und zwar ohne suchen, klicken und fummeln. Ich habe ein Script von Marcus Perst und Anne Bonin gefunden und an meine Bedürfnisse angepasst. Das ursprüngliche Script gibt es z.B. hier: http://gtk-apps.org/content/show.php/Latest+nichtlustig-cartoon+as+wallpaper?content=95782
Das neue Script holt sich die letzten 8 Comics und baut per ImageMagick ein Wallpaper. Das Ergebnis sieht so aus: http://i56.tinypic.com/2wrqkx4.jpg
Das Script:
#!/bin/bash ################################################################# # Nichtlustig RSS Wallpaper v1.0 by Peter Groetelaer # ################################################################# # requires imagemagick (montage) to create the wallpaper # # Wallpaper is optimized to be used in 1920x1080 # # Put into crontab to always get the latest cartoons :-) # ################################################################# # This Script is based on an older (no more working) Script I found # online. This is from the older scrips copyright: # --------------------------------------------------------------- # nichtlusti.sh # Replaces the GNOME-wallpaper with the latest cartoon from nichtlustig.de, centered with fitting background.color # Authors: Marcus Perst, Anne Bonin # Cartoons (c) by Josha Sauer, http://www.nichtlustig.de/ # --------------------------------------------------------------- # You are free to use and modify this script as long as you credit the authors. # set working directory WPATH="/home/"$(whoami)"/.nichtlustig" echo "working directory is "$WPATH"/" # remove all existing files rm -f /home/"$(whoami)"/.nichtlustig/*.jpg # create working-directory if it doesn't exist yet mkdir -p $WPATH # get the latest RSS-Feed wget --quiet http://www.nichtlustig.de/rss/nichtrss.rss -O $WPATH"/nichtrss.rss" # find image links, write to file and only get the 8 latest comics cat $WPATH"/nichtrss.rss" | grep 'http://www.nichtlustig.de/comics/full' | sed 's/^.*<img src="//' | sed 's/".*$//' | sed -e '1d' | sed -e '20d' | sed -e '19d' | sed -e '18d' | sed -e '17d' | sed -e '16d' | sed -e '15d' | sed -e '14d' | sed -e '13d' | sed -e '12d' | sed -e '11d' | sed -e '10d' | sed -e '9d' >$WPATH"/links.txt" # download images to $WPATH wget --quiet -i $WPATH"/links.txt" -N -P $WPATH # create wallpaper via imagemagick montage -geometry 540x540 $WPATH'/*.jpg' +polaroid -background black -tile 4x2 $WPATH"/wallpaper.jpg" # set background-position to centered gconftool-2 --type string --set /desktop/gnome/background/picture_options "scaled" # set wallpaper gconftool-2 --type string --set /desktop/gnome/background/picture_filename $WPATH"/wallpaper.jpg" # clean up rm -f $WPATH"/nichtrss.rss" rm -f $WPATH"/links.txt"
HowTo:
Installiert euch das Tool ImageMagick: sudo apt-get install imagemagick Kopiert das Script nach /home/USERNAME/.nichtlustig, und gebt ihm passende Rechte, z.B. so: chmod 755 /home/USERNAME/nichtlustig_rss.sh Führt das Script entweder bei Bedarf per /home/USERNAME/nichtlustig_rss.sh aus, oder ruft es per Crontab auf so oft ihr wollt. Der folgende Eintrag in der Crontab baut z.B. jeden Morgen um 06:30 das aktuelle Wallpaper: 30 6 * * * USERNAME /home/USERNAME/.nichtlustig/nichtlustig_rss.sh
Natürlich könnt ihr das Script frei nach Laune verändern, anpassen, verbessern oder verunstalten. Ich hoffe ich habe dem einen oder anderen NichtLustig Fan so eine Freunde gemacht. ☺
Gruß,
Peter
PS: Das ist mein erstes Shell Script, daher gibt es sicherlich auch reichlich Verbesserungspotential 😉