; = Dc@sdkZdkZdkiZdkTdkiZdkiZdk i Z dkiZdk Z dk Z dk iZdkiZdkZdkiZdkiZhdd<dd<dd<dd<dd<d d<d d<d d<d d<d d<dd [author, ...] Performs a search for the glob (additionally including the optional parameters). The author glob should be a valid glob e.g. Robinso* and is case-insensitive. [regexp] should be a valid regular expression, and will additionally search the entire content of the poem for the regular expression. sauthorN(sselfs_performPoemQuerysircsoptssglobs(sselfsircsmsgsargssoptssglobs((s./Minstrel/plugin.pyspoets sglobcCs|i|||dS(s[--regexp,--re regexp] [--title,--t title] [--firstline, --fl firstline] [-- author,--a author] [query] ,... Performs a search for the (additionally including the optional parameters). The should be a valid glob e.g. fruit* and is case-insensitive. [regexp] should be a valid regular expression, and will additionally search the entire content of the poem for the regular expression. N(sselfs_performPoemQuerysircsoptssglobs(sselfsircsmsgsargssoptssglobs((s./Minstrel/plugin.pyspoems cGsG|i||}|io|in|i||i |dS(N( sselfs _getPoemssoptssglobssrss chooseModes_displayChoicess_playsircs _choosePoem(sselfsircsoptssglobssfieldssrs((s./Minstrel/plugin.pys_performPoemQuerys cCsdS(N((sself((s./Minstrel/plugin.pys_displayChoicesscGst|\}}d|jo|d|_xD|D]<}t|o t ||p t |}|i |q3W|i i|SdS(Nschoose(sgetOptMatcherssoptssmatcherss extraoptssselfs chooseModesglobssgslensfieldss globMatchsmsappendsdbsselect(sselfsoptssglobssfieldss extraoptssgsmsmatchers((s./Minstrel/plugin.pys _getPoemss)cCst}t}xo|ogyG|i}|i||_| p|i|ijo |}nWqt j o t }qXqW|SdS(N( sNoneshighestsTruesnextspoemsspoemsselfs _evaluatePoemsscores StopIterationsFalse(sselfspoemsspoemsnextshighest((s./Minstrel/plugin.pys _choosePoems cCs<ti|i}||id}tid||SdS(Nf0.10000000000000001sscore %s(stimespoems lastplayedssinces totalplayingssscoreslogscritical(sselfspoemssincesscore((s./Minstrel/plugin.pys _evaluatePoemscCs| o|iddSnti|_|id7_|ii||i |i |i |i |i x|i D]}|i |qW|i |i d|i |i |io|i tddn|i|dS(Ns'Sorry, no searches matched your thingy.is(fin)sDownloaded from %us(http://www.cs.rice.edu/~ssiyer/minstrels(spoemsircsreplystimes lastplayeds totalplayingssselfsdbsupdates _queuelinestitlesbodyslsauthorswwwidsformats _playqueue(sselfsircspoemsl((s./Minstrel/plugin.pys_plays(         s cCs/t| o d}n|iid|dS(Ns i(slensssselfs playQueuesinsert(sselfss((s./Minstrel/plugin.pys _queuelines csWd}ti}x5tiD]$\}}ti |||t q+WdS(Ncs iiidtdS(Ns prefixNick(sircsreplysselfs playQueuespopsFalse((sselfsirc(s./Minstrel/plugin.pys _playlines( s _playlinestimesstarts enumeratesselfs playQueuesisvsschedulesaddEventsPP(sselfsircs _playlinesisvsstart((sselfsircs./Minstrel/plugin.pys _playqueues   cCsqh|_tiiiid|idscCs|iid|S(Ns [Minstrel] %s(sselfslogsinfoss(sselfss((s./Minstrel/plugin.pysscCs|iid|S(Ns [Minstrel] %s(sselfslogserrorss(sselfss((s./Minstrel/plugin.pyss(s__name__s __module__s__doc__s__init__s importfilesswrapswwwpoemsoptionalspoetsgetoptssOPTIONSsanyspoems_performPoemQuerys_displayChoicess _getPoemss _choosePoems _evaluatePoems_plays _queuelines _playqueues _buildPathss_loadDbs_debugs_infos_error(((s./Minstrel/plugin.pysMinstrelRs.     ! !           cCs)tii| oti|ndS(N(sosspathsexistssmkdir(spath((s./Minstrel/plugin.pysmkdirIfNotExistingss WwwImportercBstZdZdZRS(NcKstd|jo|do|d|_ntidd|_h|_d|i|_ti|id|_ dS(NspidiiGs3http://www.cs.rice.edu/~ssiyer/minstrels/txt/%s.txti( skwsselfspidsrandomsrandintstagssurlslogscriticalsretries(sselfskw((s./Minstrel/plugin.pys__init__s cCsItii|i}d|j o|id}|i|idi d|i d<|iiddi |i d;s(sselfsdbsselect(sselfskw((s./Minstrel/plugin.pyssearch:scCs|ii|SdS(N(sselfsdbsgetspid(sselfspid((s./Minstrel/plugin.pysget=scCs/| o |i}n|ii|i|dS(N(spidspoemsidsselfsdbsset(sselfspoemspid((s./Minstrel/plugin.pysupdate@s c sJd}|i|g}y|iSWntj o tSnXdS(NcsT|idjo8|idjo |idjotSqHqLntSdS(Nsauthorstitles firstline(spoemsauthorskwstitles firstlinesTruesFalse(spoem(skw(s./Minstrel/plugin.pysmatchFs (smatchsselfsselectsrssnexts StopIterationsNone(sselfskwsrssmatch((skws./Minstrel/plugin.pysexistsEs  csJd}|i|g}y|iSWntj o tSnXdS(Ncs|iGH|ijSdS(N(spoemswwwidspid(spoem(spid(s./Minstrel/plugin.pysmatchSs(smatchsselfsselectsrssnexts StopIterationsNone(sselfspidsrssmatch((spids./Minstrel/plugin.pys wwwidExistsRs  csAd|iid}| o tin|SdS(Ncs/x$D]}|| otSqqWtSdS(N(scriteriaspspoemsFalsesTrue(spoemsp(scriteria(s./Minstrel/plugin.pysmatch]s  cs |S(N(smatchst(st(smatch(s./Minstrel/plugin.pysbs(smatchsselfsdbsselectspoemssdbis NoRecordError(sselfscriteriaspoemssmatch((scriteriasmatchs./Minstrel/plugin.pysselect\s   c Gs x|dD]}tii|i|} tid| t | d}h} x|D]}|i }|idoqU|ido>|id}|dd}di|d}|| |