Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by http://DeZender.Net
- * @ deZender (PHP7 Decoder for ionCube Encoder)
- *
- * @ Version : 4.1.0.1
- * @ Author : DeZender
- * @ Release on : 29.08.2020
- * @ Official site : http://DeZender.Net
- *
- */
- include 'functions.php';
- set_time_limit(0);
- ini_set('default_socket_timeout', 15);
- ini_set('memory_limit', -1);
- if (isset($argv[1]) && (strtoupper($argv[1]) == 'START')) {
- gc_enable();
- $rWait = 10000;
- $rFailWait = 15;
- $rKeyWait = 5;
- if (isset($argv[2]) && (strlen($argv[2]) == 32)) {
- $rChannel = $argv[2];
- plog('Shutting down previous instances.');
- exec('kill -9 `ps -ef | grep \'DRM_' . $rChannel . '\' | grep -v grep | awk \'{print $2}\'`');
- cli_set_process_title('DRM_' . $rChannel);
- $rDatabase = deleteCache($rChannel);
- $rDatabase = setCache($rDatabase, 'php_pid', getmypid());
- saveCache($rChannel, $rDatabase);
- while (true) {
- plog('Starting: ' . $rChannel);
- plog('Killing directory if exists.');
- exec('rm -rf ' . MAIN_DIR . 'video/' . $rChannel);
- exec('rm -rf ' . MAIN_DIR . 'hls/' . $rChannel);
- $rDatabase = setCache($rDatabase, 'php_pid', getmypid());
- saveCache($rChannel, $rDatabase);
- plog('Creating new directory.');
- mkdir(MAIN_DIR . 'video/' . $rChannel);
- mkdir(MAIN_DIR . 'video/' . $rChannel . '/aria');
- mkdir(MAIN_DIR . 'video/' . $rChannel . '/decrypted');
- mkdir(MAIN_DIR . 'video/' . $rChannel . '/encrypted');
- mkdir(MAIN_DIR . 'video/' . $rChannel . '/final');
- mkdir(MAIN_DIR . 'hls/' . $rChannel);
- mkdir(MAIN_DIR . 'hls/' . $rChannel . '/hls');
- plog('Grabbing DASH playlist.');
- $rData = getBellChannel($rChannel);
- if ($rData['status']) {
- $rChannelData = $rData['data'];
- }
- else {
- $rChannelData = NULL;
- }
- unset($rData);
- if ($rChannelData) {
- $rStarted = false;
- $rMemoryUsage = 0;
- $rFFPID = NULL;
- $rStreamInfo = NULL;
- while (true) {
- plog('Start loop handler.');
- $rMemoryUsage = memory_get_usage();
- plog('Memory usage: ' . round($rMemoryUsage / 1024 / 1024, 2) . ' MB');
- plog('DRM Processes: ' . getProcessCount());
- $rKeyFail = false;
- $rStart = round(microtime(true) * 1000);
- if (!is_dir(MAIN_DIR . 'video/' . $rChannel . '/final')) {
- plog('Force stopped.');
- break;
- }
- plog('Fetching segments...');
- $rSegments = getBellSegments($rChannelData, $rConfig['segments_bell']);
- if ($rSegments && (0 < strlen($rSegments['video']))) {
- $rKeys = getKeyCache(md5($rSegments['video']));
- if (!$rKeys) {
- foreach (range(1, 3) as $rRetry) {
- plog('Get keys for ID: ' . $rChannel);
- $rData = getKey('bell', base64_encode($rSegments['pssh']));
- if ($rData['status']) {
- plog('Got keys: ' . json_encode($rData['key']));
- $rKeys = $rData['key'];
- if (!setKeyCache(md5($rSegments['video']), json_encode($rData['key']))) {
- plog('[FATAL] Cannot write to keystore! Exiting to conserve server integrity.');
- exit();
- }
- break;
- }
- else {
- plog('[ERROR] Failed to get key. Retry.');
- }
- unset($rRetry, $rData);
- }
- }
- else {
- plog('Key already cached.');
- $rKeys = json_decode($rKeys, true);
- }
- if ($rKeys) {
- $rCompleted = processSegments($rKeys, $rSegments, $rVideoDir . '/' . $rChannel, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36');
- if (0 < $rCompleted[1]) {
- plog('Finished processing segments.');
- if ($rCompleted[1] != $rCompleted[0]) {
- plog('Skip sleep period.');
- $rStart = 0;
- }
- file_put_contents(MAIN_DIR . 'video/' . $rChannel . '/.update', '1');
- plog('Updating segment text list.');
- updateSegments($rVideoDir . '/' . $rChannel, 10, false, 21600, $rSegments['add']);
- if (!$rFFPID || !file_exists('/proc/' . $rFFPID) || (file_exists(MAIN_DIR . ('hls/' . $rChannel . '/hls/playlist.m3u8')) && (60 <= time() - filemtime(MAIN_DIR . ('hls/' . $rChannel . '/hls/playlist.m3u8'))))) {
- if (file_exists(MAIN_DIR . 'video/' . $rChannel . '/.ffmpeg')) {
- plog('[ERROR] Ffmpeg failure! Increase fail limit.');
- .....................................................................
- ............................................
- ...................
Add Comment
Please, Sign In to add comment