Bugfix API method + Status Field Media file
This commit is contained in:
parent
33628e5b54
commit
bfdd27fbcc
@ -39,7 +39,7 @@ class TalpaApi {
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
CURLOPT_CUSTOMREQUEST => $method,
|
||||
CURLOPT_HTTPHEADER => [
|
||||
'Accept: application/json',
|
||||
'Content-Type: application/json',
|
||||
@ -84,7 +84,7 @@ class TalpaApi {
|
||||
}
|
||||
|
||||
public function getMediaAssetDetails($assetId) {
|
||||
return $this->request('GET', "/mam/v1/mediaAssets/{$assetId}?full=false");
|
||||
return $this->request('GET', '/mam/v1/mediaAssets/'.$assetId.'?full=false');
|
||||
}
|
||||
|
||||
public function createTransmission($data) {
|
||||
|
||||
59
index.php
59
index.php
@ -30,7 +30,7 @@ if (isset($_POST['add_commercial'])) {
|
||||
$apiLogs[] = ['call' => 'Get Media Asset Details', 'response' => $api->lastResponse];
|
||||
|
||||
$label = $details['mediaAssetLabel'] ?? 'Pending';
|
||||
$stmt = $db->prepare("INSERT INTO commercials (title, duration, season_id, content_id, media_asset_id, media_asset_label) VALUES (?, ?, ?, ?, ?, ?)");
|
||||
$stmt = $db->prepare("INSERT INTO commercials (title, duration, season_id, content_id, media_asset_id, media_asset_label, upload_status) VALUES (?, ?, ?, ?, ?, ?, 'pending')");
|
||||
$stmt->execute([$_POST['title'], $_POST['duration'], $_POST['season_id'], $ep['id'], $asset['id'], $label]);
|
||||
}
|
||||
}
|
||||
@ -74,6 +74,14 @@ if (isset($_POST['sync_item'])) {
|
||||
->execute([$status, json_encode($res), $_POST['sync_id']]);
|
||||
}
|
||||
|
||||
// 4. Media Asset Label en Status bijwerken
|
||||
if (isset($_POST['update_media_asset'])) {
|
||||
$stmt = $db->prepare("UPDATE commercials SET media_asset_label = ?, upload_status = ? WHERE id = ?");
|
||||
$stmt->execute([$_POST['media_asset_label'], $_POST['upload_status'], $_POST['commercial_id']]);
|
||||
header("Location: index.php?view_date=" . $selectedDate);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Data ophalen
|
||||
$commercials = $db->query("SELECT * FROM commercials ORDER BY created_at DESC")->fetchAll();
|
||||
$selectedDate = $_GET['view_date'] ?? date('Y-m-d');
|
||||
@ -189,22 +197,45 @@ if (isset($_GET['edit'])) {
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3>Media Asset Labels</h3>
|
||||
<table class="table table-striped bg-white shadow-sm">
|
||||
<thead class="table-secondary">
|
||||
<tr><th>Titel</th><th>Duur</th><th>Content ID</th><th>Label (Filename)</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($commercials as $c): ?>
|
||||
<tr>
|
||||
<h3>Media Asset Management</h3>
|
||||
<div class="card p-3 shadow-sm">
|
||||
<table class="table table-striped bg-white align-middle">
|
||||
<thead class="table-secondary">
|
||||
<tr>
|
||||
<th>Titel</th>
|
||||
<th>Duur</th>
|
||||
<th>Content ID</th>
|
||||
<th>Label (Filename)</th>
|
||||
<th>Upload Status</th>
|
||||
<th style="width: 120px;">Actie</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($commercials as $c): ?>
|
||||
<tr>
|
||||
<form method="POST">
|
||||
<input type="hidden" name="commercial_id" value="<?= $c['id'] ?>">
|
||||
<td><?= htmlspecialchars($c['title']) ?></td>
|
||||
<td><span class="badge bg-info text-dark"><?= $c['duration'] ?></span></td>
|
||||
<td><code><?= htmlspecialchars($c['content_id']) ?></code></td>
|
||||
<td><strong><?= htmlspecialchars($c['media_asset_label']) ?></strong></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<td>
|
||||
<input type="text" name="media_asset_label" class="form-control form-control-sm" value="<?= htmlspecialchars($c['media_asset_label']) ?>">
|
||||
</td>
|
||||
<td>
|
||||
<select name="upload_status" class="form-select form-select-sm">
|
||||
<option value="pending" <?= ($c['upload_status'] ?? 'pending') == 'pending' ? 'selected' : '' ?>>Pending</option>
|
||||
<option value="uploaded" <?= ($c['upload_status'] ?? '') == 'uploaded' ? 'selected' : '' ?>>Uploaded</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<button type="submit" name="update_media_asset" class="btn btn-sm btn-primary">Opslaan</button>
|
||||
</td>
|
||||
</form>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user