Add action to generate test tags
authorymh <ymh.work@gmail.com>
Fri, 30 Apr 2010 12:13:18 +0200
changeset 110 6c31428e26ab
parent 109 b926f45438d1
child 111 a9dd18698c15
Add action to generate test tags
web/thdProject/apps/backend/modules/film/actions/actions.class.php
web/thdProject/apps/backend/modules/film/config/generator.yml
--- 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)));
--- 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:    ~