Exemple #1
0
 static function getInfo($mid, $opt = null)
 {
     ///// Voice
     if (preg_match("/v([\\d]+)/", $mid, $matches)) {
         $id = intval($matches[1]);
         $voiceDb = new VoiceInfoDB();
         $info = $voiceDb->getInfo($id);
         if ($info && $opt['detail']) {
             $voiceDb->getDetail($info);
         }
         if ($info && $opt['playing']) {
             $voiceDb->getPlaying($info);
         }
         return $info;
     }
     return null;
 }
Exemple #2
0
 function handle()
 {
     if (is_a($this->info, 'VoiceInfo')) {
         $path = $this->info->dst;
         if (!file_exists($path)) {
             throw new VoiceException(self::ERROR_NO_FILE);
         }
         $voiceDb = new VoiceInfoDB();
         $voiceDb->getPlaying($this->info);
         $this->info->playedCount++;
         $voiceDb->updatePlaying($this->info);
         //header('Cache-Control: public');
         header('Content-type: audio/mpeg');
         header('Accept-Ranges: bytes');
         header('Content-Length: ' . filesize($path));
         readfile($path);
     }
 }
Exemple #3
0
 function testGetListByRecent()
 {
     $store = new VoiceInfoDB();
     $list = $store->getListByRecent(10);
     $this->assertSame(true, is_array($list));
 }
Exemple #4
0
 function updateRecord($info)
 {
     $db = new VoiceInfoDB();
     $info->dst = $this->newPath($info);
     $db->updateInfo($info);
 }