Пример #1
0
 /**
  * Associates actors with titles.
  * 
  * @param  string $temp tempId of titles to associate.
  * @return void
  */
 private function associate($temp, $known = 0)
 {
     $insert = array();
     $titles = $this->title->Where('temp_id', '=', $temp)->lists('id');
     foreach ($titles as $k => $v) {
         $insert[] = array('actor_id' => $this->actorId, 'title_id' => $v, 'known_for' => $known);
     }
     $this->dbWriter->compileBatchInsert('actors_titles', $insert)->save();
 }
Пример #2
0
 /**
  * Associates actors with titles.
  * 
  * @param  string $temp tempId of titles to associate.
  * @return void
  */
 private function associate($temp, $known = 0, $names = array())
 {
     $insert = array();
     $titles = $this->title->Where('temp_id', '=', $temp)->get(array('id', 'tmdb_id'));
     foreach ($titles as $k => $v) {
         if (isset($names[$v['tmdb_id']])) {
             $insert[] = array('actor_id' => $this->modelId, 'title_id' => $v['id'], 'known_for' => $known, 'char_name' => $names[$v['tmdb_id']]);
         } else {
             $insert[] = array('actor_id' => $this->modelId, 'title_id' => $v['id'], 'known_for' => $known);
         }
     }
     $this->dbWriter->compileBatchInsert('actors_titles', $insert)->save();
 }
Пример #3
0
 /**
  * Fetches and saves now playing movies.
  * 
  * @return void
  */
 public function nowPlaying()
 {
     Event::fire('Titles.NowPlayingUpdating');
     $titles = $this->title->provider->getNowPlaying();
     //if provider is imdb we'll need to run titles
     //trough imdb search insert because we need to save
     //images to filesystem first
     if ($this->title->provider->name == 'imdb') {
         $this->dbWriter->insertFromImdbSearch($titles);
     } else {
         $this->dbWriter->compileBatchInsert('titles', $titles)->save();
     }
     Event::fire('Titles.NowPlayingUpdated', array($titles));
 }
Пример #4
0
 /**
  * Saves reviews and scores to database.
  * 
  * @return void
  */
 public function saveFromMetaCritic()
 {
     //check if we got back any reviews from metacritic
     //before saving
     if ($this->data && $this->data['reviews']) {
         //add title id to reviews before inserting
         $this->addTitleId($this->title->id);
         $this->dbWriter->compileBatchInsert('reviews', $this->data['reviews'])->save();
     }
     //check if we got back any scores back
     if ($this->data && head($this->data['scores'])) {
         $this->saveScores();
     }
 }
Пример #5
0
 /**
  * Saves scraped news to the database.
  * 
  * @return void
  */
 private function save()
 {
     $this->dbWriter->compileBatchInsert('news', $this->news)->save();
 }