MythTV  master
Classes | Namespaces | Functions | Variables
mythburn.py File Reference

Go to the source code of this file.

Classes

class  mythburn.FontDef
 class to hold a font definition More...
 

Namespaces

 mythburn
 

Functions

def mythburn.simple_fix_rtl (str)
 
def mythburn.write (text, progress=True)
 
def mythburn.fatalError (msg)
 Display an error message and exit. More...
 
def mythburn.nonfatalError (msg)
 
def mythburn.quoteString (str)
 Return the input string with single quotes escaped. More...
 
def mythburn.getTempPath ()
 Directory where all temporary files will be created. More...
 
def mythburn.getCPUCount ()
 Try to work out how many cpus we have available. More...
 
def mythburn.getEncodingProfilePath ()
 Get the directory where all encoder profile files are located. More...
 
def mythburn.doesFileExist (file)
 Returns true/false if a given file or path exists. More...
 
def mythburn.quoteCmdArg (arg)
 Escape quotes in a command line argument. More...
 
def mythburn.getText (node)
 Returns the text contents from a given XML element. More...
 
def mythburn.getThemeFile (theme, file)
 Try to find a theme file. More...
 
def mythburn.getFontPathName (fontname)
 Returns the path where we can find our fonts. More...
 
def mythburn.getItemTempPath (itemnumber)
 Creates a file path where the temp files for a video file can be created. More...
 
def mythburn.validateTheme (theme)
 Returns True if the theme.xml file can be found for the given theme. More...
 
def mythburn.isResolutionOkayForDVD (videoresolution)
 Returns True if the given resolution is a DVD compliant one. More...
 
def mythburn.deleteAllFilesInFolder (folder)
 Removes all the files from a directory. More...
 
def mythburn.deleteEverythingInFolder (folder)
 Romoves all the objects from a directory. More...
 
def mythburn.checkCancelFlag ()
 Check to see if the user has cancelled the DVD creation process. More...
 
def mythburn.runCommand (command)
 Runs an external command checking to see if the user has cancelled the DVD creation process. More...
 
def mythburn.secondsToFrames (seconds)
 Convert a time in seconds to a frame number. More...
 
def mythburn.encodeMenu (background, tempvideo, music, musiclength, tempmovie, xmlfile, finaloutput, aspectratio)
 Creates a short mpeg file from a jpeg image and an ac3 sound track. More...
 
def mythburn.findEncodingProfile (profile)
 Return an xml node from a re-encoding profile xml file for a given profile name. More...
 
def mythburn.getThemeConfigurationXML (theme)
 Load the theme.xml file for a DVD theme. More...
 
def mythburn.getLengthOfVideo (index)
 Gets the duration of a video file from its stream info file. More...
 
def mythburn.getAudioParams (folder)
 Gets the audio sample rate and number of channels of a video file from its stream info file. More...
 
def mythburn.getVideoParams (folder)
 Gets the video resolution, frames per second and aspect ratio of a video file from its stream info file. More...
 
def mythburn.getAspectRatioOfVideo (index)
 Gets the aspect ratio of a video file from its stream info file. More...
 
def mythburn.calcSyncOffset (index)
 Calculates the sync offset between the video and first audio stream. More...
 
def mythburn.getFormatedLengthOfVideo (index)
 Gets the length of a video file and returns it as a string. More...
 
def mythburn.frameToTime (frame, fps)
 Convert a frame number to a time string. More...
 
def mythburn.timeStringToSeconds (formatedtime)
 Convert a time string of format 00:00:00 to number of seconds. More...
 
def mythburn.createVideoChapters (itemnum, numofchapters, lengthofvideo, getthumbnails)
 Creates a set of chapter points evenly spread thoughout a file Optionally grabs the thumbnails from the file. More...
 
def mythburn.createVideoChaptersFixedLength (itemnum, segment, lengthofvideo)
 Creates some fixed length chapter marks. More...
 
def mythburn.getDefaultParametersFromMythTVDB ()
 Reads a load of settings from DB. More...
 
