-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRecordingService.php
More file actions
executable file
·43 lines (34 loc) · 1.35 KB
/
Copy pathRecordingService.php
File metadata and controls
executable file
·43 lines (34 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace XcVm\Module\Watch;
use XcVm\Core\Database\QueryHelper;
/**
* RecordingService — recording service
*
* @package XC_VM_Module_Watch
* @author Divarion_D <https://github.com/Divarion-D>
* @copyright 2025-2026 Vateron Media
* @link https://github.com/Vateron-Media/XC_VM
* @license AGPL-3.0 https://www.gnu.org/licenses/agpl-3.0.html
*/
class RecordingService {
use \XcVm\Infrastructure\Database\DatabaseAware;
public static function schedule($rData) {
$db = self::db();
if (empty($rData['title'])) {
return array('status' => STATUS_NO_TITLE);
}
if (empty($rData['source_id'])) {
return array('status' => STATUS_NO_SOURCE);
}
$rArray = QueryHelper::verifyPostTable('recordings', $rData);
$rArray['bouquets'] = '[' . implode(',', array_map('intval', (array) ($rData['bouquets'] ?? []))) . ']';
$rArray['category_id'] = '[' . implode(',', array_map('intval', (array) ($rData['category_id'] ?? []))) . ']';
$rPrepare = QueryHelper::prepareArray($rArray);
$rQuery = 'REPLACE INTO `recordings`(' . $rPrepare['columns'] . ') VALUES(' . $rPrepare['placeholder'] . ');';
if ($db->query($rQuery, ...$rPrepare['data'])) {
$rInsertID = $db->last_insert_id();
return array('status' => STATUS_SUCCESS, 'data' => array('insert_id' => $rInsertID));
}
return array('status' => STATUS_FAILURE, 'data' => $rData);
}
}