2021-04-02 19:20:02 +02:00
|
|
|
|
<?php
|
|
|
|
|
|
2021-06-08 11:52:11 +02:00
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2021-04-02 19:20:02 +02:00
|
|
|
|
/**
|
2022-02-19 17:06:11 +01:00
|
|
|
|
* @copyright 2021 Ad Aures
|
2021-04-02 19:20:02 +02:00
|
|
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
|
|
|
|
* @link https://castopod.org/
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
namespace App\Libraries;
|
|
|
|
|
|
2021-07-12 20:40:22 +02:00
|
|
|
|
use App\Entities\Podcast;
|
2021-08-23 13:05:16 +02:00
|
|
|
|
use Modules\Fediverse\Objects\ActorObject;
|
2021-04-02 19:20:02 +02:00
|
|
|
|
|
2021-05-12 16:00:25 +02:00
|
|
|
|
class PodcastActor extends ActorObject
|
2021-04-02 19:20:02 +02:00
|
|
|
|
{
|
2021-07-12 20:40:22 +02:00
|
|
|
|
protected string $rssFeed;
|
2021-04-02 19:20:02 +02:00
|
|
|
|
|
2021-07-12 20:40:22 +02:00
|
|
|
|
protected string $language;
|
|
|
|
|
|
|
|
|
|
protected string $category;
|
|
|
|
|
|
|
|
|
|
protected string $episodes;
|
|
|
|
|
|
|
|
|
|
public function __construct(Podcast $podcast)
|
2021-04-02 19:20:02 +02:00
|
|
|
|
{
|
2021-07-12 20:40:22 +02:00
|
|
|
|
parent::__construct($podcast->actor);
|
|
|
|
|
|
|
|
|
|
$this->context[] = 'https://github.com/Podcastindex-org/activitypub-spec-work/blob/main/docs/1.0.md';
|
|
|
|
|
|
|
|
|
|
$this->type = 'Podcast';
|
|
|
|
|
|
|
|
|
|
$this->rssFeed = $podcast->feed_url;
|
|
|
|
|
|
|
|
|
|
$this->language = $podcast->language_code;
|
|
|
|
|
|
|
|
|
|
$category = '';
|
|
|
|
|
if ($podcast->category->parent_id !== null) {
|
2022-01-23 20:58:30 +01:00
|
|
|
|
$category .= $podcast->category->parent->apple_category . ' › ';
|
2021-07-12 20:40:22 +02:00
|
|
|
|
}
|
2022-03-04 15:33:48 +01:00
|
|
|
|
|
2021-07-12 20:40:22 +02:00
|
|
|
|
$category .= $podcast->category->apple_category;
|
2021-04-02 19:20:02 +02:00
|
|
|
|
|
2021-07-12 20:40:22 +02:00
|
|
|
|
$this->category = $category;
|
2021-04-02 19:20:02 +02:00
|
|
|
|
|
2022-03-04 15:33:48 +01:00
|
|
|
|
$this->episodes = url_to('podcast-episodes', esc($podcast->handle));
|
2021-04-02 19:20:02 +02:00
|
|
|
|
}
|
|
|
|
|
}
|