# HG changeset patch # User ymh # Date 1272622398 -7200 # Node ID 6c31428e26ab724f2b8331424c4f32745c29716b # Parent b926f45438d1ee8db4148a6780d937c150d52c6d Add action to generate test tags diff -r b926f45438d1 -r 6c31428e26ab web/thdProject/apps/backend/modules/film/actions/actions.class.php --- a/web/thdProject/apps/backend/modules/film/actions/actions.class.php Fri Apr 30 05:19:27 2010 +0200 +++ b/web/thdProject/apps/backend/modules/film/actions/actions.class.php Fri Apr 30 12:13:18 2010 +0200 @@ -13,6 +13,87 @@ */ class filmActions extends autoFilmActions { + private $WORD_LIST = array( + "abandon", + "abondance", + "absence", + "abus", + "accueil", + "acharnement", + "acteur", + "administration", + "adoration", + "adulte", + "adultère", + "aéroport", + "avion", + "affrontement", + "agitation", + "agression", + "aide", + "alarme", + "alcool", + "alimentation", + "amour", + "banque", + "bateau", + "bonheur", + "bouddhisme", + "camping", + "caractère", + "carence", + "cassure", + "célibataire", + "complice", + "défilé", + "discussion", + "écologie", + "encouragement", + "enfant", + "famille", + "géographie", + "huître", + "humain", + "mer", + "mère", + "méthode", + "monument", + "mouchoir", + "nature", + "nuage", + "offre", + "opinion", + "optique", + "papillon", + "photo" + ); + + public function executeListGenerate(sfWebRequest $request) { + + // get all films + $videos = Doctrine_Query::create() + ->select("v.*") + ->from('ThdVideo v') + ->execute(); + $user = sfContext::getInstance()->getUser(); + $userUid = 1; + + + + foreach($videos as $video) { + + for($i=0;$i<10;$i++) { + $nbtags = rand(3,5); + $tags = array_rand($this->WORD_LIST, $nbtags); + $start = rand(0,3599); + $end = rand($start,3600); + $video->addSegment($start, $end, $tags, $userUid); + } + + } + + } + public function executeListReindex(sfWebRequest $request) { sfContext::getInstance()->getLogger()->info("FilmAction : listReindex"); @@ -21,6 +102,8 @@ $solr = uvmcSolrServicesManager::getInstance()->getService(); $solr->deleteByQuery('*:*'); + + // reset sony engine $dispatcher = sfContext::getInstance()->getEventDispatcher(); $dispatcher->notify(new sfEvent($this, 'iri_sonyengine.reset', array('retrain' => true))); diff -r b926f45438d1 -r 6c31428e26ab web/thdProject/apps/backend/modules/film/config/generator.yml --- a/web/thdProject/apps/backend/modules/film/config/generator.yml Fri Apr 30 05:19:27 2010 +0200 +++ b/web/thdProject/apps/backend/modules/film/config/generator.yml Fri Apr 30 12:13:18 2010 +0200 @@ -17,6 +17,7 @@ actions: _new : ~ reindex : {label: Reindex} + generate : {label: Generate} filter: ~ form: ~ edit: ~