mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-09 16:38:50 +00:00
[RoosterTeethBridge] Add episode description, optional episode image (#3080)
This commit is contained in:
parent
30d964b356
commit
6b83bf25fd
@ -51,6 +51,12 @@ class RoosterTeethBridge extends BridgeAbstract
|
|||||||
'False' => false
|
'False' => false
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
'episodeImage' => [
|
||||||
|
'name' => 'Episode Image',
|
||||||
|
'type' => 'checkbox',
|
||||||
|
'defaultValue' => 'checked',
|
||||||
|
'title' => 'Select whether to include an episode image (if available)',
|
||||||
|
],
|
||||||
'limit' => [
|
'limit' => [
|
||||||
'name' => 'Limit',
|
'name' => 'Limit',
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
@ -104,8 +110,38 @@ class RoosterTeethBridge extends BridgeAbstract
|
|||||||
$item['title'] = $value['attributes']['title'];
|
$item['title'] = $value['attributes']['title'];
|
||||||
$item['timestamp'] = $value['attributes']['member_golive_at'];
|
$item['timestamp'] = $value['attributes']['member_golive_at'];
|
||||||
$item['author'] = $value['attributes']['show_title'];
|
$item['author'] = $value['attributes']['show_title'];
|
||||||
|
$item['content'] = $this->getItemContent($value);
|
||||||
|
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getItemContent(array $value): string
|
||||||
|
{
|
||||||
|
$content = nl2br($value['attributes']['description']);
|
||||||
|
|
||||||
|
if (isset($value['attributes']['length'])) {
|
||||||
|
$duration_format = $value['attributes']['length'] > 3600 ? 'G:i:s' : 'i:s';
|
||||||
|
$content = sprintf(
|
||||||
|
'Duration: %s<br><br>%s',
|
||||||
|
gmdate($duration_format, $value['attributes']['length']),
|
||||||
|
$content
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->getInput('episodeImage') === true) {
|
||||||
|
foreach ($value['included']['images'] ?? [] as $image) {
|
||||||
|
if ($image['type'] == 'episode_image') {
|
||||||
|
$content = sprintf(
|
||||||
|
'<img src="%s"/><br><br>%s',
|
||||||
|
$image['attributes']['medium'],
|
||||||
|
$content,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user