#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Name: slidexml.py
# Author: EthanZ6174
# Email: <
[email protected]>
# Site:
http://www.noslog.com
# Licence: GPLv3
# Version: 091127
import glob, os
import shutil
import time
curdir = os.getcwd()
os.chdir(curdir)
currentFilelist = glob.glob('*.*')
currentImageFiles = glob.glob('*.jpg')
currentTime = time.localtime()
length = len(currentImageFiles)
for i in currentFilelist:
if i == 'backgroundslide.xml':
os.remove(i)
f = file('backgroundslide.xml', 'w')
f.write('<background>\n')
f.write('\t<starttime>\n')
f.write('\t\t<year>' + str(currentTime.tm_year) + '</year>\n')
f.write('\t\t<month>' + str(currentTime.tm_mon) + '</month>\n')
f.write('\t\t<day>' + str(currentTime.tm_mday) + '</day>\n')
f.write('\t\t<hour>' + str(currentTime.tm_hour) + '</hour>\n')
f.write('\t\t<minute>' + str(currentTime.tm_min) + '</minute>\n')
f.write('\t\t<second>' + str(currentTime.tm_sec) + '</second>\n')
f.write('\t</starttime>\n')
f.write('<!--This animation will start at the time it created-->\n')
for i in currentImageFiles:
length = length - 1
f.write('\t<static>\n')
f.write('\t\t<duration>595.0</duration>\n')
f.write('\t\t<file>' + curdir + '/' + currentImageFiles[length] +'</file>\n')
f.write('\t</static>\n')
if length >= 1:
f.write('\t<transition>\n')
f.write('\t\t<duration>5.0</duration>\n')
f.write('\t\t<from>' + curdir + '/' + currentImageFiles[length] + '</from>\n')
f.write('\t\t<to>' + curdir + '/' + currentFilelist[length - 1] + '</to>\n')
f.write('\t</transition>\n')
f.write('</background>\n')
f.close()