;ò ‡T–Ec@sLdZdkZdkZdkZdkZdkZdkZdkZdkZe a ei i a eii Zeii Zhde<des   ! s VidThumbTotemcBs)tZdZdZed„Zd„ZRS(s6Generate thumbnail for video files understood by totemstotem-video-thumbnailercCsti||ƒdS(sInitialize Video thumbnaillerN(s VidThumbNails__init__sselfsdebug(sselfsdebug((sP/mnt/gmirror/ports/multimedia/rox-videothumbnail/work/VideoThumbnail/vidthumb.pys__init__tscCs—tii|idƒ}tiiod|||f}nd||f}t |ƒ}tii|ƒ o|i||ƒSntiii|ƒSdS(Nsout.pngs%totem-video-thumbnailer -s %i "%s" %sstotem-video-thumbnailer "%s" %s(sosspathsjoinsselfswork_dirsoutfilesoptionssscales int_valuesrsizesinnamescmdsexecute_return_errserrmsgsexistss failed_imagesroxsgsgdkspixbuf_new_from_file(sselfsinnamesrsizescmdsoutfileserrmsg((sP/mnt/gmirror/ports/multimedia/rox-videothumbnail/work/VideoThumbnail/vidthumb.pys get_imageys  (s__name__s __module__s__doc__s_binarysFalses__init__s get_image(((sP/mnt/gmirror/ports/multimedia/rox-videothumbnail/work/VideoThumbnail/vidthumb.pys VidThumbTotemqs  sVidThumbMPlayercBs2tZdZdZed„Zd„Zd„ZRS(s8Generate thumbnail for video files understood by mplayersmplayercCs2ti||ƒtii|_tii|_dS(sInitialize Video thumbnaillerN( s VidThumbNails__init__sselfsdebugsoptionss time_labels int_valuesadd_times right_align(sselfsdebug((sP/mnt/gmirror/ports/multimedia/rox-videothumbnail/work/VideoThumbnail/vidthumb.pys__init__Šsc Cs¦tii o|i o|Sn|iƒ\}}|i ƒ}t i } |id|idƒƒ}tiio³|i|tddd|ƒ|i|t|ddd|ƒ|i|idƒƒx^td|dƒD]F}|i|td|ddƒ|i|t|dd|ddƒqÕWn|io|ioI|i}t|d ƒ} | djo|| d 8}nt|d ƒ}|djo||d 8}nd | ||f}to |GHn| iƒ}|i!|ƒ}d } |i$o$|i%ƒ\} } || | } n|i|idƒƒ|i(|| dd |ƒ|i|idƒƒ|i(|| d|ƒto |GHq€n|i)||ddddddƒSdS(s"Add the optional film strip effects foregroundsblackiis#DDDiiiii<s %d:%02d:%02di iswhiteiÿÿÿÿN(*soptionsssprockets int_valuesselfsadd_timesimgsrender_pixmap_and_maskspixmapsmasks get_colormapscmapsroxsgsgtksnew_gcs alloc_colorsgcsdraw_rectanglesTrueshswsset_foregroundsrangesys total_timessecssintshourssminsststrsdebugsWindowsdummyscreate_pango_layoutslayoutsxposs right_alignsget_pixel_sizeslwslhs draw_layoutsget_from_drawable(sselfsimgswshsgcsminsststrspixmapslayoutsgtkslhslwsxposshourssysdummysmaskssecsscmap((sP/mnt/gmirror/ports/multimedia/rox-videothumbnail/work/VideoThumbnail/vidthumb.pyspost_process_image‘sN    ,       cCs#d„}d„}y||ƒ}Wn'|iƒ|i|tdƒƒSnX||_ t o |GHn|d}|djo d}n|||ƒ}t o|G|G|GHn|t jo+||dƒ}t o|G|G|GHqån|t jo|i|tdƒƒSntiii|ƒSdS( sZGenerate the raw image from the file. We run mplayer (twice) to do the hard work.cCsgtid|dƒ\}}}x=|iƒD]/}|d djot|i ƒdƒSq,q,WdSdS(s)Get the length in seconds of the source. s:mplayer -frames 0 -vo null -vf-clr -ao null -identify "%s"sri s ID_LENGTH=f0.0N( sosspopen3sfnamesunusedsinfsjunks readlinesslsfloatsstrip(sfnamesjunkslsunusedsinf((sP/mnt/gmirror/ports/multimedia/rox-videothumbnail/work/VideoThumbnail/vidthumb.pys get_lengthÃs  cCsûd||f}|d7}d„}to |GHnti|ƒtii |ƒ}yt t |ƒ}Wn t}nX|o d}nd}d|}to |GHn||ƒ o>| o,d}d|}||ƒ o t}qïqót}n|SdS(seReturn filename of a single frame from the source, taken from pos seconds into the videosLmplayer -really-quiet -vo png -vf-clr -ss %f -frames 3 -nosound -noloop "%s"s > /dev/null 2>&1cCs‰to dG|GHnyti|ƒWnYtodGtiƒd GHntotidƒntotidƒntSnXtSdS(Nslook fors exceptionispwdsls -al( sdebugsofilesossstatssyssexc_infossystemsFalsesTrue(sofile((sP/mnt/gmirror/ports/multimedia/rox-videothumbnail/work/VideoThumbnail/vidthumb.pysframe_okÜs iis%08d.pngN(spossfnamescmdsframe_oksdebugsosssystemsroxsmimesget_typesmtypesfirst_by_typessstrsfirsts take_firstsidsofilesNone(sfnamespossframe_oksofilescmdsmtypesidsfirst((sP/mnt/gmirror/ports/multimedia/rox-videothumbnail/work/VideoThumbnail/vidthumb.pys write_frameÑs4          s Bad lengthf0.050000000000000003i<isBad or missing frame fileN(s get_lengths write_framesinnamesvlensselfsreport_exceptions failed_imagesrsizes_s total_timesdebugspossfrfnamesNonesroxsgsgdkspixbuf_new_from_file(sselfsinnamesrsizes get_lengths write_framesvlenspossfrfname((sP/mnt/gmirror/ports/multimedia/rox-videothumbnail/work/VideoThumbnail/vidthumb.pys get_imageÀs0  4        (s__name__s __module__s__doc__s_binarysFalses__init__spost_process_images get_image(((sP/mnt/gmirror/ports/multimedia/rox-videothumbnail/work/VideoThumbnail/vidthumb.pysVidThumbMPlayer‡s   /smplayerstotemc CsC|d}y|daWnnXto dGtGHnyt|dƒaWnnX|}tii |ƒ o%tii tii |ƒ|ƒ}nt otd|} t i| ƒiƒ}d}x"|D]} |dt| ƒ7}qÇWtii tidd d |d ƒan+tii tƒ otiitƒanto dGtGHntitiiƒ}|iƒ oª|i}xžtiƒD]s\} } | iƒoZ| }t"d ƒ}t$i%|||ift$i&i'ƒo| ti_t$i(i)ƒnPq†q†Wt"d ƒ}t$i*|ƒn|ti+i,ƒ}|i.|ttƒdS(sŸProcess command line args. Although the filer always passes three args, let the last two default to something sensible to allow use outside the filer.iissave toisfile://ss%02xsHOMEs .thumbnailssnormals.pngsVideoThumbnail could not find the program "%s", but another thumbnail generator is available. Should "%s" be used from now on?s¸VideoThumbnail could not find any usable thumbnail generator. You need to install either MPlayer (http://www.mplayerhq.hu) or Totem (http://www.gnome.org/projects/totem/).N(/sargvsinnamesoutnamesdebugsintsrsizesorigsosspathsisabssjoinsdirnamesurismd5snewsdigeststmpsleafscsordsenvironsabspaths thumbnailersspopsoptionss generatorsvaluesthumbCscheck_executables_binarysorigbins iteritemssnamesclss_smsgsroxsconfirmsgs STOCK_YESs app_optionsssavescroaksreports int_valuesthumbsrun( sargvsorigstmpsleafsthumbCsthumbsinnamesmsgsorigbinsclsscsnamesuri((sP/mnt/gmirror/ports/multimedia/rox-videothumbnail/work/VideoThumbnail/vidthumb.pysmain&s\  %      &    cCstiƒtiƒdS(sConfigure the appN(soptionss edit_optionssroxsmainloop(((sP/mnt/gmirror/ports/multimedia/rox-videothumbnail/work/VideoThumbnail/vidthumb.pys configurees s__main__i("s__doc__sosssyssmd5sroxsrox.mimespangosthumbsoptionssNonesoutnamestsizes int_valuesrsizes take_firstsssizesbwidthsTruesFalsesfirst_by_typess binaryInPathsexecute_return_errsenvironsgetsdebugs Thumbnaillers VidThumbNails VidThumbTotemsVidThumbMPlayers thumbnailerssmains configures__name__sargv(s VidThumbNailsroxsthumbs binaryInPathsbwidths thumbnailerssexecute_return_errsmd5s configuresfirst_by_typesssyss take_firstspangos VidThumbTotemsVidThumbMPlayersmainsdebugsossoptions((sP/mnt/gmirror/ports/multimedia/rox-videothumbnail/work/VideoThumbnail/vidthumb.pys?s,         3™ ?