rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
bgimage.save(os.path.join(getTempPath(),"details-%s.png" % itemnum),"PNG",quality=99,optimize=0,dpi=screendpi) | bgimage=Image.open(backgroundfilename,"r").resize(screensize) bgimage.paste(overlayimage, (0,0), overlayimage) bgimage.save(os.path.join(getTempPath(),"details-%s.jpg" % itemnum),"JPEG", quality=90) if haspreview == True: numframes=secondsToFrames(menulength) write( "Generating the detail preview images" ) framenum ... | def createDetailsPage(screensize, screendpi, numberofitems): """Creates all the necessary images and files for the details page.""" write( "Creating details pages") #Get the detailspage node (we must only have 1) detailnode=themeDOM.getElementsByTagName("detailspage") if detailnode.length!=1: fatalError("Cannot find ... |
encodeMenu(os.path.join(getTempPath(),"details-%s.png" % itemnum), os.path.join(getTempPath(),"temp.m2v"), getThemeFile(themeName,menumusic), menulength, os.path.join(getTempPath(),"temp.mpg"), "", os.path.join(getTempPath(),"details-%s.mpg" % itemnum), aspect_ratio) | if haspreview == True: encodeMenu(os.path.join(getTempPath(),"details-%s-f%%06d.jpg" % itemnum), os.path.join(getTempPath(),"temp.m2v"), getThemeFile(themeName,menumusic), menulength, os.path.join(getTempPath(),"temp.mpg"), "", os.path.join(getTempPath(),"details-%s.mpg" % itemnum), aspect_ratio) else: encodeMenu(os.pa... | def createDetailsPage(screensize, screendpi, numberofitems): """Creates all the necessary images and files for the details page.""" write( "Creating details pages") #Get the detailspage node (we must only have 1) detailnode=themeDOM.getElementsByTagName("detailspage") if detailnode.length!=1: fatalError("Cannot find ... |
path_png2yuv = [defaultsettings["MythArchivePng2yuvCmd"], os.path.split(defaultsettings["MythArchivePng2yuvCmd"])[1]] | path_jpeg2yuv = [defaultsettings["MythArchiveJpeg2yuvCmd"], os.path.split(defaultsettings["MythArchiveJpeg2yuvCmd"])[1]] | def usage(): write(""" -h/--help (Show this usage) -j/--jobfile file (use file as the job file) -l/--progresslog file (log file to output progress messages) """) |
write( "Wrapped text = " + i, False) | write( "Wrapped text = " + i.encode("ascii", "replace"), False) | def paintText( draw, x,y,width, height,text, font, colour, alignment): """Takes a piece of text and draws it onto an image inside a bounding box.""" #The text is wider than the width of the bounding box lines,tmp,h = intelliDraw(draw,text,font,width) j = 0 for i in lines: if (j*h) < (height-h): write( "Wrapped text ... |
write( "Truncated text = " + i, False) | write( "Truncated text = " + i.encode("ascii", "replace"), False) | def paintText( draw, x,y,width, height,text, font, colour, alignment): """Takes a piece of text and draws it onto an image inside a bounding box.""" #The text is wider than the width of the bounding box lines,tmp,h = intelliDraw(draw,text,font,width) j = 0 for i in lines: if (j*h) < (height-h): write( "Wrapped text ... |
node.appendChild(infoDOM.createTextNode(record[6])) | node.appendChild(infoDOM.createTextNode(unicode(record[6], "UTF-8"))) | def getFileInformation(file, outputfile): impl = xml.dom.minidom.getDOMImplementation() infoDOM = impl.createDocument(None, "fileinfo", None) top_element = infoDOM.documentElement # if the jobfile has amended file details use them details = file.getElementsByTagName("details") if details.length > 0: node = infoDOM.cre... |
node.appendChild(infoDOM.createTextNode(record[5])) | node.appendChild(infoDOM.createTextNode(unicode(record[5], "UTF-8"))) | def getFileInformation(file, outputfile): impl = xml.dom.minidom.getDOMImplementation() infoDOM = impl.createDocument(None, "fileinfo", None) top_element = infoDOM.documentElement # if the jobfile has amended file details use them details = file.getElementsByTagName("details") if details.length > 0: node = infoDOM.cre... |
node.appendChild(infoDOM.createTextNode(record[4])) | node.appendChild(infoDOM.createTextNode(unicode(record[4], "UTF-8"))) | def getFileInformation(file, outputfile): impl = xml.dom.minidom.getDOMImplementation() infoDOM = impl.createDocument(None, "fileinfo", None) top_element = infoDOM.documentElement # if the jobfile has amended file details use them details = file.getElementsByTagName("details") if details.length > 0: node = infoDOM.cre... |
node.appendChild(infoDOM.createTextNode(record[0])) | node.appendChild(infoDOM.createTextNode(unicode(record[0], "UTF-8"))) | def getFileInformation(file, outputfile): impl = xml.dom.minidom.getDOMImplementation() infoDOM = impl.createDocument(None, "fileinfo", None) top_element = infoDOM.documentElement # if the jobfile has amended file details use them details = file.getElementsByTagName("details") if details.length > 0: node = infoDOM.cre... |
node.appendChild(infoDOM.createTextNode(record[2])) | node.appendChild(infoDOM.createTextNode(unicode(record[2], "UTF-8"))) | def getFileInformation(file, outputfile): impl = xml.dom.minidom.getDOMImplementation() infoDOM = impl.createDocument(None, "fileinfo", None) top_element = infoDOM.documentElement # if the jobfile has amended file details use them details = file.getElementsByTagName("details") if details.length > 0: node = infoDOM.cre... |
f.write(myDOM.toxml()) | f.write(myDOM.toxml("UTF-8")) | def WriteXMLToFile(myDOM, filename): #Save the XML file to disk for use later on f=open(filename, 'w') f.write(myDOM.toxml()) f.close() |
if videomode=="pal": | if videomode=="ntsc": | def isResolutionOkayForDVD(videoresolution): if videomode=="pal": return videoresolution==(720,480) or videoresolution==(704,480) or videoresolution==(352,480) or videoresolution==(352,240) else: return videoresolution==(720,576) or videoresolution==(704,576) or videoresolution==(352,576) or videoresolution==(352,288) |
command = "mythreplex --demux -o %s " % (folder + "/stream") command += "-v %d " % (video[VIDEO_ID] & 255) if audio1[AUDIO_ID] != -1: if audio1[AUDIO_CODEC] == 'MP2': command += "-a %d " % (audio1[AUDIO_ID] & 255) elif audio1[AUDIO_CODEC] == 'AC3': command += "-c %d " % (audio1[AUDIO_ID] & 255) if audio2[AUDIO_ID] !... | if getFileType(folder) == "mpegts": command = "mythreplex --demux -t TS -o %s " % (folder + "/stream") command += "-v %d " % (video[VIDEO_ID]) if audio1[AUDIO_ID] != -1: if audio1[AUDIO_CODEC] == 'MP2': command += "-a %d " % (audio1[AUDIO_ID]) elif audio1[AUDIO_CODEC] == 'AC3': command += "-c %d " % (audio1[AUDIO_ID]... | def deMultiplexMPEG2File(folder, mediafile, video, audio1, audio2): checkCancelFlag() command = "mythreplex --demux -o %s " % (folder + "/stream") command += "-v %d " % (video[VIDEO_ID] & 255) if audio1[AUDIO_ID] != -1: if audio1[AUDIO_CODEC] == 'MP2': command += "-a %d " % (audio1[AUDIO_ID] & 255) elif audio1[AUDIO... |
write("File codec is '%s'" % getVideoCodec(folder)) | write("File type is '%s'" % getFileType(folder)) write("Video codec is '%s'" % getVideoCodec(folder)) | def processFile(file, folder): """Process a single video/recording file ready for burning.""" write( "*************************************************************") write( "Processing file " + file.attributes["filename"].value + " of type " + file.attributes["type"].value) write( "************************************... |
if alwaysRunMythtranscode == True: | if alwaysRunMythtranscode == True or getFileType(folder) == "mpegts": | def processFile(file, folder): """Process a single video/recording file ready for burning.""" write( "*************************************************************") write( "Processing file " + file.attributes["filename"].value + " of type " + file.attributes["type"].value) write( "************************************... |
if file.hasAttribute("localfilename"): mediafile = file.attributes["localfilename"].value | def preProcessFile(file, folder): """Pre-process a single video/recording file.""" write( "Pre-processing file '" + file.attributes["filename"].value + \ "' of type '"+ file.attributes["type"].value+"'") #As part of this routine we need to pre-process the video: #1. check the file actually exists #2. extract informat... | |
if file.attributes["type"].value=="recording": | if file.hasAttribute("localfilename"): mediafile=file.attributes["localfilename"].value elif file.attributes["type"].value=="recording": | def processFile(file, folder): """Process a single video/recording file ready for burning.""" write( "*************************************************************") write( "Processing file " + file.attributes["filename"].value + " of type " + file.attributes["type"].value) write( "************************************... |
result = os.system(command) if result <> 0: write("-"*60) write("ERROR: Failed while running growisofs") write("Result %d, Command was: %s" % (result, command)) write("Please check the troubleshooting section of the README for ways to fix this error") write("-"*60) write("") os.exit(2) os.spawnlp(os.P_WAIT, 'eject', ... | if os.system(command) != 0: write("ERROR: Retrying to start growisofs after reload.") f = os.open(dvddrivepath, os.O_RDONLY | os.O_NONBLOCK) r = ioctl(f,CDROMEJECT, 0) os.close(f) f = os.open(dvddrivepath, os.O_RDONLY | os.O_NONBLOCK) r = ioctl(f,CDROMCLOSETRAY, 0) os.close(f) result = os.system(command) if result != 0... | def BurnDVDISO(): write( "Burning ISO image to %s" % dvddrivepath) checkCancelFlag() if mediatype == DVD_RW and erasedvdrw == True: command = path_growisofs[0] + " -use-the-force-luke -Z " + dvddrivepath + \ " -dvd-video -V 'MythTV BurnDVD' " + os.path.join(getTempPath(),'dvd') else: command = path_growisofs[0] + " -Z... |
os.exit(1) | sys.exit(1) | def selectStreams(folder): """Choose the streams we want from the source file""" video = (-1, 'N/A', -1) # index, codec, ID audio1 = (-1, 'N/A', -1, 'N/A') # index, codec, ID, lang audio2 = (-1, 'N/A', -1, 'N/A') #open the XML containing information about this file infoDOM = xml.dom.minidom.parse(os.p... |
os.exit(1) | sys.exit(1) | def selectAspectRatio(folder): """figure out what aspect ratio we want from the source file""" #this should be smarter and look though the file for any AR changes #at the moment it just uses the AR found at the start of the file #open the XML containing information about this file infoDOM = xml.dom.minidom.parse(os.p... |
os.exit(1) | sys.exit(1) | def getVideoCodec(folder): """Get the video codec from the streaminfo.xml for the file""" #open the XML containing information about this file infoDOM = xml.dom.minidom.parse(os.path.join(folder, 'streaminfo.xml')) #error out if its the wrong XML if infoDOM.documentElement.tagName != "file": fatalError("This does not ... |
os.exit(1) | sys.exit(1) | def getFileType(folder): """Get the overall file type from the streaminfo.xml for the file""" #open the XML containing information about this file infoDOM = xml.dom.minidom.parse(os.path.join(folder, 'streaminfo.xml')) #error out if its the wrong XML if infoDOM.documentElement.tagName != "file": fatalError("This does ... |
FROM recorded WHERE basename = '%s'""" % file.attributes["filename"].value | FROM recorded WHERE basename = '%s'""" % file.attributes["filename"].value.replace("'", "\\'") | def getFileInformation(file, outputfile): impl = xml.dom.minidom.getDOMImplementation() infoDOM = impl.createDocument(None, "fileinfo", None) top_element = infoDOM.documentElement # if the jobfile has amended file details use them details = file.getElementsByTagName("details") if details.length > 0: node = infoDOM.cre... |
details = jobDOM.getElementsByTagName("details") | details = file.getElementsByTagName("details") | def getFileInformation(file, outputfile): impl = xml.dom.minidom.getDOMImplementation() infoDOM = impl.createDocument(None, "fileinfo", None) top_element = infoDOM.documentElement # if the jobfile has amended file details use them details = jobDOM.getElementsByTagName("details") if details.length > 0: node = infoDOM.c... |
command = "mytharchivehelper -i '%s' '%s'" % (filename, xmlFilename) | filename = quoteFilename(filename) command = "mytharchivehelper -i %s %s" % (filename, xmlFilename) | def getStreamInformation(filename, xmlFilename): """create a stream.xml file for filename""" command = "mytharchivehelper -i '%s' '%s'" % (filename, xmlFilename) result = runCommand(command) if result <> 0: fatalError("Failed while running mytharchivehelper to get stream information from %s" % filename) |
command = "mytharchivehelper -t '" + source + "' '%s' %s " % (seconds, destination) | source = quoteFilename(source) command = "mytharchivehelper -t %s '%s' %s" % (source, seconds, destination) | def extractVideoFrame(source, destination, seconds): write("Extracting thumbnail image from %s at position %s" % (source, seconds)) write("Destination file %s" % destination) if doesFileExist(destination) == False: if videomode=="pal": fr=frameratePAL else: fr=framerateNTSC command = "mytharchivehelper -t '" + sourc... |
command = "mytharchivehelper -v important -t '" + source + "' '%s' %s " % (thumbList, destination) | source = quoteFilename(source) command = "mytharchivehelper -v important -t %s '%s' %s" % (source, thumbList, destination) | def extractVideoFrames(source, destination, thumbList): write("Extracting thumbnail images from: %s - at %s" % (source, thumbList)) write("Destination file %s" % destination) command = "mytharchivehelper -v important -t '" + source + "' '%s' %s " % (thumbList, destination) result = runCommand(command) if result <> 0:... |
def encodeHDTVToMPEG2(source, destvideofile): """Encodes an HDTV video source file DVD MPEG2 video and AC3 audio, use ffmpeg""" if videomode=="ntsc": encoderesolution=dvdNTSCD1 fr=framerateNTSC else: encoderesolution=dvdPALD1 fr=frameratePAL command = path_ffmpeg[0] + " -v 1 -i '%s' -r %s -target dvd -b 4000 -s ... | def extractVideoFrames(source, destination, thumbList): write("Extracting thumbnail images from: %s - at %s" % (source, thumbList)) write("Destination file %s" % destination) command = "mytharchivehelper -v important -t '" + source + "' '%s' %s " % (thumbList, destination) result = runCommand(command) if result <> 0:... | |
command = path_ffmpeg[0] + " -v 1 -i '%s' -r %s -target dvd -b 3000 -s %s -ab 192 -copyts " \ | source = quoteFilename(source) command = path_ffmpeg[0] + " -v 1 -i %s -r %s -target dvd -b 3000 -s %s -ab 192 -copyts " \ | def encodeVideoToMPEG2(source, destvideofile, video, audio1, audio2, aspectratio): """Encodes an unknown video source file eg. AVI to MPEG2 video and AC3 audio, use ffmpeg""" #MPEG-2 resolutions: 720x480, 720x576, 352x480, 352x576 if videomode=="ntsc": encoderesolution=dvdNTSCD1 else: encoderesolution=dvdPALD1 #192 i... |
command = "mythreplex --demux -o '%s' " % (folder + "/stream") | command = "mythreplex --demux -o %s " % (folder + "/stream") | def deMultiplexMPEG2File(folder, mediafile, video, audio1, audio2): checkCancelFlag() command = "mythreplex --demux -o '%s' " % (folder + "/stream") command += "-v %d " % (video[VIDEO_ID] & 255) if audio1[AUDIO_ID] != -1: if audio1[AUDIO_CODEC] == 'MP2': command += "-a %d " % (audio1[AUDIO_ID] & 255) elif audio1[AUD... |
recdate=time.strptime( "%s" % record[0],"%Y-%m-%d %H:%M:%S") | recdate = time.strptime(str(record[0])[0:19], "%Y-%m-%d %H:%M:%S") | def getFileInformation(file, outputfile): impl = xml.dom.minidom.getDOMImplementation() infoDOM = impl.createDocument(None, "fileinfo", None) top_element = infoDOM.documentElement # if the jobfile has amended file details use them details = file.getElementsByTagName("details") if details.length > 0: node = infoDOM.cre... |
recdate=time.strptime( "%s" % record[7],"%Y-%m-%d %H:%M:%S") | recdate = time.strptime(str(record[7])[0:19], "%Y-%m-%d %H:%M:%S") | def getFileInformation(file, outputfile): impl = xml.dom.minidom.getDOMImplementation() infoDOM = impl.createDocument(None, "fileinfo", None) top_element = infoDOM.documentElement # if the jobfile has amended file details use them details = file.getElementsByTagName("details") if details.length > 0: node = infoDOM.cre... |
sqlstatement="""select value, data from settings where value in('TVFormat', 'DBSchemaVer') | sqlstatement="""select value, data from settings where value in('DBSchemaVer') | def getDefaultParametersFromMythTVDB(): """Reads settings from MythTV database""" write( "Obtaining MythTV settings from MySQL database for hostname " + configHostname) #TVFormat is not dependant upon the hostname. sqlstatement="""select value, data from settings where value in('TVFormat', 'DBSchemaVer') or (hostname... |
os.rename(os.path.join(getTempPath(), 'mythburn.iso'), savefilename) | try: os.rename(os.path.join(getTempPath(), 'mythburn.iso'), savefilename) except: f1 = open(os.path.join(getTempPath(), 'mythburn.iso'), 'rb') f2 = open(savefilename, 'wb') data = f1.read(1024 * 1024) while data: f2.write(data) data = f1.read(1024 * 1024) f1.close() f2.close() os.unlink(os.path.join(getTempPath(), 'myt... | def processJob(job): """Starts processing a MythBurn job, expects XML nodes to be passed as input.""" global wantIntro, wantMainMenu, wantChapterMenu, wantDetailsPage global themeDOM, themeName, themeFonts media=job.getElementsByTagName("media") if media.length==1: themeName=job.attributes["theme"].value #Check the... |
videomode = string.lower(defaultsettings["TVFormat"]) | videomode = string.lower(defaultsettings["MythArchiveVideoFormat"]) | def usage(): write(""" -h/--help (Show this usage) -j/--jobfile file (use file as the job file) -l/--progresslog file (log file to output progress messages) """) |
if getAspectRatioOfVideo(itemnum) > 1.4: | if getAspectRatioOfVideo(itemnum) > aspectRatioThreshold: | def createDVDAuthorXML(screensize, numberofitems): """Creates the xml file for dvdauthor to use the MythBurn menus.""" #Get the main menu node (we must only have 1) menunode=themeDOM.getElementsByTagName("menu") if menunode.length!=1: fatalError("Cannot find the menu element in the theme file") menunode=menunode[0] m... |
if getAspectRatioOfVideo(page) > 1.4: | if getAspectRatioOfVideo(page) > aspectRatioThreshold: | def createChapterMenu(screensize, screendpi, numberofitems): """Creates all the necessary menu images and files for the MythBurn menus.""" #Get the main menu node (we must only have 1) menunode=themeDOM.getElementsByTagName("submenu") if menunode.length!=1: fatalError("Cannot find submenu element in theme file") menun... |
if getAspectRatioOfVideo(itemnum) > 1.4: | if getAspectRatioOfVideo(itemnum) > aspectRatioThreshold: | def createDetailsPage(screensize, screendpi, numberofitems): """Creates all the necessary images and files for the details page.""" write( "Creating details pages") #Get the detailspage node (we must only have 1) detailnode=themeDOM.getElementsByTagName("detailspage") if detailnode.length!=1: fatalError("Cannot find ... |
vob.setAttribute("file",os.path.join(getThemFile(themeName, videomode + '_' + introFile))) | vob.setAttribute("file",os.path.join(getThemeFile(themeName, videomode + '_' + introFile))) | def createDVDAuthorXMLNoMenus(screensize, numberofitems): """Creates the xml file for dvdauthor containing no menus.""" # creates a simple DVD with no menus that chains the videos one after the other # can contain an intro movie and each title can have a details page # displayed before each title write( "Creating DVD... |
if file.attributes["type"].value=="recording": sqlstatement = """SELECT starttime, chanid FROM recorded WHERE basename = '%s'""" % file.attributes["filename"].value.replace("'", "\\'") db = getDatabaseConnection() cursor = db.cursor() cursor.execute(sqlstatement) result = cursor.fetchall() numrows = int(cursor.rowcou... | def getFileInformation(file, outputfile): impl = xml.dom.minidom.getDOMImplementation() infoDOM = impl.createDocument(None, "fileinfo", None) top_element = infoDOM.documentElement # if the jobfile has amended file details use them details = file.getElementsByTagName("details") if details.length > 0: node = infoDOM.cre... | |
def runMythtranscode(chanid, starttime, destination, usecutlist): | def runMythtranscode(chanid, starttime, destination, usecutlist, localfile): | def runMythtranscode(chanid, starttime, destination, usecutlist): """Use mythtrancode to cut commercials and/or clean up an mpeg2 file""" if usecutlist == True: command = "mythtranscode --mpeg2 --honorcutlist -c %s -s %s -o %s" % (chanid, starttime, destination) else: command = "mythtranscode --mpeg2 -c %s -s %s -o %s... |
if usecutlist == True: command = "mythtranscode --mpeg2 --honorcutlist -c %s -s %s -o %s" % (chanid, starttime, destination) | if localfile != "": if usecutlist == True: command = "mythtranscode --mpeg2 --honorcutlist -i %s -o %s" % (localfile, destination) else: command = "mythtranscode --mpeg2 -i %s -o %s" % (localfile, destination) | def runMythtranscode(chanid, starttime, destination, usecutlist): """Use mythtrancode to cut commercials and/or clean up an mpeg2 file""" if usecutlist == True: command = "mythtranscode --mpeg2 --honorcutlist -c %s -s %s -o %s" % (chanid, starttime, destination) else: command = "mythtranscode --mpeg2 -c %s -s %s -o %s... |
command = "mythtranscode --mpeg2 -c %s -s %s -o %s" % (chanid, starttime, destination) | if usecutlist == True: command = "mythtranscode --mpeg2 --honorcutlist -c %s -s %s -o %s" % (chanid, starttime, destination) else: command = "mythtranscode --mpeg2 -c %s -s %s -o %s" % (chanid, starttime, destination) | def runMythtranscode(chanid, starttime, destination, usecutlist): """Use mythtrancode to cut commercials and/or clean up an mpeg2 file""" if usecutlist == True: command = "mythtranscode --mpeg2 --honorcutlist -c %s -s %s -o %s" % (chanid, starttime, destination) else: command = "mythtranscode --mpeg2 -c %s -s %s -o %s... |
if runMythtranscode(chanid, starttime, os.path.join(folder,'tmp'), True): | if runMythtranscode(chanid, starttime, os.path.join(folder,'tmp'), True, localfile): | def processFile(file, folder): """Process a single video/recording file ready for burning.""" write( "*************************************************************") write( "Processing file " + file.attributes["filename"].value + " of type " + file.attributes["type"].value) write( "************************************... |
if runMythtranscode(chanid, starttime, os.path.join(folder, 'newfile.mpg'), False): | if runMythtranscode(chanid, starttime, os.path.join(folder, 'newfile.mpg'), False, localfile): | def processFile(file, folder): """Process a single video/recording file ready for burning.""" write( "*************************************************************") write( "Processing file " + file.attributes["filename"].value + " of type " + file.attributes["type"].value) write( "************************************... |
getStreamInformation(mediafile, os.path.join(folder, "streaminfo.xml"), 0) video, audio1, audio2 = selectStreams(folder) aspectratio = selectAspectRatio(folder) write("Re-encoding audio and video") if file.hasAttribute("localfilename"): mediafile = file.attributes["localfilename"].value if file.hasAttribute("e... | if getFileType(folder) == 'nuv': getStreamInformation(mediafile, os.path.join(folder, "streaminfo.xml"), 0) video, audio1, audio2 = selectStreams(folder) aspectratio = selectAspectRatio(folder) write("Re-encoding audio and video from nuv file") if file.hasAttribute("localfilename"): mediafile = file.attribu... | def processFile(file, folder): """Process a single video/recording file ready for burning.""" write( "*************************************************************") write( "Processing file " + file.attributes["filename"].value + " of type " + file.attributes["type"].value) write( "************************************... |
profile = defaultEncodingProfile encodeVideoToMPEG2(mediafile, os.path.join(folder, "newfile2.mpg"), video, audio1, audio2, aspectratio, profile) mediafile = os.path.join(folder, 'newfile2.mpg') | getStreamInformation(mediafile, os.path.join(folder, "streaminfo.xml"), 0) video, audio1, audio2 = selectStreams(folder) aspectratio = selectAspectRatio(folder) write("Re-encoding audio and video") if file.hasAttribute("localfilename"): mediafile = file.attributes["localfilename"].value if file.hasAttribute("e... | def processFile(file, folder): """Process a single video/recording file ready for burning.""" write( "*************************************************************") write( "Processing file " + file.attributes["filename"].value + " of type " + file.attributes["type"].value) write( "************************************... |
node.appendChild(infoDOM.createTextNode("%s" % record[0])) | node.appendChild(infoDOM.createTextNode("%s" % record[1])) | def getFileInformation(file, outputfile): impl = xml.dom.minidom.getDOMImplementation() infoDOM = impl.createDocument(None, "fileinfo", None) top_element = infoDOM.documentElement # if the jobfile has amended file details use them details = file.getElementsByTagName("details") if details.length > 0: node = infoDOM.cre... |
recdate=time.strptime( "%s" % record[1],"%Y-%m-%d %H:%M:%S") | recdate=time.strptime( "%s" % record[0],"%Y-%m-%d %H:%M:%S") | def getFileInformation(file, outputfile): impl = xml.dom.minidom.getDOMImplementation() infoDOM = impl.createDocument(None, "fileinfo", None) top_element = infoDOM.documentElement # if the jobfile has amended file details use them details = file.getElementsByTagName("details") if details.length > 0: node = infoDOM.cre... |
video = (int(node.attributes["streamindex"].value), node.attributes["codec"].value, int(node.attributes["id"].value)) | video = (int(node.attributes["ffmpegindex"].value), node.attributes["codec"].value, int(node.attributes["id"].value)) | def selectStreams(folder): """Choose the streams we want from the source file""" video = (-1, 'N/A', -1) # index, codec, ID audio1 = (-1, 'N/A', -1, 'N/A') # index, codec, ID, lang audio2 = (-1, 'N/A', -1, 'N/A') #open the XML containing information about this file infoDOM = xml.dom.minidom.parse(os.p... |
index = int(node.attributes["streamindex"].value) | index = int(node.attributes["ffmpegindex"].value) | def selectStreams(folder): """Choose the streams we want from the source file""" video = (-1, 'N/A', -1) # index, codec, ID audio1 = (-1, 'N/A', -1, 'N/A') # index, codec, ID, lang audio2 = (-1, 'N/A', -1, 'N/A') #open the XML containing information about this file infoDOM = xml.dom.minidom.parse(os.p... |
int(node.attributes["streamindex"].value) | int(node.attributes["ffmpegindex"].value) | def selectStreams(folder): """Choose the streams we want from the source file""" video = (-1, 'N/A', -1) # index, codec, ID audio1 = (-1, 'N/A', -1, 'N/A') # index, codec, ID, lang audio2 = (-1, 'N/A', -1, 'N/A') #open the XML containing information about this file infoDOM = xml.dom.minidom.parse(os.p... |
environPath = os.getenv("PATH") os.environ['PATH'] += "/bin:/sbin:/usr/local/bin:/usr/bin:/opt/bin:" getMysqlDBParameters(); | if not os.environ['PATH'].endswith(':'): os.environ['PATH'] += ":" os.environ['PATH'] += "/bin:/sbin:/usr/local/bin:/usr/bin:/opt/bin:" + installPrefix +"/bin:" | def usage(): write(""" -h/--help (Show this usage) -j/--jobfile file (use file as the job file) -l/--progresslog file (log file to output progress messages) """) |
def encodeMenu(background, tempvideo, music, musiclength, tempmovie, xmlfile, finaloutput): | def encodeMenu(background, tempvideo, music, musiclength, tempmovie, xmlfile, finaloutput, aspectratio): | def encodeMenu(background, tempvideo, music, musiclength, tempmovie, xmlfile, finaloutput): if videomode=="pal": framespersecond=frameratePAL else: framespersecond=framerateNTSC totalframes=int(musiclength * framespersecond) command = path_png2yuv[0] + " -n %s -v0 -I p -f %s -j '%s' | %s -b 5000 -a 3 -v 1 -f 8 -o '%s... |
command = path_png2yuv[0] + " -n %s -v0 -I p -f %s -j '%s' | %s -b 5000 -a 3 -v 1 -f 8 -o '%s'" \ % (totalframes, framespersecond, background, path_mpeg2enc[0], tempvideo) | command = path_png2yuv[0] + " -n %s -v0 -I p -f %s -j '%s' | %s -b 5000 -a %s -v 1 -f 8 -o '%s'" \ % (totalframes, framespersecond, background, path_mpeg2enc[0], aspectratio, tempvideo) | def encodeMenu(background, tempvideo, music, musiclength, tempmovie, xmlfile, finaloutput): if videomode=="pal": framespersecond=frameratePAL else: framespersecond=framerateNTSC totalframes=int(musiclength * framespersecond) command = path_png2yuv[0] + " -n %s -v0 -I p -f %s -j '%s' | %s -b 5000 -a 3 -v 1 -f 8 -o '%s... |
write("Encoding Menu Page %s" % page) | if mainmenuAspectRatio == "4:3": aspect_ratio = 2 else: aspect_ratio = 3 write("Encoding Menu Page %s using aspect ratio '%s'" % (page, mainmenuAspectRatio)) | def createMenu(screensize, screendpi, numberofitems): """Creates all the necessary menu images and files for the MythBurn menus.""" #Get the main menu node (we must only have 1) menunode=themeDOM.getElementsByTagName("menu") if menunode.length!=1: fatalError("Cannot find menu element in theme file") menunode=menunode[... |
os.path.join(getTempPath(),"menu-%s.mpg" % page)) | os.path.join(getTempPath(),"menu-%s.mpg" % page), aspect_ratio) | def createMenu(screensize, screendpi, numberofitems): """Creates all the necessary menu images and files for the MythBurn menus.""" #Get the main menu node (we must only have 1) menunode=themeDOM.getElementsByTagName("menu") if menunode.length!=1: fatalError("Cannot find menu element in theme file") menunode=menunode[... |
write("Encoding Chapter Menu Page %s" % page) | if chaptermenuAspectRatio == "4:3": aspect_ratio = '2' elif chaptermenuAspectRatio == "16:9": aspect_ratio = '3' else: if getAspectRatioOfVideo(page) > 1.4: aspect_ratio = '3' else: aspect_ratio = '2' write("Encoding Chapter Menu Page %s using aspect ratio '%s'" % (page, chaptermenuAspectRatio)) | def createChapterMenu(screensize, screendpi, numberofitems): """Creates all the necessary menu images and files for the MythBurn menus.""" #Get the main menu node (we must only have 1) menunode=themeDOM.getElementsByTagName("submenu") if menunode.length!=1: fatalError("Cannot find submenu element in theme file") menun... |
os.path.join(getTempPath(),"chaptermenu-%s.mpg" % page)) | os.path.join(getTempPath(),"chaptermenu-%s.mpg" % page), aspect_ratio) | def createChapterMenu(screensize, screendpi, numberofitems): """Creates all the necessary menu images and files for the MythBurn menus.""" #Get the main menu node (we must only have 1) menunode=themeDOM.getElementsByTagName("submenu") if menunode.length!=1: fatalError("Cannot find submenu element in theme file") menun... |
os.path.join(getTempPath(),"details-%s.mpg" % itemnum)) | os.path.join(getTempPath(),"details-%s.mpg" % itemnum), aspect_ratio) | def createDetailsPage(screensize, screendpi, numberofitems): """Creates all the necessary images and files for the details page.""" write( "Creating details pages") #Get the detailspage node (we must only have 1) detailnode=themeDOM.getElementsByTagName("detailspage") if detailnode.length!=1: fatalError("Cannot find ... |
write("File will be re-encode using profile %s" % file.attributes["encodingprofile"].value) | write("File will be re-encoded using profile %s" % file.attributes["encodingprofile"].value) | def isFileOkayForDVD(file, folder): """return true if the file is dvd compliant""" if string.lower(getVideoCodec(folder)) != "mpeg2video": return False |
write("File has a cut list - attempting to run mythtrancode to remove unwanted segments") | write("File has a cut list - running mythtrancode to remove unwanted segments") | def processFile(file, folder): """Process a single video/recording file ready for burning.""" write( "*************************************************************") write( "Processing file " + file.attributes["filename"].value + " of type " + file.attributes["type"].value) write( "************************************... |
write("Attempting to run mythtranscode --mpeg2 to fix any errors") | write("Running mythtranscode --mpeg2 to fix any errors") | def processFile(file, folder): """Process a single video/recording file ready for burning.""" write( "*************************************************************") write( "Processing file " + file.attributes["filename"].value + " of type " + file.attributes["type"].value) write( "************************************... |
def createVideoChapters(segment, lengthofvideo): | def createVideoChaptersFixedLength(segment, lengthofvideo): | def createVideoChapters(segment, lengthofvideo): """Returns chapter marks spaced segment seconds through the file""" if lengthofvideo < segment: return "00:00:00" numofchapters = lengthofvideo / segment; chapters = "" starttime = 0 count = 1 while count <= numofchapters: chapters += time.strftime("%H:%M:%S", time.gmti... |
vob.setAttribute("chapters", createVideoChapters(chapterLength, getLengthOfVideo(itemnum))) | vob.setAttribute("chapters", createVideoChaptersFixedLength(chapterLength, getLengthOfVideo(itemnum))) | def createDVDAuthorXML(screensize, numberofitems): """Creates the xml file for dvdauthor to use the MythBurn menus.""" #Get the main menu node (we must only have 1) menunode=themeDOM.getElementsByTagName("menu") if menunode.length!=1: fatalError("Cannot find the menu element in the theme file") menunode=menunode[0] m... |
vob.setAttribute("chapters", createVideoChapters(chapterLength, getLengthOfVideo(itemNum))) | vob.setAttribute("chapters", createVideoChaptersFixedLength(chapterLength, getLengthOfVideo(itemNum))) | def createDVDAuthorXMLNoMenus(screensize, numberofitems): """Creates the xml file for dvdauthor containing no menus.""" # creates a simple DVD with no menus that chains the videos one after the other # can contain an intro movie and each title can have a details page # displayed before each title write( "Creating DVD... |
vob.setAttribute("chapters",createVideoChapters(itemnum,8,getLengthOfVideo(itemnum),False) ) | vob.setAttribute("chapters", createVideoChapters(chapterLength, getLengthOfVideo(itemnum))) | def createDVDAuthorXML(screensize, numberofitems): """Creates the xml file for dvdauthor to use the MythBurn menus.""" #Get the main menu node (we must only have 1) menunode=themeDOM.getElementsByTagName("menu") if menunode.length!=1: fatalError("Cannot find the menu element in the theme file") menunode=menunode[0] m... |
thumbList+="%s," % starttime | if starttime==0: if thumboffset < segment: thumbList+="%s," % thumboffset else: thumbList+="%s," % starttime else: thumbList+="%s," % starttime | def createVideoChapters(itemnum, numofchapters, lengthofvideo, getthumbnails): """Returns numofchapters chapter marks even spaced through a certain time period""" segment=int(lengthofvideo / numofchapters) write( "Video length is %s seconds. Each chapter will be %s seconds" % (lengthofvideo,segment)) chapters="" thum... |
extractVideoFrame(os.path.join(folder,"stream.mv2"), os.path.join(folder,"thumbnail.jpg"), 0) | if file.attributes["type"].value == "recording": previewImage = os.path.join(recordingpath, file.attributes["filename"].value + ".png") if usebookmark == True and os.path.exists(previewImage): copy(previewImage, os.path.join(folder, "thumbnail.jpg")) else: extractVideoFrame(os.path.join(folder, "stream.mv2"), os.path.j... | def processFile(file, folder): """Process a single video/recording file ready for burning.""" write( "*************************************************************") write( "Processing file " + file.attributes["filename"].value + " of type " + file.attributes["type"].value) write( "************************************... |
post.appendChild(dvddom.createTextNode("jump title %s chapter 1;" % itemNum + 1)) | post.appendChild(dvddom.createTextNode("jump title %d chapter 1;" % (itemNum + 1))) | def createDVDAuthorXMLNoMenus(screensize, numberofitems): """Creates the xml file for dvdauthor containing no menus.""" # creates a simple DVD with no menus that chains the videos one after the other # can contain an intro movie and each title can have a details page # displayed before each title write( "Creating DVD... |
def copyRemote(files,tmpPath): | def copyRemote(files, tmpPath): '''go through the list of files looking for files on remote filesytems and copy them to a local file for quicker processing''' | def copyRemote(files,tmpPath): localTmpPath = os.path.join(tmpPath, "localcopy") # Define remote filesystems remotefs = ['nfs','smbfs'] remotemounts = [] # What does mount say? mounts = os.popen('mount') # Go through each line of mounts output for line in mounts.readlines(): parts = line.split() # mount says in this fo... |
remotefs = ['nfs','smbfs'] remotemounts = [] mounts = os.popen('mount') for line in mounts.readlines(): parts = line.split() device, txt1, mountpoint, txt2, filesystem, options = parts if filesystem in remotefs: remotemounts.append(string.split(mountpoint,'/')) for node in files: for mount in remotemounts: tmpfi... | for node in files: tmpfile = node.attributes["filename"].value filename = os.path.basename(tmpfile) res = runCommand("mytharchivehelper -r " + quoteFilename(tmpfile)) if res == 2: write("Copying file from " + tmpfile) write("to " + os.path.join(localTmpPath, filename)) if not doesFileExist(os.path.join(localTmpPath... | def copyRemote(files,tmpPath): localTmpPath = os.path.join(tmpPath, "localcopy") # Define remote filesystems remotefs = ['nfs','smbfs'] remotemounts = [] # What does mount say? mounts = os.popen('mount') # Go through each line of mounts output for line in mounts.readlines(): parts = line.split() # mount says in this fo... |
command = "mythreplex --demux -t TS -o %s " % (folder + "/stream") | command = "mythreplex --demux --fix_sync -t TS -o %s " % (folder + "/stream") | def deMultiplexMPEG2File(folder, mediafile, video, audio1, audio2): checkCancelFlag() if getFileType(folder) == "mpegts": command = "mythreplex --demux -t TS -o %s " % (folder + "/stream") command += "-v %d " % (video[VIDEO_ID]) if audio1[AUDIO_ID] != -1: if audio1[AUDIO_CODEC] == 'MP2': command += "-a %d " % (audio... |
command = "mythreplex --demux -o %s " % (folder + "/stream") | command = "mythreplex --demux --fix_sync -o %s " % (folder + "/stream") | def deMultiplexMPEG2File(folder, mediafile, video, audio1, audio2): checkCancelFlag() if getFileType(folder) == "mpegts": command = "mythreplex --demux -t TS -o %s " % (folder + "/stream") command += "-v %d " % (video[VIDEO_ID]) if audio1[AUDIO_ID] != -1: if audio1[AUDIO_CODEC] == 'MP2': command += "-a %d " % (audio... |
fatalError("Failed while running dvdauthor") | fatalError("Failed while running dvdauthor. Result: %d" % result) | def runDVDAuthor(): write( "Starting dvdauthor") checkCancelFlag() result=os.spawnlp(os.P_WAIT, path_dvdauthor[0],path_dvdauthor[1],'-x',os.path.join(getTempPath(),'dvdauthor.xml')) if result<>0: fatalError("Failed while running dvdauthor") write( "Finished dvdauthor") |
if numpy.less(ut, 0.) or numpy.greater(ut, 1.): | if numpy.any(ut < 0.) or numpy.any(ut > 1.): | def pnt4D(self, ut): "Evaluate parametric point[s] and return 4D homogeneous coordinates" ut = numpy.asarray(ut, numpy.Float) if numpy.less(ut, 0.) or numpy.greater(ut, 1.): raise NURBSError, 'NURBS curve parameter out of range [0,1]' return bspeval(self.degree, self.cntrl, self.uknots, ut) |
assert_equal(features['row'][0],38.3727) assert_equal(features['column'][1],61.474) | assert_equal(features['column'][1],68.5773) assert_equal(features['row'][0],62.0491) | def check_read_SURF(self): f = TemporaryFile() f.write('''65 |
P.xlabel("Y-axis") | P.ylabel("Y-axis") | def plot(self, n=50): """A simple plotting function for debugging purpose |
return "Polygon_" + str(len(self.x)) + '_' + \ self.x.__array_interface__['data'][0] + '_' + \ self.y.__array_interface__['data'][0] | return "Polygon_%d_%d_%d" % (len(self.x), self.x.__array_interface__['data'][0], self.y.__array_interface__['data'][0]) | def __repr__(self): return "Polygon_" + str(len(self.x)) + '_' + \ self.x.__array_interface__['data'][0] + '_' + \ self.y.__array_interface__['data'][0] |
def inside(self,xp,yp): | def _inside(self,xp,yp): | def inside(self,xp,yp): """Check whether given points are in the polygon. |
assert_array_almost_equal(r,[[0,0],[0,1],[1,1],[0,1],[0,0]]) | assert_array_almost_equal(r,[[0,0],[1,0],[1,1],[0,1],[0,0]]) | def check_rectangle(self,level=1): rect = coord_path.rectangle((0,0),(1,1)) r = coord_path.build(rect) assert_array_almost_equal(r,[[0,0],[0,1],[1,1],[0,1],[0,0]]) |
xi,yi,x,y = atype([x_vertices,y_vertices, x_points,y_points],[N.double]*4) | xi,yi,x,y = _atype([x_vertices,y_vertices, x_points,y_points],[N.double]*4) | def npnpoly(x_vertices, y_vertices, x_points, y_points): """Calculate whether points are in a given polygon. The polygon must be closed, i.e. x_vertices[0] == x_vertices[-1]. Returns a boolean array of length len(x_points). """ xi,yi,x,y = atype([x_vertices,y_vertices, x_points,y_points],[N.double]*4) out = N.empty... |
if numpy.less(uknots, 0.) or numpy.greater(uknots, 1.): | if numpy.any(uknots < 0.) or numpy.any(uknots > 1.): | def kntins(self, uknots): """Insert new knots into the curve |
P.axis("equal") P.axes([minx,maxx,miny,maxy]) | P.axis("scaled") | def plot(self, n=50): """A simple plotting function for debugging purpose |
cur.execute("insert into foafs(uri, sha, date, self) values ("+uri+","+sha+","+date+","+me+")") | cur.execute("insert into foafs(uri, date, self) values ("+uri+","+date+","+me+")") | def insert(self, uri, sha, me=False): if not self.exists(uri): date = "20061207" me = self.bool2str(me) cur = self.connect() cur.execute("insert into foafs(uri, sha, date, self) values ("+uri+","+sha+","+date+","+me+")") else: print "Error: " + uri + " already exist on db" |
def __init__(self, foaf): | def __init__(self, foaf=None): | def __init__(self, foaf): |
self.uri = foaf.replace(":","_").replace("/","_") | def __init__(self, foaf): | |
cur.execute("insert into foafs(uri, date, self) values ("+uri+","+date+","+me+")") | cur.execute("insert into foafs(uri, date, self) values ('"+uri+"','"+date+"','"+me+"')") | def insert(self, uri, sha, me=False): if not self.exist(uri): date = self.todayDate() me = self.bool2str(me) cur = self.connect() cur.execute("insert into foafs(uri, date, self) values ("+uri+","+date+","+me+")") else: print "Error: " + uri + " already exist on db" |
GD.canPlay = utils.isPyFormex(filename) self.curfile.setText(os.path.basename(filename)) self.actions['Play'].setEnabled(GD.canPlay) if GD.canPlay: icon = 'happy' else: icon = 'unhappy' self.smiley.setPixmap(QtGui.QPixmap(os.path.join(GD.cfg['icondir'],icon)+GD.cfg['gui/icontype'])) | if filename: GD.canPlay = utils.isPyFormex(filename) self.curfile.setText(os.path.basename(filename)) self.actions['Play'].setEnabled(GD.canPlay) if GD.canPlay: icon = 'happy' else: icon = 'unhappy' self.smiley.setPixmap(QtGui.QPixmap(os.path.join(GD.cfg['icondir'],icon)+GD.cfg['gui/icontype'])) | def setcurfile(self,filename=None): """Set the current file and check whether it is a pyFormex script. |
distance(r), longitude(theta) and height(z). scale will scale the coordinate values prior to the transformation """ f = zeros(self.f.shape) | distance(r), angle(theta) and height(z). scale will scale the coordinate values prior to the transformation. angle is then interpreted as degrees. """ f = zeros(self.f.shape,type=Float32) | def cylindrical(self,dir=[0,1,2],scale=[1.,1.,1.]): """Converts from cylindrical to cartesian after scaling. |
f[:,:,2] = b3 return Formex(f) def spherical(self,b1,b2,b3): | f[:,:,2] = scale[2] * self.f[:,:,dir[2]] return Formex(f) def spherical(self,dir=[0,1,2],scale=[1.,1.,1.]): | def cylindrical(self,dir=[0,1,2],scale=[1.,1.,1.]): """Converts from cylindrical to cartesian after scaling. |
The first coordinate is the distance, the second is the colatitude (elevation measured from 0 in the zenit, the third is the longitude """ f = copy.deepcopy(self.f) r = b1*f[:,:,0] s = math.radians(b2)*f[:,:,1] t = math.radians(b3)*f[:,:,2] rc = r*sin(t) f[:,:,0] = rc*cos(s) f[:,:,1] = rc*sin(s) f[:,:,2] = r*cos(t) | <dir> specifies which coordinates are interpreted as resp. distance(r), longitude(theta) and colatitude(phi). <scale> will scale the coordinate values prior to the transformation. Angles are then interpreted in degrees. Colatitude is 90 degrees - latitude, i.e. the elevation angle measured from north pole(0) to south p... | def spherical(self,b1,b2,b3): """Converts from spherical to cartesian after scaling. |
return Formex(self.f) def nonzero(self): """Return a formex which holds only the nonzero elements. A zero element is an element where all nodes are equal.""" | def unique(self): """Return a formex which holds only the unique cantles.""" # NOT IMPLEMENTED YET !!! FOR NOW, RETURNS A COPY return Formex(self.f) | |
f = zeros(self.f.shape) | f = zeros(self.f.shape,type=Float32) | def map(self,func): """Return a Formex where point is mapped by a 3-D function. |
f[:,:,i[i]],f[:,:,1],f[:,:,2] = self.f[:,:,0],self.f[:,:,1],self.f[:, | f[:,:,i[k]] = self.f[:,:,j[k]] | def replace(self,i,j): """Replace the coordinates along the axes i by those along j. |
f = zeros(self.f.shape) | f = zeros(self.f.shape,type=Float32) | def map1(self,func): """Return a Formex where each coordinate is mapped by a 1-D function. |
return self.cylindrical(b1,b2,b3) | return self.cylindrical(scale=[b1,b2,b3]) | def bc(self,b1,b2,b3): return self.cylindrical(b1,b2,b3) |
return self.cylindrical(b1,b2,1.) | return self.cylindrical(scale=[b1,b2,1.]) | def bp(self,b1,b2): return self.cylindrical(b1,b2,1.) |
return self.spherical(b1,b2,b3) | return self.spherical(scale=[b1,b2,b3]) | def bs(self,b1,b2,b3): return self.spherical(b1,b2,b3) |
class CascadingKeyError(KeyError): """A KeyError exception for use in CascadingDict.""" pass | def update(self,data={}): """Add a dictionary to the Dict object. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.