unset($_SESSION['collection']); $songId = OC_MEDIA_SCANNER::scanFile($arguments['path']); } if ($songId > 0) { $song = OC_MEDIA_COLLECTION::getSong($songId); $song['artist'] = OC_MEDIA_COLLECTION::getArtistName($song['song_artist']); $song['album'] = OC_MEDIA_COLLECTION::getAlbumName($song['song_album']); OC_JSON::encodedPrint($song); } } break; case 'play': ob_end_clean(); $ftype = OC_Filesystem::getMimeType($arguments['path']); $songId = OC_MEDIA_COLLECTION::getSongByPath($arguments['path']); OC_MEDIA_COLLECTION::registerPlay($songId); header('Content-Type:' . $ftype); // calc an offset of 24 hours $offset = 3600 * 24; // calc the string in GMT not localtime and add the offset $expire = "Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT"; //output the HTTP header header($expire); header('Cache-Control: max-age=3600, must-revalidate'); header('Pragma: public'); header('Accept-Ranges: bytes'); header('Content-Length: ' . OC_Filesystem::filesize($arguments['path'])); $gmt_mtime = gmdate('D, d M Y H:i:s', OC_Filesystem::filemtime($arguments['path'])) . ' GMT'; header("Last-Modified: " . $gmt_mtime); OC_Filesystem::readfile($arguments['path']); exit;