예제 #1
0
 public function get_sub_parse_doc($doc)
 {
     if (!$doc) {
         $this->log("get_sub_parse_doc() No doc", 'error');
         return 0;
     }
     $tab = $doc->getElementById("table5");
     if (!$tab) {
         $this->log("get_sub_parse_doc() No tab element", 'error');
         return 0;
     }
     $tdArray = array(0 => null, 1 => 'num', 2 => 'title', 3 => 'amount', 4 => 'subtitles');
     $list = array();
     foreach ($tab->getElementsByTagName("tr") as $tr) {
         $ep = new wssubEpisode();
         $count = 0;
         foreach ($tr->getElementsByTagName("td") as $td) {
             $count++;
             if (!$tdArray[$count]) {
                 continue;
             }
             if ($tdArray[$count] == 'num') {
                 $ep->set_num($td->textContent);
             }
             if ($tdArray[$count] == 'title') {
                 $ep->set_title($td->textContent);
             }
             if ($tdArray[$count] == 'num') {
                 $ep->set_num($this->extract_episode_number($td->textContent));
             }
             if ($tdArray[$count] == 'subtitles') {
                 foreach ($td->getElementsByTagName('a') as $a) {
                     $sub = new wssubSubtitle();
                     $sub->set_id($this->extract_subtitle_id($a->getAttribute('href')));
                     $img_pool = $a->getElementsByTagName('img');
                     if (!$img_pool) {
                         exit("No tag img for subtitle<br>");
                     }
                     $img = $img_pool->item(0);
                     if (!$img) {
                         exit("No image for subtitle<br>");
                     }
                     if ($img->hasAttribute('alt')) {
                         $sub->set_lang($img->getAttribute('alt'));
                     }
                     $ep->add_sub($sub);
                 }
             }
         }
         array_push($list, $ep);
     }
     return $list;
 }
예제 #2
0
 public function __construct($parent)
 {
     parent::__construct($parent);
 }
예제 #3
0
 public function set_title($value)
 {
     parent::set_title(strtolower($value));
 }