mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
Try to make a better filename
This commit is contained in:
parent
2fd39729fa
commit
0fb1dbe009
3 changed files with 4 additions and 4 deletions
|
@ -28,7 +28,7 @@ if ($return_val !== 0) {
|
||||||
$obj->title = __("Congratulations!");
|
$obj->title = __("Congratulations!");
|
||||||
$obj->text = sprintf(__("Your video (%s) is downloading"), $title);
|
$obj->text = sprintf(__("Your video (%s) is downloading"), $title);
|
||||||
$filename = preg_replace("/[^A-Za-z0-9]+/", "_", $title);
|
$filename = preg_replace("/[^A-Za-z0-9]+/", "_", $title);
|
||||||
$filename = uniqid("{$filename}_uniqid_", true).".mp4";
|
$filename = uniqid("{$filename}_YPTuniqid_", true).".mp4";
|
||||||
$cmd = PHP_BINDIR."/php -f youtubeDl.php {$filename} {$_POST['videoURL']} {$userId} > /dev/null 2>/dev/null &";
|
$cmd = PHP_BINDIR."/php -f youtubeDl.php {$filename} {$_POST['videoURL']} {$userId} > /dev/null 2>/dev/null &";
|
||||||
exec($cmd);
|
exec($cmd);
|
||||||
$obj->command = $cmd;
|
$obj->command = $cmd;
|
||||||
|
|
|
@ -971,7 +971,7 @@ class Video {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setTitle($title) {
|
function setTitle($title) {
|
||||||
$this->title = $title;
|
$this->title = trim($title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
||||||
|
|
||||||
$path_parts = pathinfo($_FILES['upl']['name']);
|
$path_parts = pathinfo($_FILES['upl']['name']);
|
||||||
$mainName = preg_replace("/[^A-Za-z0-9]/", "", $path_parts['filename']);
|
$mainName = preg_replace("/[^A-Za-z0-9]/", "", $path_parts['filename']);
|
||||||
$filename = uniqid($mainName . "_uniqid_", true);
|
$filename = uniqid($mainName . "_YPTuniqid_", true);
|
||||||
|
|
||||||
$video = new Video(preg_replace("/_+/", " ", $_FILES['upl']['name']), $filename, @$_FILES['upl']['videoId']);
|
$video = new Video(preg_replace("/_+/", " ", $_FILES['upl']['name']), $filename, @$_FILES['upl']['videoId']);
|
||||||
$video->setDuration($duration);
|
$video->setDuration($duration);
|
||||||
|
@ -168,7 +168,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
||||||
$video->setDescription($_FILES['upl']['description']);
|
$video->setDescription($_FILES['upl']['description']);
|
||||||
}
|
}
|
||||||
$videoNewTitle = $video->getTitle();
|
$videoNewTitle = $video->getTitle();
|
||||||
$titleParts = explode("_uniqid_", $videoNewTitle);
|
$titleParts = explode("YPTuniqid", $videoNewTitle);
|
||||||
$video->setTitle($titleParts[0]);
|
$video->setTitle($titleParts[0]);
|
||||||
$id = $video->save($updateVideoGroups);
|
$id = $video->save($updateVideoGroups);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue