Пример #1
0
 public function __construct($parent)
 {
     parent::__construct($parent);
 }
Пример #2
0
 /**
  *
  */
 public function get_sub($show, $request)
 {
     if (!$show || !$show instanceof wssubTvShow) {
         $this->log("get_sub() invalid show", 'error');
         return 0;
     }
     if (!$request || !$request instanceof wssubRequest) {
         $this->log("get_sub() invalid request", 'error');
         return 0;
     }
     $id = $show->get_id();
     if (is_null($id)) {
         $this->log("get_sub() no id", 'error');
         return 0;
     }
     $num_season = $request->get('season');
     if (is_null($num_season)) {
         $this->log("get_sub() no num_season", 'error');
         return 0;
     }
     $url = "http://www.tvsubtitles.net/tvshow-{$id}-{$num_season}.html";
     $doc = $this->load($url);
     if (!$doc) {
         $this->log('get_sub() no doc', 'error');
         return 0;
     }
     $season = new wssubSeason();
     $season->set_num($num_season);
     $list = $this->get_sub_parse_doc($doc);
     if (!$list) {
         $this->log('get_sub() Cannot parse doc', 'error');
         return 0;
     }
     foreach ($list as $ep) {
         $season->add_episode($ep);
     }
     $show->add_season($season);
     return 1;
 }