Changeset 230 for indytube/trunk
- Timestamp:
- 10/14/07 09:39:11 (15 months ago)
- Files:
-
- 1 modified
-
indytube/trunk/indytube.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
indytube/trunk/indytube.py
r229 r230 8 8 import traceback 9 9 import sys 10 import signal 10 11 11 12 #3rd party libraries … … 20 21 checked = 0 21 22 converted = 0 23 conf_file = "" 22 24 23 25 def __init__(self): 24 26 """constructor for IndyTubeTranscoder""" 27 28 def rereadConfig(self,signal,frame): 29 self.parse_config(self.conf_file) 25 30 26 31 def parse_config(self,conf_file): … … 28 33 config = ConfigParser.RawConfigParser() 29 34 config.read(conf_file) 35 self.conf_file = conf_file 36 30 37 31 38 self.MENCODER_LOCATION=config.get('mencoder','MENCODER_LOCATION') … … 58 65 self.LOG_LEVEL=eval(config.get('logging','LOG_LEVEL')) 59 66 67 self.ENCODER_LOCKFILE = "" 68 60 69 logging.basicConfig(level=self.LOG_LEVEL, format='%(asctime)s %(levelname)s %(message)s', filename=self.LOG_FILE, filemode='a') 61 70 62 self.ENCODER_LOCKFILE = "" 71 logging.info("finished parse_config function at %s, using file %s " % (time.strftime("%D %H:%M:%S"), self.conf_file)) 63 72 64 73 def check_lock_file(self): … … 101 110 102 111 def attempt_transcode_file(self, f): 103 '''Start the transcoding attempt with file 'f'. Converts to FLV format, possibly OGG/Theora in future. Produces HTML snippets for including112 '''Start the transcoding attempt with file 'f'. Converts to FLV format, and OGG/Theora. Produces HTML snippets for including 104 113 the players appropriate for the produced video format. At the moment, this is FlowPlayer for FLV, and Cortado java applet for OGG/Theora ''' 105 114 #whether or not the transcoding worked for the given file 'f' … … 212 221 # passing along the indytube object as an argument. (try not to _call_ this function or else you'll end up in infinite recursion!) 213 222 reactor.callLater(indytuber.POLLTIME,looperInvoker,indytuber) 214 223 215 224 #make an IndyTubeTranscoder object 216 225 indytuber = IndyTubeTranscoder() 217 226 #parse our config 218 227 indytuber.parse_config('indytube.conf') 228 219 229 #we have started! 220 230 logging.info("started main function at %s, calling loop every %s seconds " % (time.strftime("%D %H:%M:%S"), indytuber.POLLTIME)) 221 231 #start it for real, once off 222 232 looperInvoker(indytuber) 233 234 #install a signal handler to re-read configuration files. 235 signal.signal(signal.SIGUSR2, indytuber.rereadConfig) 236 223 237 #start the twisted reactor 224 238 # see http://twistedmatrix.com/trac/wiki/FrequentlyAskedQuestions#Igetexceptions.ValueError:signalonlyworksinmainthreadwhenItrytorunmyTwistedprogramWhatswrong
