Ñò yÞKc@sœdZddkZddkZddkZddkZddkZddkZddklZl Z ddk l Z l Z l Z lZlZlZddkTdZdZdZeZd dd „ƒYZed joÄdd klZeƒZeid dddddddƒeiƒ\ZZei oEei!i"ei ƒpei GdGHdGHe#dƒndGei GHndGHdGeGHeƒi$eei ƒndS(s1 Class and methods to convert video for the fuze iÿÿÿÿN(t check_calltcall(t QT_TR_NOOPtSIGNALtQObjecttQStringtQVariantt QSettings(t*smencoder -msglevel all=0:statusline=5 -ffourcc DX50 -ofps 20 -vf pp=li,expand=:::::224/176,scale=224:176,harddup -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=683:vmax_b_frames=0:keyint=15:turbo:vpass=1 -srate 44100 -af resample=44100:0:1,format=s16le -oac mp3lame -lameopts cbr:br=128smencoder -msglevel all=0:statusline=5 -ffourcc DX50 -ofps 20 -vf pp=li,expand=:::::224/176,scale=224:176,harddup -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=683:vmax_b_frames=0:keyint=15:vpass=2 -srate 44100 -af resample=44100:0:1,format=s16le -oac mp3lame -lameopts cbr:br=128sìmencoder -msglevel all=0:statusline=5 -ofps 20 -ovc lavc -lavcopts vcodec=mpeg4:vqscale=3:keyint=15 -vf field,expand=:::::224/176,scale=224:176,harddup -srate 44100 -af resample=44100:0:1,format=s16le -oac mp3lame -lameopts cbr:br=128tFuzecBs/eZdZdd„Zd„Zdd„ZRS(s\ This class implements a convert() method used to convert video files for the fuze. cCsÑ||_tiƒ|_tƒ|_|io®|ii|itdƒ|iƒ|ii|itdƒ|i ƒ|ii|itdƒ|i ƒ|ii|itdƒ|i ƒ|ii|itdƒ|i ƒn|i ƒd|_tiƒ|_tidjo:tii|idƒ|_tii|idƒ|_n†d |_d |_tid joJ|idjo:tid ƒ}|d d jo|d|_qÍdGHn|idjo dGHndS(Ntstoptworkingt ExceptiontitemDonetfinishedtnts ffmpeg.exes fuzemux.exetffmpegtfuzemuxtposixs which xtermiisxterm not foundsNo terminal emulator available(tGUItostgetcwdtCWDRtqobjecttconnectRtWAITtStatust ErrorDiagtDelItemtgetReadyt LoadSettingstNonetxtermttempfilet gettempdirt fuzemuxPrefixtnametpathtjointFFMPEGRtcommandstgetstatusoutput(tselfRttermloc((s>/home/ken/Programs/video4fuze/0.6+/src/video4fuze-0.6+/fuze.pyt__init__s0   """"&      cCs ttitititiƒ|_t|iidt t ƒƒi ƒƒ|_ t|iidt t ƒƒi ƒƒ|_ t|iidt t ƒƒi ƒƒ|_ |iidt tƒƒiƒ|_dGHH|io!dGHdG|i GHdG|i GHnd GHd G|i GHd S( s? Loads video4fuze's settings for this instance t mencoderpass1t mencoderpass2tmencodersinglepasst2passsCurrent settings:sTwo-pass conversion;sPass 1: sPass 2: sSingle-pass conversion;sOptions used: N(Rt IniFormatt UserScopetinfotORGNAMEtNAMEtSettingstunicodetvalueRR-ttoStringR.R/tpass2ttoBool(R*((s>/home/ken/Programs/video4fuze/0.6+/src/video4fuze-0.6+/fuze.pyR6s$***$  c Csÿ|io#|iitdƒ|iiƒnxË|D]Ã}tii|ƒ}ti|i ƒ|GHtii |ƒoCti djo<tii |i tii tii|ƒƒddƒ}nZtidtii |i idƒtii tii|ƒƒddƒƒiddƒ}yÄ|iod GHt|iƒ}nd GH|i}|iitd ƒd |d ƒ|id$jo|id|}n|iƒ}|i|ƒ|idƒ|i|ƒdG|GdGHt|ƒWn6tj o*}|GH|iitdƒ|ƒq4nX|ioØy›dGHt|iƒ}|iitd ƒd |dƒ|id$jo|id|}n|iƒ}|i|ƒ|idƒ|i|ƒt|ƒWqøtj o*}|GH|iitdƒ|ƒq4qøXn|d$jotii |ƒdd}n6tii |tii tii|ƒƒdƒd}yž|i} tii |ƒdd} |iitd ƒd| ƒ|id$jo|id| } n| iƒ} | i|ƒ| i| ƒdGHt| ƒWnCtj o7}|GH|iitdƒ|ƒti | ƒq4nXd| d|dGH|GHyðyz|iitd ƒdƒdGHtitii|ƒdƒt!| tii tii|ƒƒddgt"t#|i$ƒWn9tj o-}|GH|‚|iitdƒ|ƒnXt%i&| |ƒ|iitdƒ|ƒti |ƒWn8tj o,}|GHdGH|iitdƒ|ƒnX|io(|iitd ƒ|iiƒd!GHqçn1d"|d"d#} |iitdƒ| ƒ| GHti|i'ƒq4Wd$S(%so This method converts any video file passed as argument to a file suitable for the sansa fuze. R Ris .temp.avitNFKDsutf-8tasciitignoresCalling mencoder #1s!Calling a single pass of mencoderR sUsing mencoder on s...s -e s-os Executings R sCalling mencoder #2s (pass 2)...s _fuze.avis_fuzemuxed.avisUsing sCalling fuzemuxsMoving s to s and cleaning temporary filessCreating video thumbnailidR sOoops not moving final videoRs Finished!s's: file not foundN((RRtemitRtVideoRR%tabspathtchdirR#tisfileR$R&tsplitexttbasenamet unicodedatat normalizetdecodetencodeR:R7R-R/R RtsplittappendRR tstrR.Rtremovet find_thumbtTruetFalseR'tshutiltmoveR( R*targst FINALPREFIXtargumenttOUTPUTR-teR.tFINALRt fuzemux_tempterror((s>/home/ken/Programs/video4fuze/0.6+/src/video4fuze-0.6+/fuze.pytconvertIs¶ #<Y  !      !      5     ?  N(t__name__t __module__t__doc__RR,RR[(((s>/home/ken/Programs/video4fuze/0.6+/src/video4fuze-0.6+/fuze.pyR s  t__main__(t OptionParsers-os --outputdirtdestt outputdirthelps%save the converted files to OUTPUTDIRtmetavart OUTPUTDIRsis not a directory!s Aborting...isOutput directory:s Output directory: same as sourcesFiles to convert:((%R^RR!RQR(RFR3t subprocessRRt PyQt4.QtCoreRRRRRRtvthumbR-R.R/RPR:R R\toptparseR`tparsert add_optiont parse_argstoptionsRSRbR%tisdirtexitR[(((s>/home/ken/Programs/video4fuze/0.6+/src/video4fuze-0.6+/fuze.pyts0< . œ  "