Ticket #11704: animatedmenu.patch

File animatedmenu.patch, 2.6 KB (added by J.Pilk@…, 11 years ago)

unified diff from my modified version of mythburn.py for 0.26-fixes.

  • .py

    old new  
    499499
    500500    frames=int(seconds * framespersecond)
    501501    return frames
     502#############################################################
     503# Convert HH:MM:SS to seconds
     504# http://stackoverflow.com/questions/6402812/how-to-convert-an-hmmss-time-string-to-seconds-in-python
     505
     506def to_seconds(timestr):
     507    seconds = 0
     508    for part in timestr.split(':') :
     509       seconds = seconds * 60 + int(part)
     510    return seconds
    502511
    503512#############################################################
    504513# Creates a short mpeg file from a jpeg image and an ac3 sound track
     
    32253234                frames = int(secondsToFrames(menulength))
    32263235
    32273236                command = "mytharchivehelper -q -q --createthumbnail --infile  %s --thumblist '%s' --outfile %s --framecount %d" % (quoteCmdArg(inputfile), starttime, quoteCmdArg(outputfile), frames)
     3237                write(command)
    32283238                result = runCommand(command)
    32293239                if (result != 0):
    32303240                    write( "mytharchivehelper failed with code %d. Command = %s" % (result, command) )
     
    37433753        #Extract the thumbnails
    37443754        chapterlist=createVideoChapters(page,itemsperpage,getLengthOfVideo(page),True)
    37453755        chapterlist=string.split(chapterlist,",")
     3756        write("chapterlist: %s " % chapterlist)
    37463757
    37473758        #now need to preprocess the menu to see if any preview videos are required
    37483759        #This must be done on an individual basis since we do the resize as the
     
    37533764
    37543765        haspreview = False
    37553766
    3756         previewsegment=int(getLengthOfVideo(page) / itemsperpage)
    3757         previewtime = 0
     3767#        previewsegment=int(getLengthOfVideo(page) / itemsperpage)
    37583768        previewchapter = 0
    37593769        previewx = []
    37603770        previewy = []
     
    37633773        previewmask = []
    37643774
    37653775        while previewchapter < itemsperpage:
    3766             menuitem=menuitems[ previewchapter ]
     3776            menuitem = menuitems[ previewchapter ]
    37673777
    37683778            #generate the preview if required (px=9999 means not required)
     3779            previewtime = to_seconds(chapterlist[ previewchapter ])
    37693780            px, py, pw, ph, maskimage = generateVideoPreview(page, previewchapter, menuitem, previewtime, menulength, previewfolder)
    37703781            previewx.append(px)
    37713782            previewy.append(py)
     
    37773788                haspreview = True
    37783789
    37793790            previewchapter+=1
    3780             previewtime+=previewsegment
    37813791
    37823792        #Loop through all the items on this menu page
    37833793        chapter=0