9

Changing Back to the Original Schedule and First Video Post (Updated)

Update (12/08/2010): For some of you having trouble to run the PHP script, I posted a tutorial on how to install web server with PHP to help you who are non web developers to run the PHP scripts I wrote. Take a look here and leave a comment if you have any questions.

Update (08/25/2010): The video quality has been improved thanks to OpenShot. Note that to watch the original HD quality, you must switch to 720p or 1080p. I also fixed the PHP script to exclude the XML file inside the background.xml file so that the slideshow can run smoothly without an empty image.

After weeks of consideration, I finally decided to change back to my original post schedule of one post per day. Two posts each day simply doesn’t work for me.

I also plan to make a video version of the post along with each post. Here is my first video showing how to create a wallpaper slideshow in Ubuntu, one of the popular posts I wrote back to March of this year:

The steps in the video are different from the post. I recorded this video this afternoon. Just before that, I wrote a PHP script that can generate background.xml file for me.  You can download the PHP script here:
http://blog2.robbychen.com/Ubuntu/slideshow.tar.gz

To use this script, you must first change the permission of the folder where the images are to 777. You may change it back to original permission after that for security reason.

If you have any problem running this script, please leave a comment below.

13

Create a Wallpaper Slideshow on Ubuntu (Updated)

Update (12/08/2010): For some of you having trouble to run the PHP script, I posted a tutorial on how to install web server with PHP to help you who are non web developers to run the PHP scripts I wrote. Take a look here and leave a comment if you have any questions.

UPDATE (09/01/2010): I wrote a PHP script that will help you generate background.xml file easier. I also made a video tutorial on how to use the script. You can find it along with the video in this post.

I also experimented with duration time when testing the script and found out that all of the durati0n time stated in the file are actually in seconds. For this reason, I changed all the milliseconds in this post to seconds.

UPDATE (08/24/2010): I added one more step in the last part of this post. Please see the detailed step below.

I have many collections of wallpapers that I downloaded from DeviantArt.com, art.gnome.org, and other sites, but I never used them as my desktop wallpapers, mainly because I didn’t want to manually switch wallpaper from time to time. Recently I have had an idea to make a slideshow from these wallpapers thanks to the cosmos wallpaper collection in the background section in the Appearance Preferences on Ubuntu. After I took a look in the cosmos directory in /usr/share/backgrounds/, I discovered that the slideshow is controlled by a xml file. The content of the xml file is very straightforward:

<background>
<starttime>
<year>2009</year>
<month>08</month>
<day>04</day>
<hour>00</hour>
<minute>00</minute>
<second>00</second>
</starttime>
<!– This animation will start at midnight. –>
<static>
<duration>1795.0</duration>
<file>/usr/share/backgrounds/cosmos/cloud.jpg</file>
</static>
<transition>
<duration>5.0</duration>
<from>/usr/share/backgrounds/cosmos/cloud.jpg</from>
<to>/usr/share/backgrounds/cosmos/comet.jpg</to>
</transition>

</background>

You should understand the format of the above xml content very easily. If not, here are my basic explanation for each syntax:

  • <background> needs to be wrapped outside the whole document, it gives Ubuntu the ability to open this file as background/wallpaper.
  • You can set the values inside <starttime> to whenever you want to start the slideshow. The syntax inside <starttime> is self-explanatory. If you set the start time before the time right now, the slideshow will start automatically after you open this xml file as wallpaper in the Appearance Preferences window.
  • <static> contains two properties, <duration> and <file>.
    • <duration> is the time to display the wallpaper before change to the next wallpaper in seconds.
    • <file> is the absolute location that the wallpaper is located.
      (You can place each wallpaper and this xml file in different location if you want, but I prefer to place these files in one folder)
  • <transition> contains three properties that controls the time and direction that slideshow is transit to.
    • <duration> is the time that the transition will take in seconds.
    • <from> is the location of the current wallpaper.
    • <to> is the location of the next wallpaper.
  • Repeat the <static> and <transition> process as you want as long as you have different wallpapers.
  • In the last <transition>, you must place the first wallpaper in this list into the <to> property in order to loop your wallpapers continuously.

Here is the backgrounds.xml file that I created:

<background>
 <starttime>
  <year>2010</year>
  <month>03</month>
  <day>29</day>
  <hour>05</hour>
  <minute>38</minute>
  <second>00</second>
 </starttime>
 <static>
  <duration>50.0</duration>
  <file>/home/robbychen/Downloads/Wallpapers/dreamyblue.png</file>
 </static>
 <transition>
  <duration>5.0</duration>
  <from>/home/robbychen/Downloads/Wallpapers/dreamyblue.png</from>
  <to>/home/robbychen/Downloads/Wallpapers/dreamybrown.png</to>
 </transition>
 <static>
  <duration>50.0</duration>
  <file>/home/robbychen/Downloads/Wallpapers/dreamybrown.png</file>
 </static>
 <transition>
  <duration>5.0</duration>
  <from>/home/robbychen/Downloads/Wallpapers/dreamybrown.png</from>
  <to>/home/robbychen/Downloads/Wallpapers/dreamycrimson.png</to>
 </transition>
 <static>
  <duration>50.0</duration>
  <file>/home/robbychen/Downloads/Wallpapers/dreamycrimson.png</file>
 </static>
 <transition>
  <duration>5.0</duration>
  <from>/home/robbychen/Downloads/Wallpapers/dreamycrimson.png</from>
  <to>/home/robbychen/Downloads/Wallpapers/dreamyinverted.png</to>
 </transition>
 <static>
  <duration>50.0</duration>
  <file>/home/robbychen/Downloads/Wallpapers/dreamyinverted.png</file>
 </static>
 <transition>
  <duration>5.0</duration>
  <from>/home/robbychen/Downloads/Wallpapers/dreamyinverted.png</from>
  <to>/home/robbychen/Downloads/Wallpapers/Linux_wallpaper_by_varian.jpg</to>
 </transition>
 <static>
  <duration>50.0</duration>
  <file>/home/robbychen/Downloads/Wallpapers/Linux_wallpaper_by_varian.jpg</file>
 </static>
 <transition>
  <duration>5.0</duration>
  <from>/home/robbychen/Downloads/Wallpapers/Linux_wallpaper_by_varian.jpg</from>
  <to>/home/robbychen/Downloads/Wallpapers/Ubuntu-Sun.png</to>
 </transition>
 <static>
  <duration>50.0</duration>
  <file>/home/robbychen/Downloads/Wallpapers/Ubuntu-Sun.png</file>
 </static>
 <transition>
  <duration>5.0</duration>
  <from>/home/robbychen/Downloads/Wallpapers/Ubuntu-Sun.png</from>
  <to>/home/robbychen/Downloads/Wallpapers/dreamyblue.png</to>
 </transition>
 </background>

After you created this file, open the Appearance Preferences and go to Background section. Click Add button and select the xml file that you created.
Update (08/24/2010): As I described in the comment below, you need to select All files on top of the Open button in the Add Wallpaper dialog box (default is Images) in order to see the xml file.
Click open and you should see a stack of images that is similar to the cosmos background:

Click image to enlarge

Visit here to learn more about XML, and please leave a comment if you have any problem creating your own slideshow. I will glad to help you.