|
@@ -6,6 +6,9 @@
|
|
|
* Time: 下午3:32
|
|
|
*/
|
|
|
|
|
|
+require_once(BASE_DATA_PATH . '/api/audio/getid3.php');
|
|
|
+
|
|
|
+
|
|
|
class block_filter
|
|
|
{
|
|
|
protected $mSpecialId;
|
|
@@ -51,11 +54,11 @@ class block_filter
|
|
|
$this->calc_show($this->mItems['type'],$this->mItems['data'],$this->mItems['image'],$show_type,$show_data);
|
|
|
$this->mItems['show_type'] = $show_type;
|
|
|
$this->mItems['show_data'] = $show_data;
|
|
|
- $this->mItems['reserved'] = $this->reserved($show_type,$this->mItems['reserved']);
|
|
|
+ $this->mItems['reserved'] = $this->reserved($show_type,$this->mItems['reserved'],$show_data);
|
|
|
|
|
|
return $this->mItems;
|
|
|
}
|
|
|
- protected function reserved($show_type,$reserved)
|
|
|
+ protected function reserved($show_type,$reserved,$show_data)
|
|
|
{
|
|
|
if($show_type == 'goods_top')
|
|
|
{
|
|
@@ -108,6 +111,25 @@ class block_filter
|
|
|
return $reserved;
|
|
|
}
|
|
|
}
|
|
|
+ elseif($show_type == 'audio')
|
|
|
+ {
|
|
|
+ $path = $this->audio_local($show_data);
|
|
|
+ if($path != false)
|
|
|
+ {
|
|
|
+ $getID3 = new getID3();
|
|
|
+ $info = $getID3->analyze($path);
|
|
|
+ if(array_key_exists('playtime_seconds',$info))
|
|
|
+ {
|
|
|
+ $sec = intval($info['playtime_seconds']);
|
|
|
+ return "playtime={$sec}";
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return $reserved;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return $reserved;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
protected function topimages($level)
|
|
@@ -132,7 +154,7 @@ class block_filter
|
|
|
$this->calc_show($this->mItems['rectangle1_type'],$this->mItems['rectangle1_data'],$this->mItems['rectangle1_image'],$show_type,$show_data);
|
|
|
$this->mItems['rectangle1_show_type'] = $show_type;
|
|
|
$this->mItems['rectangle1_show_data'] = $show_data;
|
|
|
- $this->mItems['rectangle1_reserved'] = $this->reserved($show_type,$this->mItems['rectangle1_reserved']);
|
|
|
+ $this->mItems['rectangle1_reserved'] = $this->reserved($show_type,$this->mItems['rectangle1_reserved'],$show_data);
|
|
|
}
|
|
|
|
|
|
if(true)
|
|
@@ -142,7 +164,7 @@ class block_filter
|
|
|
$this->calc_show($this->mItems['rectangle2_type'],$this->mItems['rectangle2_data'],$this->mItems['rectangle2_image'],$show_type,$show_data);
|
|
|
$this->mItems['rectangle2_show_type'] = $show_type;
|
|
|
$this->mItems['rectangle2_show_data'] = $show_data;
|
|
|
- $this->mItems['rectangle2_reserved'] = $this->reserved($show_type,$this->mItems['rectangle2_reserved']);
|
|
|
+ $this->mItems['rectangle2_reserved'] = $this->reserved($show_type,$this->mItems['rectangle2_reserved'],$show_data);
|
|
|
}
|
|
|
if(true)
|
|
|
{
|
|
@@ -151,7 +173,7 @@ class block_filter
|
|
|
$this->calc_show($this->mItems['square_type'],$this->mItems['square_data'],$this->mItems['square_image'],$show_type,$show_data);
|
|
|
$this->mItems['square_show_type'] = $show_type;
|
|
|
$this->mItems['square_show_data'] = $show_data;
|
|
|
- $this->mItems['square_reserved'] = $this->reserved($show_type,$this->mItems['square_reserved']);
|
|
|
+ $this->mItems['square_reserved'] = $this->reserved($show_type,$this->mItems['square_reserved'],$show_data);
|
|
|
}
|
|
|
|
|
|
return $this->mItems;
|
|
@@ -200,7 +222,7 @@ class block_filter
|
|
|
$this->calc_show($item['type'],$item['data'],$item['image'],$show_type,$show_data);
|
|
|
$item['show_type'] = $show_type;
|
|
|
$item['show_data'] = $show_data;
|
|
|
- $item['reserved'] = $this->reserved($show_type,$item['reserved']);
|
|
|
+ $item['reserved'] = $this->reserved($show_type,$item['reserved'],$show_data);
|
|
|
|
|
|
$items[$image] = $item;
|
|
|
}
|
|
@@ -233,4 +255,14 @@ class block_filter
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public function audio_local($file)
|
|
|
+ {
|
|
|
+ $path = BASE_DATA_PATH . "/upload/audio/{$file}";
|
|
|
+ if(file_exists($path)) {
|
|
|
+ return $path;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|