diff --git a/objects/functions.php b/objects/functions.php index 52b0dd16a4ed..c6efdc1c6184 100644 --- a/objects/functions.php +++ b/objects/functions.php @@ -1171,12 +1171,12 @@ function getVideosURL_V2($fileName, $recreateCache = false, $checkFiles = true) } if ($parts['filename'] == 'index') { $parts['filename'] = str_replace(Video::getPathToFile($parts['dirname']), '', $parts['dirname']); + $parts['filename'] = str_replace(getVideosDir(), '', $parts['filename']); } - //$timeName2 = "getVideosURL_V2::Video::getSourceFile({$parts['filename']}, .{$parts['extension']})"; //TimeLogStart($timeName2); $source = Video::getSourceFile($parts['filename'], ".{$parts['extension']}"); - + /* if(empty($recreateCache) && $fileName == "video_230816233020_vb81e"){ var_dump($fileName, $source);exit; @@ -1216,8 +1216,13 @@ function getVideosURL_V2($fileName, $recreateCache = false, $checkFiles = true) } } + $_filename = "{$parts['filename']}.{$parts['extension']}"; + if($parts['basename'] == 'index.mp4' ){ + $_filename = "index.mp4"; + } + $_file = [ - 'filename' => "{$parts['filename']}.{$parts['extension']}", + 'filename' => $_filename, 'path' => $file, 'url' => $source['url'], 'url_noCDN' => @$source['url_noCDN'], diff --git a/objects/functionsFile.php b/objects/functionsFile.php index bbbd14632da7..f63a8dc80a33 100644 --- a/objects/functionsFile.php +++ b/objects/functionsFile.php @@ -807,10 +807,10 @@ function globVideosDir($filename, $filesOnly = false, $recreateCache = false) $cleanfilename = ''; } - $pattern = "/{$cleanfilename}.*"; + $pattern = "/({$cleanfilename}|index).*"; if (!empty($filesOnly)) { $formats = getValidFormats(); - $pattern .= ".(" . implode("|", $formats) . ")"; + $pattern .= ".(" . implode("|", $formats) . ")$"; } $pattern .= "/"; //_error_log("_glob($dir, $pattern)"); diff --git a/objects/video.php b/objects/video.php index 73436149076a..d0a5468c95ab 100644 --- a/objects/video.php +++ b/objects/video.php @@ -4057,6 +4057,7 @@ public static function getSourceFile($filename, $type = ".jpg", $includeS3 = fal //if (!isValidFormats($type)) { //return array(); //} + $filename = str_replace(getVideosDir(), '', $filename); $timeLog1Limit = 0.2; $timeLog1 = "getSourceFile($filename, $type, $includeS3)"; @@ -4121,6 +4122,7 @@ public static function getSourceFile($filename, $type = ".jpg", $includeS3 = fal if ($type == ".m3u8") { $source['path'] = self::getStoragePath() . "{$filename}/index{$type}"; } + $indexMP4Exits = false; $indexMP3Exits = false; if ($type == ".mp3") { $exits = self::getStoragePath() . "{$filename}/index{$type}"; @@ -4129,6 +4131,13 @@ public static function getSourceFile($filename, $type = ".jpg", $includeS3 = fal $source['path'] = $exits; } } + if ($type == ".mp4") { + $exits = self::getStoragePath() . "{$filename}/index{$type}"; + $indexMP4Exits = file_exists($exits); + if ($indexMP4Exits) { + $source['path'] = $exits; + } + } TimeLogEnd($timeLog1, __LINE__, $timeLog1Limit); $cleanFileName = self::getCleanFilenameFromFile($filename); TimeLogEnd($timeLog1, __LINE__, $timeLog1Limit);