[IMC-Tech] indytube

andy andy at cat.org.au
Sat Dec 9 02:47:38 PST 2006


Hi john,

wicked software! thanks ;)
Ive pasted a patch I needed to do to get it to work with our Plone site
at http://www.engagemedia.org/ - a new video sharing site.

Its working on our 'testing' install - if anybody wants to know more
just email me.. eg
http://testing.engagemedia.org/members/andrewl/videos/gesta.mp4/video_view
(this page has new functionality in test, its not the production site)


also - if you want to work together, maybe I can get commit access to
svn? whats the process? also you should put your email address in the
source somewhere ;)


andy


[1]
Index: indytube.py
===================================================================
--- indytube.py	(revision 3)
+++ indytube.py	(working copy)
@@ -8,7 +8,7 @@
 from Cheetah.Template import Template
 
 config = ConfigParser.RawConfigParser()
-config.read['indytube.conf']
+config.read('indytube.conf')
 
 MENCODER_LOCATION=config.get('mencoder','MENCODER_LOCATION')
 MENCODER_OPTIONS=config.get('mencoder','MENCODER_OPTIONS')
@@ -18,7 +18,7 @@
 BE_HOW_NICE=config.get('encoder','BE_HOW_NICE') 
 CONVERT_THESE=eval(config.get('encoder','CONVERT_THESE'))
 DO_ENCODING=config.getboolean('encoder','DO_ENCODING')
-NUMBER_OF_PARALLEL_ENCODERS=config.get('encoder','NUMBER_OF_PARALLEL_ENCODERS')
+NUMBER_OF_PARALLEL_ENCODERS=int(config.get('encoder','NUMBER_OF_PARALLEL_ENCODERS'))
 ENCODER_LOCKFILE_BASE=config.get('encoder','ENCODER_LOCKFILE_BASE')
 
 
@@ -56,9 +56,9 @@
 
 for root,dir,files in os.walk(VIDEO_FILE_DIRECTORY):
     for f in files:
-        logging.debug("Checking file: "+os.path.join(root,f))
         (stem,extension)=os.path.splitext(f)
-        if extension in CONVERT_THESE:  #we should convert the file
+        logging.debug("Checking file %s, using extension %s " %
( os.path.join(root,f), extension))
+        if extension.lower() in CONVERT_THESE:  #we should convert the
file
             relative_directory=root[len(VIDEO_FILE_DIRECTORY):]
             if relative_directory.startswith(os.sep):
                 relative_directory=relative_directory[1:]  # make sure
we are relative
@@ -90,7 +90,7 @@
                         logging.info("Original size of %s: %.1fMB,
Encoded size: %.1fMB" %
(videofile,os.path.getsize(videofile)/1000000.0,os.path.getsize(flvfile)/1000000.0))

data_map={'flowplayer_location':FLOWPLAYER_LOCATION,
                                'videofile':stem+".flv",
-                              'videobaseurl':VIDEO_SERVER_URL
+relative_directory,
+                              'videobaseurl':VIDEO_SERVER_URL
+relative_directory+'/',
                               'splashbaseurl':SPLASH_IMAGE_BASE,
                               'splashfile':SPLASH_IMAGE_FILE,
 			      'mirid':stem}
@@ -98,6 +98,10 @@
                         f=open(includefile, 'w')
                         f.write(t.respond())
                         f.close()
+
+			#XXX do auto plone object creation
+			#call web service??
+
                     else:
                         logging.info("Encoding failed! Permanently
skipping file!")
                         os.mknod(skipfile)
@@ -107,6 +111,8 @@
                     logging.debug("Error while processing %s: %s" %
(videofile,traceback.format_exc()))
                     os.remove(lockfile)
 		    os.remove(ENCODER_LOCKFILE)
+	    else:
+		logging.debug(' lock file or skip file present ... ')
 
 os.remove(ENCODER_LOCKFILE)
 




More information about the imc-tech mailing list