-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtime_uhr.php
More file actions
25 lines (16 loc) · 765 Bytes
/
Copy pathtime_uhr.php
File metadata and controls
25 lines (16 loc) · 765 Bytes
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
<?php
$config = require __DIR__ . '/vod-config.php';
// Zeitzone setzen
date_default_timezone_set($config['system']['timezone'] ?? 'Europe/Berlin');
$apiPath = $config['files']['api'];
$timeLeftPath = $config['files']['time_left'];
if (!file_exists($apiPath) || !file_exists($timeLeftPath) || !filesize($apiPath) || !filesize($timeLeftPath)) exit;
$data = json_decode(file_get_contents($apiPath), true);
$time_left = trim(file_get_contents($timeLeftPath));
if (!is_array($data) || !isset($data['playback_time']) || !$time_left) exit;
$now = time();
$parts = explode(':', $time_left);
if (count($parts) < 2) exit;
$rest_secs = ($parts[0] * 3600) + ($parts[1] * 60) + ($parts[2] ?? 0);
$end_ts = $now + $rest_secs;
echo "🕛 bis " . date('H:i:s', $end_ts);