def mythburn.saveSetting (name, data)
 Save a setting to the settings table in the DB. More...
 
def mythburn.clearArchiveItems ()
 Remove all archive items from the archiveitems DB table. More...
 
def mythburn.getOptions (options)
 Load the options from the options node passed in the job file. More...
 
def mythburn.expandItemText (infoDOM, text, itemnumber, pagenumber, keynumber, chapternumber, chapterlist)
 Substitutes some text from a theme file with the required values. More...
 
def mythburn.getScaledAttribute (node, attribute)
 Scale a theme position/size depending on the current video mode. More...
 
def mythburn.intelliDraw (drawer, text, font, containerWidth)
 Splits some text into lines so it will fit into a given container. More...
 
def mythburn.paintBackground (image, node)
 Paints a background rectangle onto an image. More...
 
def mythburn.paintButton (draw, bgimage, bgimagemask, node, infoDOM, itemnum, page, itemsonthispage, chapternumber, chapterlist)
 Paints a button onto an image. More...
 
def mythburn.paintText (draw, image, text, node, color=None, x=None, y=None, width=None, height=None)
 Paint some theme text on to an image. More...
 
def mythburn.paintImage (filename, maskfilename, imageDom, destimage, stretch=True)
 Paint an image on the background image. More...
 
def mythburn.checkBoundaryBox (boundarybox, node)
 Check if boundary box need adjusting. More...
 
def mythburn.loadFonts (themeDOM)
 Load the font defintions from a DVD theme file. More...
 
def mythburn.getFileInformation (file, folder)
 Creates an info xml file from details in the job file or from the DB. More...
 
def mythburn.WriteXMLToFile (myDOM, filename)
 Write an xml file to disc. More...
 
def mythburn.preProcessFile (file, folder, count)
 Pre-process a single video/recording file. More...
 
def mythburn.encodeAudio (format, sourcefile, destinationfile, deletesourceafterencode)
 Re-encodes an audio stream to ac3. More...
 
def mythburn.multiplexMPEGStream (video, audio1, audio2, destination, syncOffset)
 Recombines a video and one or two audio streams back together adding in the NAV packets required to create a DVD. More...
 
def mythburn.getStreamInformation (filename, xmlFilename, lenMethod)
 Creates a stream xml file for a video file. More...
 
def mythburn.getVideoSize (xmlFilename)
 Gets the video width and height from a file's stream xml file. More...
 
def mythburn.runMythtranscode (chanid, starttime, destination, usecutlist, localfile)
 Run a file though the lossless encoder optionally removing commercials. More...
 
def mythburn.generateProjectXCutlist (chanid, starttime, folder)
 Create a projectX cut list for a recording. More...
 
def mythburn.runProjectX (chanid, starttime, folder, usecutlist, file)
 Use Project-X to cut commercials and/or demux an mpeg2 file. More...
 
def mythburn.ts2pts (time)
 convert time stamp to pts More...
 
def mythburn.checkSubtitles (spumuxFile)
 check the given spumux.xml file for consistancy More...
 
def mythburn.extractVideoFrame (source, destination, seconds)
 Grabs a sequence of consecutive frames from a file. More...
 
def mythburn.extractVideoFrames (source, destination, thumbList)
 Grabs a list of single frames from a file. More...
 
def mythburn.encodeVideoToMPEG2 (source, destvideofile, video, audio1, audio2, aspectratio, profile)
 Re-encodes a file to mpeg2. More...
 
def mythburn.encodeNuvToMPEG2 (chanid, starttime, mediafile, destvideofile, folder, profile, usecutlist)
 Re-encodes a nuv file to mpeg2 optionally removing commercials. More...
 
def mythburn.runDVDAuthor ()
 Runs DVDAuthor to create a DVD file structure. More...
 
def mythburn.CreateDVDISO (title)
 Creates an ISO image from the contents of a directory. More...
 
def mythburn.BurnDVDISO (title)
 Burns the contents of a directory to create a DVD. More...
 
