<?php
require_once("class.movie_info.php");
class funshion_info extends movie_info{
	var $start_key = "<div class=\"box show\">";
	var $end_key = "<div class=\"box rel\">";

	var $play_year_start = "<li><strong>首映：</strong>";
	var $play_year_end = "</li>";

	var $play_leader_start = "<li><strong>导演：</strong>";
	var $play_leader_end = "<li";

	var $play_actor_start = "<li class=\"mute actor\"><strong>主演：</strong><div class=\"c\">";
	var $play_actor_end = "</div></li>";

	var $type_start = "<li><strong>类型：</strong>";
	var $type_end = "</li>";

	var $description_start = "<strong>剧情：</strong><!-- google_ad_section_start -->";
	var $description_end = "<a href=";

	var $thumb_start = "<img class=\"still\" src=\"";
	var $thumb_end = "\" width";

	var $play_word_start = "<li class=\"mute\"><strong>点评：</strong><div class=\"c\"><span style=\"float:left;\">";
	var $play_word_end = "</span><a";

	function funshion_info($url)
	{
		$this->curl = qbase::get_object('curl');
		$this->url = $url;
	}

	function get(){
		parent::init();
		$this->param['play_leader'] = $this->get_actor('play_leader');
		$this->param['play_actor'] = $this->get_actor('play_actor');
		$this->param['type'] = $this->get_actor('type');
		$this->get_play_year();
		$this->get_play_status();
		return $this->param;
	}

	function get_play_year(){
		$tmp = explode(" ", $this->param['play_year']);
		$this->param['play_year'] = str_replace(array('年','月','日'), array('-', '-', ''), trim($tmp[0]));
		$this->param['play_area'] = trim($tmp[1]);
	}

	function get_play_status(){
		$this->param['play_status'] = strpos($this->param['play_word'], '更新至') === false ?  0 : 1;
		$this->param['play_word'] = preg_replace("/\((.*)\)/ies", "", $this->param['play_word']);
	}

	function get_actor($type){
		$this->param[$type] = str_replace("<span class=\"tiny\">/</span>","", $this->param[$type]);
		preg_match_all("/\"\>(.*?)\<\/a\>/ies", $this->param[$type], $match);e;
		$data = array();
		foreach($match[1] as $val){
			$val = trim($val);
			if($val == '更多') continue;
			$data[] = $val;
		}
		return implode(",", $data);
	}

	function charsetLocal($s){
		global $_SET;
		return qbase::iconvs($s, $_SET['def_charset'], 'utf-8');
	}
}
?>