Created
June 3, 2012 10:33
-
-
Save seungwon0/2862969 to your computer and use it in GitHub Desktop.
creates a XML file for wallpaper slideshow
This file contains 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
#!/bin/sh | |
# | |
# ubuntu-wallpaper-slideshow.sh - creates a XML file for wallpaper slideshow | |
# | |
# Creates a XML file like /usr/share/backgrounds/contest/precise.xml | |
# in Ubuntu 12.04. | |
# | |
# Usage example: | |
# ./ubuntu-wallpaper-slideshow.sh ~/Pictures/LOOK/*.jpg > LOOK.xml | |
# | |
# You have to create another XML file manually in | |
# /usr/share/gnome-background-properties directory to use the | |
# generated XML file. | |
# | |
# Seungwon Jeong <[email protected]> | |
# | |
# Copyright (C) 2012 by Seungwon Jeong | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, but | |
# WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
# General Public License for more details. | |
# | |
# You should have received a copy of the GNU General Public License | |
# along with this program. If not, see | |
# <http://www.gnu.org/licenses/>. | |
set -e | |
set -u | |
if test "$#" -lt 2; then | |
echo "Usage: $0 <WALLPAPER1> <WALLPAPER2> [...]" | |
exit 2 | |
fi | |
for file; do | |
if test ! -f $file; then | |
echo "$file: No such file" 1>&2 | |
exit 1 | |
fi | |
done | |
echo '<background>' | |
echo ' <starttime>' | |
echo ' <year>2009</year>' | |
echo ' <month>08</month>' | |
echo ' <day>04</day>' | |
echo ' <hour>00</hour>' | |
echo ' <minute>00</minute>' | |
echo ' <second>00</second>' | |
echo ' </starttime>' | |
static_duration=1795.0 | |
transition_duration=5.0 | |
first_file=`realpath "$1"` | |
shift | |
echo ' <static>' | |
echo " <duration>$static_duration</duration>" | |
echo " <file>$first_file</file>" | |
echo ' </static>' | |
echo ' <transition>' | |
echo " <duration>$transition_duration</duration>" | |
echo " <from>$first_file</from>" | |
for file; do | |
file=`realpath "$file"` | |
echo " <to>$file</to>" | |
echo ' </transition>' | |
echo ' <static>' | |
echo " <duration>$static_duration</duration>" | |
echo " <file>$file</file>" | |
echo ' </static>' | |
echo ' <transition>' | |
echo " <duration>$transition_duration</duration>" | |
echo " <from>$file</from>" | |
done | |
echo " <to>$first_file</to>" | |
echo ' </transition>' | |
echo '</background>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment