Skip to content

Commit

Permalink
Updates to locate the converted index,mp4
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Neto committed Dec 12, 2024
1 parent 34abc69 commit 531bd3d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
11 changes: 8 additions & 3 deletions objects/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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'],
Expand Down
4 changes: 2 additions & 2 deletions objects/functionsFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)");
Expand Down
9 changes: 9 additions & 0 deletions objects/video.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)";
Expand Down Expand Up @@ -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}";
Expand All @@ -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);
Expand Down

0 comments on commit 531bd3d

Please sign in to comment.