Ticket #11704: animatedmenu.patch
File animatedmenu.patch, 2.6 KB (added by , 11 years ago) |
---|
-
.py
old new 499 499 500 500 frames=int(seconds * framespersecond) 501 501 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 506 def to_seconds(timestr): 507 seconds = 0 508 for part in timestr.split(':') : 509 seconds = seconds * 60 + int(part) 510 return seconds 502 511 503 512 ############################################################# 504 513 # Creates a short mpeg file from a jpeg image and an ac3 sound track … … 3225 3234 frames = int(secondsToFrames(menulength)) 3226 3235 3227 3236 command = "mytharchivehelper -q -q --createthumbnail --infile %s --thumblist '%s' --outfile %s --framecount %d" % (quoteCmdArg(inputfile), starttime, quoteCmdArg(outputfile), frames) 3237 write(command) 3228 3238 result = runCommand(command) 3229 3239 if (result != 0): 3230 3240 write( "mytharchivehelper failed with code %d. Command = %s" % (result, command) ) … … 3743 3753 #Extract the thumbnails 3744 3754 chapterlist=createVideoChapters(page,itemsperpage,getLengthOfVideo(page),True) 3745 3755 chapterlist=string.split(chapterlist,",") 3756 write("chapterlist: %s " % chapterlist) 3746 3757 3747 3758 #now need to preprocess the menu to see if any preview videos are required 3748 3759 #This must be done on an individual basis since we do the resize as the … … 3753 3764 3754 3765 haspreview = False 3755 3766 3756 previewsegment=int(getLengthOfVideo(page) / itemsperpage) 3757 previewtime = 0 3767 # previewsegment=int(getLengthOfVideo(page) / itemsperpage) 3758 3768 previewchapter = 0 3759 3769 previewx = [] 3760 3770 previewy = [] … … 3763 3773 previewmask = [] 3764 3774 3765 3775 while previewchapter < itemsperpage: 3766 menuitem =menuitems[ previewchapter ]3776 menuitem = menuitems[ previewchapter ] 3767 3777 3768 3778 #generate the preview if required (px=9999 means not required) 3779 previewtime = to_seconds(chapterlist[ previewchapter ]) 3769 3780 px, py, pw, ph, maskimage = generateVideoPreview(page, previewchapter, menuitem, previewtime, menulength, previewfolder) 3770 3781 previewx.append(px) 3771 3782 previewy.append(py) … … 3777 3788 haspreview = True 3778 3789 3779 3790 previewchapter+=1 3780 previewtime+=previewsegment3781 3791 3782 3792 #Loop through all the items on this menu page 3783 3793 chapter=0