Ticket #3222: mythburn.py.diff

File mythburn.py.diff, 4.1 KB (added by anonymous, 13 years ago)

changes to fix bug. diff -u format

  • mythburn.py

    old new  
    13501350            fatalError("Failed while running ffmpeg (Pass 2) to re-encode video.\n"
    13511351                       "Command was %s" % command)
    13521352
    1353 def encodeNuvToMPEG2(chanid, starttime, destvideofile, folder, profile, usecutlist):
     1353def encodeNuvToMPEG2(chanid, starttime, mediafile, destvideofile, folder, profile, usecutlist):
    13541354    """Encodes a nuv video source file to MPEG2 video and AC3 audio, using mythtranscode & ffmpeg"""
    13551355
    13561356    # make sure mythtranscode hasn't left some stale fifos hanging around
     
    13911391        if name == "-s":
    13921392            outvideores = value
    13931393
    1394     if (usecutlist == True):
     1394    if chanid != -1:
     1395        if (usecutlist == True):
     1396            PID=os.spawnlp(os.P_NOWAIT, "mythtranscode", "mythtranscode",
     1397                        '-p', '27',
     1398                        '-c', chanid,
     1399                        '-s', starttime,
     1400                        '--honorcutlist',
     1401                        '-f', folder)
     1402            write("mythtranscode started (using cut list) PID = %s" % PID)
     1403        else:
     1404            PID=os.spawnlp(os.P_NOWAIT, "mythtranscode", "mythtranscode",
     1405                        '-p', '27',
     1406                        '-c', chanid,
     1407                        '-s', starttime,
     1408                        '-f', folder)
     1409
     1410            write("mythtranscode started PID = %s" % PID)
     1411    elif mediafile != -1:
    13951412        PID=os.spawnlp(os.P_NOWAIT, "mythtranscode", "mythtranscode",
    1396                     '-p', '27',
    1397                     '-c', chanid,
    1398                     '-s', starttime,
    1399                     '--honorcutlist',
    1400                     '-f', folder)
    1401         write("mythtranscode started (using cut list) PID = %s" % PID)
     1413                '-p', '27',
     1414                '-i', mediafile,
     1415                '-f', folder)
     1416        write("mythtranscode started (using file) PID = %s" % PID)
    14021417    else:
    1403         PID=os.spawnlp(os.P_NOWAIT, "mythtranscode", "mythtranscode",
    1404                     '-p', '27',
    1405                     '-c', chanid,
    1406                     '-s', starttime,
    1407                     '-f', folder)
    1408 
    1409         write("mythtranscode started PID = %s" % PID)
     1418        fatalError("no video source passed to encodeNuvToMPEG2.\n")
    14101419
    14111420
    14121421    samplerate, channels = getAudioParams(folder)
     
    31483157
    31493158            write("Re-encoding audio and video from nuv file")
    31503159
    3151             # Run from local file?
    3152             if file.hasAttribute("localfilename"):
    3153                 mediafile = file.attributes["localfilename"].value
    3154 
    31553160            # what encoding profile should we use
    31563161            if file.hasAttribute("encodingprofile"):
    31573162                profile = file.attributes["encodingprofile"].value
    31583163            else:
    31593164                profile = defaultEncodingProfile
    31603165
    3161             chanid = getText(infoDOM.getElementsByTagName("chanid")[0])
    3162             starttime = getText(infoDOM.getElementsByTagName("starttime")[0])
    3163             usecutlist = (file.attributes["usecutlist"].value == "1" and
    3164                           getText(infoDOM.getElementsByTagName("hascutlist")[0]) == "yes")
    3165 
    3166             #do the re-encode
    3167             encodeNuvToMPEG2(chanid, starttime, os.path.join(folder, "newfile2.mpg"), folder,
    3168                              profile, usecutlist)
     3166            if file.attributes["type"].value == "recording":
     3167                mediafile = -1
     3168                chanid = getText(infoDOM.getElementsByTagName("chanid")[0])
     3169                starttime = getText(infoDOM.getElementsByTagName("starttime")[0])
     3170                usecutlist = (file.attributes["usecutlist"].value == "1" and
     3171                              getText(infoDOM.getElementsByTagName("hascutlist")[0]) == "yes")
     3172            else:
     3173                chanid = -1
     3174                starttime = -1
     3175                usecutlist = -1
     3176
     3177            encodeNuvToMPEG2(chanid, starttime, mediafile, os.path.join(folder, "newfile2.mpg"), folder,
     3178                         profile, usecutlist)
    31693179            mediafile = os.path.join(folder, 'newfile2.mpg')
    31703180        else:
    31713181            #we need to re-encode the file, make sure we get the right video/audio streams