feat: Add comprehensive documentation suite and reorganize project structure
- Created complete documentation in docs/ directory - Added PROJECT_OVERVIEW.md with feature highlights and getting started guide - Added ARCHITECTURE.md with system design and technical details - Added SECURITY.md with comprehensive security implementation guide - Added DEVELOPMENT.md with development workflows and best practices - Added DEPLOYMENT.md with production deployment instructions - Added API.md with complete REST API documentation - Added CONTRIBUTING.md with contribution guidelines - Added CHANGELOG.md with version history and migration notes - Reorganized all documentation files into docs/ directory for better organization - Updated README.md with proper documentation links and quick navigation - Enhanced project structure with professional documentation standards
This commit is contained in:
11
f_modules/m_frontend/m_cron/vod-server/cfg.php
Normal file
11
f_modules/m_frontend/m_cron/vod-server/cfg.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
ini_set("error_reporting", E_ALL & ~E_STRICT & ~E_NOTICE & ~E_DEPRECATED);
|
||||
|
||||
define('_ISVALID', true);
|
||||
|
||||
/* path to recordings */
|
||||
$path = getenv('VOD_REC_PATH') ?: '/mnt/rec';
|
||||
/* main url */
|
||||
$base = getenv('CRON_BASE_URL') ?: 'http://localhost:8080';
|
||||
/* cron salt key */
|
||||
$ssk = getenv('CRON_SSK') ?: 'CHANGE_ME_IN_BACKEND';
|
||||
64
f_modules/m_frontend/m_cron/vod-server/clear_vods.php
Normal file
64
f_modules/m_frontend/m_cron/vod-server/clear_vods.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/*******************************************************************************************************************
|
||||
| Software Name : EasyStream
|
||||
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
|
||||
| Software Author : (c) Sami Ahmed
|
||||
|*******************************************************************************************************************
|
||||
|
|
||||
|*******************************************************************************************************************
|
||||
| This source file is subject to the EasyStream Proprietary License Agreement.
|
||||
|
|
||||
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|
||||
|*******************************************************************************************************************
|
||||
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|
||||
|*******************************************************************************************************************/
|
||||
set_time_limit(0);
|
||||
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
|
||||
|
||||
require 'cfg.php';
|
||||
|
||||
$main_dir = realpath(dirname(__FILE__) . '/../../../../');
|
||||
set_include_path($main_dir);
|
||||
|
||||
include_once 'f_core/config.core.php';
|
||||
|
||||
$log = $path . '/.clear_vods.log';
|
||||
error_log(sprintf("[%s] clear_vods cron task...\n\n", date("Y-m-d H:i:s")), 3, $log);
|
||||
|
||||
$cmd = 'ls ' . $path . '/*out.mp4';
|
||||
|
||||
exec($cmd, $out);
|
||||
|
||||
if ($out[0]) {
|
||||
foreach ($out as $file) {
|
||||
if (file_exists($file)) {
|
||||
$base = str_replace(array($path . '/', '.mp4'), array('', ''), $file);
|
||||
$sql = sprintf("SELECT `db_id` FROM `db_livefiles` WHERE `file_name`='%s' LIMIT 1;", $base);
|
||||
$rs = $db->execute($sql);
|
||||
|
||||
if (!$rs->fields["db_id"]) {
|
||||
$a = explode("-", $file);
|
||||
$l = str_replace('out.mp4', 'p.mp4', $a[1]);
|
||||
$preview = $a[0] . $l;
|
||||
|
||||
//echo sprintf("can delete %s\n", $file);
|
||||
//echo sprintf("can delete %s\n", $preview);
|
||||
|
||||
if (unlink($file)) {
|
||||
error_log(sprintf("[%s] unlinked %s\n", date("Y-m-d H:i:s"), $file), 3, $log);
|
||||
} else {
|
||||
error_log(sprintf("[%s] failed unlink %s\n", date("Y-m-d H:i:s"), $file), 3, $log);
|
||||
}
|
||||
|
||||
if (file_exists($preview)) {
|
||||
if (unlink($preview)) {
|
||||
error_log(sprintf("[%s] unlinked %s\n", date("Y-m-d H:i:s"), $preview), 3, $log);
|
||||
} else {
|
||||
error_log(sprintf("[%s] failed unlink %s\n", date("Y-m-d H:i:s"), $preview), 3, $log);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
0
f_modules/m_frontend/m_cron/vod-server/index.html
Normal file
0
f_modules/m_frontend/m_cron/vod-server/index.html
Normal file
0
f_modules/m_frontend/m_cron/vod-server/index.php
Normal file
0
f_modules/m_frontend/m_cron/vod-server/index.php
Normal file
64
f_modules/m_frontend/m_cron/vod-server/recording_fix.php
Normal file
64
f_modules/m_frontend/m_cron/vod-server/recording_fix.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/*******************************************************************************************************************
|
||||
| Software Name : EasyStream
|
||||
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
|
||||
| Software Author : (c) Sami Ahmed
|
||||
|*******************************************************************************************************************
|
||||
|
|
||||
|*******************************************************************************************************************
|
||||
| This source file is subject to the EasyStream Proprietary License Agreement.
|
||||
|
|
||||
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|
||||
|*******************************************************************************************************************
|
||||
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|
||||
|*******************************************************************************************************************/
|
||||
set_time_limit(0);
|
||||
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
|
||||
|
||||
require 'cfg.php';
|
||||
|
||||
$main_dir = realpath(dirname(__FILE__) . '/../../../../');
|
||||
set_include_path($main_dir);
|
||||
|
||||
include_once 'f_core/config.core.php';
|
||||
|
||||
$commands = array();
|
||||
$found = 0;
|
||||
exec("ps ax", $commands);
|
||||
if (count($commands) > 0) {
|
||||
foreach ($commands as $command) {
|
||||
if (strpos($command, 'ffmpeg') === false) {
|
||||
} else {
|
||||
$found = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($found) {
|
||||
exit;
|
||||
}
|
||||
$ffmpeg = '/usr/bin/ffmpeg';
|
||||
$log = $path . '/.recording_fix.log';
|
||||
$cmd = 'ls ' . $path . '/*out.mp4';
|
||||
|
||||
error_log(sprintf("[%s] recording_fix cron task...\n\n", date("Y-m-d H:i:s")), 3, $log);
|
||||
|
||||
exec($cmd, $out);
|
||||
|
||||
if ($out[0]) {
|
||||
foreach ($out as $file) {
|
||||
if (!is_file($file) or (is_file($file) and filesize($file) == 0)) {
|
||||
$flv = str_replace(".mp4", ".flv", $file);
|
||||
|
||||
if (file_exists($flv) and filesize($flv) > 0) {
|
||||
$cmd_ffmpeg = sprintf("%s -y -i %s -codec copy -movflags +faststart %s", $ffmpeg, $flv, $file);
|
||||
error_log(sprintf("[%s] %s\n", date("Y-m-d H:i:s"), $cmd_ffmpeg), 3, $log);
|
||||
|
||||
exec($cmd_ffmpeg . ' 2>&1', $out_ffmpeg);
|
||||
$result = implode("\n", $out_ffmpeg);
|
||||
|
||||
VFileinfo::write($log, $result . "\n\n\n", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/*******************************************************************************************************************
|
||||
| Software Name : EasyStream
|
||||
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
|
||||
| Software Author : (c) Sami Ahmed
|
||||
|*******************************************************************************************************************
|
||||
|
|
||||
|*******************************************************************************************************************
|
||||
| This source file is subject to the EasyStream Proprietary License Agreement.
|
||||
|
|
||||
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|
||||
|*******************************************************************************************************************
|
||||
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|
||||
|*******************************************************************************************************************/
|
||||
ini_set("error_reporting", E_ALL & ~E_STRICT & ~E_NOTICE & ~E_DEPRECATED);
|
||||
|
||||
define('_ISVALID', true);
|
||||
|
||||
require 'cfg.php';
|
||||
|
||||
$cmd = 'ls ' . $path . '/*out.mp4';
|
||||
|
||||
exec($cmd, $out);
|
||||
|
||||
if ($out[0]) {
|
||||
foreach ($out as $file) {
|
||||
if (file_exists($file)) {
|
||||
$a = explode("-", $file);
|
||||
$l = str_replace('out.mp4', 'p.mp4', $a[1]);
|
||||
$preview = $a[0] . $l;
|
||||
|
||||
if (!file_exists($preview)) {
|
||||
$cmd = 'ffmpeg -y -t 30 -i ' . $file . ' -codec copy -movflags +faststart ' . $preview;
|
||||
|
||||
exec(escapeshellcmd($cmd) . ' >/dev/null &');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
37
f_modules/m_frontend/m_cron/vod-server/sync_df.php
Normal file
37
f_modules/m_frontend/m_cron/vod-server/sync_df.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/*******************************************************************************************************************
|
||||
| Software Name : EasyStream
|
||||
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
|
||||
| Software Author : (c) Sami Ahmed
|
||||
|*******************************************************************************************************************
|
||||
|
|
||||
|*******************************************************************************************************************
|
||||
| This source file is subject to the EasyStream Proprietary License Agreement.
|
||||
|
|
||||
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|
||||
|*******************************************************************************************************************
|
||||
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|
||||
|*******************************************************************************************************************/
|
||||
ini_set("error_reporting", E_ALL & ~E_STRICT & ~E_NOTICE & ~E_DEPRECATED);
|
||||
|
||||
define('_ISVALID', true);
|
||||
define('_SERVER_SLUG', 'vods1-local');
|
||||
|
||||
require 'cfg.php';
|
||||
|
||||
$url = $base . '/syncdf?s=';
|
||||
|
||||
$df = disk_free_space("/");
|
||||
$free = $df;
|
||||
|
||||
$date = date("Y-m-d");
|
||||
$tk = md5($date . $ssk);
|
||||
$url = sprintf("%s%s&a=%s&_=%s", $url, $tk, _SERVER_SLUG, $free);
|
||||
|
||||
$curl = curl_init($url);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
$data = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
73
f_modules/m_frontend/m_cron/vod-server/sync_vods.php
Normal file
73
f_modules/m_frontend/m_cron/vod-server/sync_vods.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/*******************************************************************************************************************
|
||||
| Software Name : EasyStream
|
||||
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
|
||||
| Software Author : (c) Sami Ahmed
|
||||
|*******************************************************************************************************************
|
||||
|
|
||||
|*******************************************************************************************************************
|
||||
| This source file is subject to the EasyStream Proprietary License Agreement.
|
||||
|
|
||||
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|
||||
|*******************************************************************************************************************
|
||||
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|
||||
|*******************************************************************************************************************/
|
||||
ini_set("error_reporting", E_ALL & ~E_STRICT & ~E_NOTICE & ~E_DEPRECATED);
|
||||
|
||||
define('_ISVALID', true);
|
||||
|
||||
require 'cfg.php';
|
||||
|
||||
$url = $base . '/syncvods?s=';
|
||||
|
||||
$date = date("Y-m-d");
|
||||
$tk = md5($date . $ssk);
|
||||
$url .= $tk;
|
||||
|
||||
$curl = curl_init($url);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
$data = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
|
||||
$list = json_decode($data);
|
||||
|
||||
$log = $path . '/.sync_vods.log';
|
||||
error_log(sprintf("[%s] sync_vods cron task...\n\n", date("Y-m-d H:i:s")), 3, $log);
|
||||
|
||||
if ($list[0]) {
|
||||
foreach ($list as $filename) {
|
||||
$vod = $path . '/' . $filename . '.mp4';
|
||||
if (file_exists($vod)) {
|
||||
if (unlink($vod)) {
|
||||
error_log(sprintf("[%s] unlinked %s\n", date("Y-m-d H:i:s"), $vod), 3, $log);
|
||||
} else {
|
||||
error_log(sprintf("[%s] failed unlink %s\n", date("Y-m-d H:i:s"), $vod), 3, $log);
|
||||
}
|
||||
}
|
||||
|
||||
$flv = $path . '/' . $filename . '.flv';
|
||||
if (file_exists($flv)) {
|
||||
if (unlink($flv)) {
|
||||
error_log(sprintf("[%s] unlinked %s\n", date("Y-m-d H:i:s"), $flv), 3, $log);
|
||||
} else {
|
||||
error_log(sprintf("[%s] failed unlink %s\n", date("Y-m-d H:i:s"), $flv), 3, $log);
|
||||
}
|
||||
}
|
||||
|
||||
$ff = explode("-", $filename);
|
||||
$_ff = str_replace('out', 'p', $ff[1]);
|
||||
|
||||
$pv = $path . '/' . $ff[0] . $_ff . '.mp4';
|
||||
if (file_exists($pv)) {
|
||||
if (unlink($pv)) {
|
||||
error_log(sprintf("[%s] unlinked %s\n", date("Y-m-d H:i:s"), $pv), 3, $log);
|
||||
} else {
|
||||
error_log(sprintf("[%s] failed unlink %s\n", date("Y-m-d H:i:s"), $pv), 3, $log);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user