#!/usr/bin/env python # Program to sort Effelsberg webcam pics and make a movie # Enno Middelberg, 3Dec2003 import string, os, time, sys os.chdir('/homes/emiddelb/local/pics/eberg_movie/webcam') # create list of files in current working dir files=os.listdir(os.getcwd()) # sort out eff_* files eff_files=[] # store system time systime=time.time() for x in files: if string.find(x, "eff_")!=-1: # check file size and modification time, omit if zero or older than 24 h = 86400 s filestats=os.stat(x) if filestats[6]!=0 and systime-filestats[8]<86400: # add timestamp of file and filename eff_files.append([filestats[8], x, time.gmtime(filestats[8]), systime-filestats[8]]) #eff_files.append([filestats[8], x]) # sort files by timestamp eff_files.sort() # copy mpeg_encode parameter file and append list of files os.system('cp mpeg-skel.par mpeg.par') out=open('mpeg.par', 'a') for x in eff_files: # print x[1], time.localtime(x[0])[3:6] out.write(x[1]+'\n') out.write('END_INPUT\n') # finally, make the movie and copy it to homepage #os.system('mpeg_encode mpeg.par') #os.system('cp effelsberg.mpg /homes/emiddelb/hp/outreach')