Added tmp folder cleanup check.
This commit is contained in:
parent
4954d6da57
commit
5a1fa30854
@ -8,6 +8,7 @@
|
||||
$TEXTVIEWER = "leafpad";
|
||||
$FILEMANAGER = "spacefm";
|
||||
$LOCKPASSWORD = "1234";
|
||||
$TMPFOLDERSIZE = 8000; // tmp folder size check for cleanup if above 8GB used.
|
||||
$UNLOCKTIME = 80; // Every ~3 sec this ticks down
|
||||
// Ex: 3*60 == 180 sec or 3 minutes
|
||||
// NOTE: Split folders with ::::
|
||||
|
@ -141,7 +141,23 @@ function remuxVideo($FILE) {
|
||||
$HASHED_NAME = hash('sha256', $FILE) . '.mp4';
|
||||
$EXTNSN = strtolower(pathinfo($FILE, PATHINFO_EXTENSION));
|
||||
|
||||
|
||||
if (!file_exists($PTH . $HASHED_NAME)) {
|
||||
$io = popen('/usr/bin/du -sm ' . $PTH, 'r');
|
||||
$size = fgets($io, 4096);
|
||||
$size = (int) substr($size, 0, strpos ( $size, "\t" ));
|
||||
pclose ($io);
|
||||
|
||||
include 'config.php';
|
||||
if ($size > $TMPFOLDERSIZE) {
|
||||
|
||||
$files = glob($PTH . '*');
|
||||
foreach($files as $file){
|
||||
if(is_file($file))
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match('(mkv)', $EXTNSN) === 1) {
|
||||
$COMMAND = 'ffmpeg -i "' . $FILE . '" -movflags +faststart -codec copy ' . $PTH . $HASHED_NAME;
|
||||
shell_exec($COMMAND . " > /dev/null &");
|
||||
|
Loading…
Reference in New Issue
Block a user