def mythburn.deMultiplexMPEG2File (folder, mediafile, video, audio1, audio2)
 Splits a file into the separate audio and video streams using mythreplex. More...
 
def mythburn.runM2VRequantiser (source, destination, factor)
 Run M2VRequantiser. More...
 
def mythburn.calculateFileSizes (files)
 Calculates the total size of all the video, audio and menu files. More...
 
def mythburn.total_mv2_brl (files, rate)
 returns total size of bitrate-limited m2v files More...
 
def mythburn.performMPEG2Shrink (files, dvdrsize)
 Uses requantiser if available to shrink the video streams so they will fit on a DVD. More...
 
def mythburn.createDVDAuthorXML (screensize, numberofitems)
 Creates the DVDAuthor xml file used to create a standard DVD with menus. More...
 
def mythburn.createDVDAuthorXMLNoMainMenu (screensize, numberofitems)
 Creates the DVDAuthor xml file used to create a DVD with no main menu. More...
 
def mythburn.createDVDAuthorXMLNoMenus (screensize, numberofitems)
 Creates the DVDAuthor xml file used to create an Autoplay DVD. More...
 
def mythburn.createEmptyPreviewFolder (videoitem)
 Creates the directory to hold the preview images for an animated menu. More...
 
def mythburn.generateVideoPreview (videoitem, itemonthispage, menuitem, starttime, menulength, previewfolder)
 Generates the thumbnail images used to create animated menus. More...
 
def mythburn.drawThemeItem (page, itemsonthispage, itemnum, menuitem, bgimage, draw, bgimagemask, drawmask, highlightcolor, spumuxdom, spunode, numberofitems, chapternumber, chapterlist)
 Draws text and graphics onto a dvd menu. More...
 
def mythburn.createMenu (screensize, screendpi, numberofitems)
 creates the main menu for a DVD More...
 
def mythburn.createChapterMenu (screensize, screendpi, numberofitems)
 creates a chapter menu for a file on a DVD More...
 
def mythburn.createDetailsPage (screensize, screendpi, numberofitems)
 creates the details page for a file on a DVD More...
 
def mythburn.isMediaAVIFile (file)
 checks if a file is an avi file More...
 
def mythburn.processAudio (folder)
 checks to see if an audio stream need to be converted to ac3 More...
 
def mythburn.selectStreams (folder)
 
def mythburn.selectSubtitleStream (folder)
 
def mythburn.selectAspectRatio (folder)
 gets the video aspect ratio from the stream info xml file More...
 
def mythburn.getVideoCodec (folder)
 gets video stream codec from the stream info xml file More...
 
def mythburn.getFileType (folder)
 gets file container type from the stream info xml file More...
 
def mythburn.getStreamList (folder)
 get the list of required stream ids for a file More...
 
def mythburn.isFileOkayForDVD (file, folder)
 check if file is DVD compliant More...
 
def mythburn.processFile (file, folder, count)
 process a single file ready for burning using either mythtranscode/mythreplex or ProjectX as the cutter/demuxer More...
 
def mythburn.doProcessFile (file, folder, count)
 process a single file ready for burning using mythtranscode/mythreplex to cut and demux More...
 
def mythburn.doProcessFileProjectX (file, folder, count)
 process a single file ready for burning using projectX to cut and demux More...
 
def mythburn.copyRemote (files, tmpPath)
 copy files on remote filesystems to the local filesystem More...
 
def mythburn.processJob (job)
 processes one job More...
 
def mythburn.usage ()
 show usage More...
 
def mythburn.main ()
 The main starting point for mythburn.py. More...
 

Variables

string mythburn.VERSION = "0.1.20131119-1"
 
bool mythburn.debug_keeptempfiles = False
 
bool mythburn.debug_secondrunthrough = False
 You can use this debug flag when testing out new themes pick some small recordings, run them through as normal with debug_keeptempfiles = True (see above) set this variable to True and then re-run the scripts the temp. More...
 
string mythburn.defaultEncodingProfile = "SP"
 
bool mythburn.useSyncOffset = True
 
bool mythburn.addCutlistChapters = False
 
bool mythburn.encodetoac3 = False
 
int mythburn.DVD_SL = 0
 
int mythburn.DVD_DL = 1
 
int mythburn.DVD_RW = 2
 
int mythburn.FILE = 3
 
tuple mythburn.dvdPAL = (720,576)
 
tuple mythburn.dvdNTSC = (720,480)
 
tuple mythburn.dvdPALdpi = (75,80)
 
tuple mythburn.dvdNTSCdpi = (81,72)
 
string mythburn.dvdPALHalfD1 = "352x576"
 
string mythburn.dvdNTSCHalfD1 = "352x480"
 
string mythburn.dvdPALD1 = "%sx%s" % (dvdPAL[0],dvdPAL[1])
 
string mythburn.dvdNTSCD1 = "%sx%s" % (dvdNTSC[0],dvdNTSC[1])
 
tuple mythburn.dvdrsize = (4482,8106)
 
int mythburn.frameratePAL = 25
 
float mythburn.framerateNTSC = 29.97
 
float mythburn.aspectRatioThreshold = 1.4
 
string mythburn.temppath = ""
 
string mythburn.logpath = ""
 
string mythburn.scriptpath = ""
 
string mythburn.sharepath = ""
 
string mythburn.videopath = ""
 
string mythburn.defaultsettings = ""
 
string mythburn.videomode = ""
 
string mythburn.gallerypath = ""
 
string mythburn.musicpath = ""
 
string mythburn.dateformat = ""
 
string mythburn.timeformat = ""
 
string mythburn.dbVersion = ""
 
string mythburn.preferredlang1 = ""
 
string mythburn.preferredlang2 = ""
 
bool mythburn.useFIFO = True
 
bool mythburn.alwaysRunMythtranscode = False
 
bool mythburn.copyremoteFiles = False
 
int mythburn.thumboffset = 10
 
bool mythburn.usebookmark = True
 
bool mythburn.clearArchiveTable = True
 
int mythburn.nicelevel = 17;
 
int mythburn.drivespeed = 0;
 
string mythburn.mainmenuAspectRatio = "16:9"
 
string mythburn.chaptermenuAspectRatio = "Video"
 
int mythburn.chapterLength = 5 * 60;
 
string mythburn.jobfile = "mydata.xml"
 
string mythburn.progresslog = ""
 
 mythburn.progressfile = codecs.open("/dev/null", 'w', 'utf-8')
 
string mythburn.dvddrivepath = "/dev/dvd"
 
bool mythburn.docreateiso = False
 
bool mythburn.doburn = True
 
bool mythburn.erasedvdrw = False
 
int mythburn.mediatype = DVD_SL
 
string mythburn.savefilename = ''
 
string mythburn.installPrefix = ""
 
 mythburn.jobDOM = None
 
 mythburn.themeDOM = None
 
string mythburn.themeName = ''
 
dictionary mythburn.themeFonts = {}
 
int mythburn.cpuCount = 1
 
 mythburn.DB = MythTV.MythDB()
 
 mythburn.MVID = MythTV.MythVideo(db=DB)
 
 mythburn.Video = MythTV.Video
 
 mythburn.configHostname = DB.gethostname()
 
 mythburn.oldlocale = os.environ["LC_ALL"]
 
def mythburn.fix_rtl = simple_fix_rtl
 
int mythburn.VIDEO_INDEX = 0
 chooses which streams from a file to include on the DVD More...
 
int mythburn.VIDEO_CODEC = 1
 
int mythburn.VIDEO_ID = 2
 
int mythburn.AUDIO_INDEX = 0
 
int mythburn.AUDIO_CODEC = 1
 
int mythburn.AUDIO_ID = 2
 
int mythburn.AUDIO_LANG = 3
 
int mythburn.SUBTITLE_INDEX = 0
 chooses which subtitle stream from a file to include on the DVD More...
 
int mythburn.SUBTITLE_CODEC = 1
 
int mythburn.SUBTITLE_ID = 2
 
int mythburn.SUBTITLE_LANG = 3