~ubuntu-branches/ubuntu/quantal/ubuntu-wallpapers/quantal

« back to all changes in this revision

Viewing changes to update-background.py

  • Committer: Package Import Robot
  • Author(s): Paul Sladen, Iain Farrell/Otto Greenslade
  • Date: 2011-09-29 20:59:59 UTC
  • Revision ID: package-import@ubuntu.com-20110929205959-crd2u63koczp6niz
Tags: 0.32.1
[Iain Farrell/Otto Greenslade]
Wallpapers from the Ubuntu 11.10 community contest (LP: #829213)
http://design.canonical.com/2011/08/quick-wallpaper-update/

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
import glob
 
4
 
 
5
PREAMBLE = """<background>
 
6
  <starttime>
 
7
    <year>2009</year>
 
8
    <month>08</month>
 
9
    <day>04</day>
 
10
    <hour>00</hour>
 
11
    <minute>00</minute>
 
12
    <second>00</second>
 
13
  </starttime>
 
14
<!-- This animation will start at midnight. -->
 
15
"""
 
16
 
 
17
ENTRY = """  <static>
 
18
    <duration>1795.0</duration>
 
19
    <file>%(a)s</file>
 
20
  </static>
 
21
  <transition>
 
22
    <duration>5.0</duration>
 
23
    <from>%(a)s</from>
 
24
    <to>%(b)s</to>
 
25
  </transition>
 
26
"""
 
27
 
 
28
FOOTER = """</background>
 
29
"""
 
30
 
 
31
PATH='/usr/share/backgrounds/'
 
32
 
 
33
def main():
 
34
    images = glob.glob('*.jpg')
 
35
    m = len(images)
 
36
 
 
37
    output = ''
 
38
    output += PREAMBLE 
 
39
    for i in xrange(m):
 
40
        output += ENTRY % {'a': PATH + images[i], 'b': PATH + images[(i+1) % m]}
 
41
    output += FOOTER
 
42
    print output,
 
43
 
 
44
if __name__ == '__main__':
 
45
    main()