|
|
|
@ -155,6 +155,7 @@ Class SiteController extends Controller {
@@ -155,6 +155,7 @@ Class SiteController extends Controller {
|
|
|
|
|
//mp3支持 |
|
|
|
|
$audioExts = !empty(FSC::$app['config']['supportedAudioExts']) ? FSC::$app['config']['supportedAudioExts'] : array('mp3'); |
|
|
|
|
|
|
|
|
|
$allFiles = $scanResults; |
|
|
|
|
$showType = $this->get('show', 'all'); |
|
|
|
|
if ($showType == 'image') { |
|
|
|
|
$scanResults = array_filter($scanResults, function($item) { |
|
|
|
@ -174,7 +175,7 @@ Class SiteController extends Controller {
@@ -174,7 +175,7 @@ Class SiteController extends Controller {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//dataType支持:[image, video] |
|
|
|
|
//dataType支持:[image, video, audio] |
|
|
|
|
$dataType = $this->get('dataType', 'html'); |
|
|
|
|
if ($dataType == 'image') { |
|
|
|
|
$imgs = array(); |
|
|
|
@ -235,6 +236,17 @@ Class SiteController extends Controller {
@@ -235,6 +236,17 @@ Class SiteController extends Controller {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!empty($item['extension']) && in_array($item['extension'], $audioExts)) { |
|
|
|
|
//为音乐文件获取封面图 |
|
|
|
|
if (empty($item['snapshot'])) { |
|
|
|
|
$imgExts = !empty(FSC::$app['config']['supportedImageExts']) ? FSC::$app['config']['supportedImageExts'] : array('jpg', 'jpeg', 'png', 'webp', 'gif'); |
|
|
|
|
$matchedImage = Html::searchImageByFilename($item['filename'], $allFiles, $imgExts); |
|
|
|
|
if (!empty($matchedImage)) { |
|
|
|
|
$item['snapshot'] = $matchedImage['path']; |
|
|
|
|
}else { |
|
|
|
|
$item['snapshot'] = '/img/beauty/audio_icon.jpeg?v1'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
array_push($audios, $item); |
|
|
|
|
$index ++; |
|
|
|
|
} |
|
|
|
@ -249,7 +261,7 @@ Class SiteController extends Controller {
@@ -249,7 +261,7 @@ Class SiteController extends Controller {
|
|
|
|
|
$params = compact( |
|
|
|
|
'page', 'pageSize', 'cacheDataId', 'showType', |
|
|
|
|
'dirTree', 'scanResults', 'menus', 'htmlReadme', 'htmlCateReadme', 'mp3File', 'copyright', |
|
|
|
|
'alertWarning', 'isAdminIp' |
|
|
|
|
'alertWarning', 'isAdminIp', 'allFiles' |
|
|
|
|
); |
|
|
|
|
return $this->render($viewName, $params, $pageTitle); |
|
|
|
|
} |
|
|
|
@ -286,7 +298,7 @@ Class SiteController extends Controller {
@@ -286,7 +298,7 @@ Class SiteController extends Controller {
|
|
|
|
|
* original - 原图 |
|
|
|
|
* small - 缩略图 |
|
|
|
|
* vm - 视频封面图(vmeta) |
|
|
|
|
* am - 音乐封面图(ameta) |
|
|
|
|
* am - 音乐封面图 |
|
|
|
|
**/ |
|
|
|
|
public function actionDirsnap() { |
|
|
|
|
$code = 1; |
|
|
|
@ -307,8 +319,8 @@ Class SiteController extends Controller {
@@ -307,8 +319,8 @@ Class SiteController extends Controller {
|
|
|
|
|
$cacheSubDir = 'dir'; |
|
|
|
|
$withCreateTime = true; //返回数据的缓存时间 |
|
|
|
|
$cache = Common::getCacheFromFile($cacheKey, $expireSeconds, $cacheSubDir, $withCreateTime); |
|
|
|
|
$cachedData = $cache['data']; |
|
|
|
|
$cachedCtime = $cache['ctime']; |
|
|
|
|
$cachedData = !empty($cache) ? $cache['data'] : null; |
|
|
|
|
$cachedCtime = !empty($cache) ? $cache['ctime'] : 0; |
|
|
|
|
$now = time(); |
|
|
|
|
|
|
|
|
|
//如果关闭缩略图 |
|
|
|
@ -318,7 +330,7 @@ Class SiteController extends Controller {
@@ -318,7 +330,7 @@ Class SiteController extends Controller {
|
|
|
|
|
} |
|
|
|
|
}else if ( !empty($cachedData) && !empty($cachedData['size']) && in_array($cachedData['size'], array('vm', 'am')) ) { |
|
|
|
|
//如果是视频、音乐封面图,则缓存 10 分钟 |
|
|
|
|
if ($now - $cachedCtime > 600) { |
|
|
|
|
if ($cachedCtime > 0 && $now - $cachedCtime > 600) { |
|
|
|
|
$cachedData = null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -635,6 +647,23 @@ Class SiteController extends Controller {
@@ -635,6 +647,23 @@ Class SiteController extends Controller {
|
|
|
|
|
$videoExtension = pathinfo($arr['path'], PATHINFO_EXTENSION); |
|
|
|
|
$videoSourceType = Html::getMediaSourceType($videoExtension); |
|
|
|
|
|
|
|
|
|
//从缓存数据获取封面图 |
|
|
|
|
$poster = '/img/beauty/audio_bg.jpg'; |
|
|
|
|
$cacheSeconds = 86400; |
|
|
|
|
$cachedParentData = Common::getCacheFromFile($cacheParentDataId, $cacheSeconds); |
|
|
|
|
if (!empty($cachedParentData)) { |
|
|
|
|
$mp3 = $cachedParentData[$videoId]; |
|
|
|
|
if (!empty($mp3['snapshot'])) { |
|
|
|
|
$poster = $mp3['snapshot']; |
|
|
|
|
}else { |
|
|
|
|
$imgExts = !empty(FSC::$app['config']['supportedImageExts']) ? FSC::$app['config']['supportedImageExts'] : array('jpg', 'jpeg', 'png', 'webp', 'gif'); |
|
|
|
|
$matchedImage = Html::searchImageByFilename($mp3['filename'], $cachedParentData, $imgExts); |
|
|
|
|
if (!empty($matchedImage)) { |
|
|
|
|
$poster = $matchedImage['path']; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取联系方式 |
|
|
|
|
$maxScanDeep = 0; //最大扫描目录级数 |
|
|
|
@ -656,7 +685,7 @@ Class SiteController extends Controller {
@@ -656,7 +685,7 @@ Class SiteController extends Controller {
|
|
|
|
|
$params = compact( |
|
|
|
|
'videoUrl', 'videoId', 'videoFilename', |
|
|
|
|
'cateId', 'cacheParentDataId', 'page', 'pageSize', |
|
|
|
|
'copyright', 'isAdminIp', 'videoExtension', 'videoSourceType' |
|
|
|
|
'copyright', 'isAdminIp', 'videoExtension', 'videoSourceType', 'poster' |
|
|
|
|
); |
|
|
|
|
return $this->render($viewName, $params, $pageTitle); |
|
|
|
|
} |
|
|
|
|