Commit 630e788f authored by Guy Martin (Dwev)'s avatar Guy Martin (Dwev) 🇩🇰 Committed by Yassine Doghri
Browse files

feat: add support for podcasting 2.0 "medium" tag with podcast, music and audiobook

closes #439
parent bc4f93d2
Loading
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
<?php

declare(strict_types=1);

/**
 * Class AddPodcastsMediumField adds medium field to podcast table in database
 *
 * @copyright  2020 Ad Aures
 * @license    https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
 * @link       https://castopod.org/
 */

namespace App\Database\Migrations;

class AddPodcastsMediumField extends BaseMigration
{
    public function up(): void
    {
        $fields = [
            'medium' => [
                'type'    => "ENUM('podcast','music','audiobook')",
                'null'    => false,
                'default' => 'podcast',
                'after'   => 'type',
            ],
        ];

        $this->forge->addColumn('podcasts', $fields);
    }

    public function down(): void
    {
        $fields = ['medium'];
        $this->forge->dropColumn('podcasts', $fields);
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ use RuntimeException;
 * @property string $owner_email
 * @property bool $is_owner_email_removed_from_feed
 * @property string $type
 * @property string $medium
 * @property string|null $copyright
 * @property string|null $episode_description_footer_markdown
 * @property string|null $episode_description_footer_html
@@ -196,6 +197,7 @@ class Podcast extends Entity
        'owner_email'                         => 'string',
        'is_owner_email_removed_from_feed'    => 'boolean',
        'type'                                => 'string',
        'medium'                              => 'string',
        'copyright'                           => '?string',
        'episode_description_footer_markdown' => '?string',
        'episode_description_footer_html'     => '?string',
+2 −0
Original line number Diff line number Diff line
@@ -74,6 +74,8 @@ if (! function_exists('get_rss_feed')) {
        $channel->addChild('title', $podcast->title, null, false);
        $channel->addChildWithCDATA('description', $podcast->description_html);

        $channel->addChild('medium', $podcast->medium, $podcastNamespace);

        $itunesImage = $channel->addChild('image', null, $itunesNamespace);

        $itunesImage->addAttribute('href', $podcast->cover->feed_url);
+1 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ class PodcastModel extends Model
        'is_owner_email_removed_from_feed',
        'publisher',
        'type',
        'medium',
        'copyright',
        'imported_feed_url',
        'new_feed_url',
+2 −0
Original line number Diff line number Diff line
@@ -219,6 +219,7 @@ class PodcastController extends BaseController
            'is_owner_email_removed_from_feed' => $this->request->getPost('is_owner_email_removed_from_feed') === 'yes',
            'publisher'                        => $this->request->getPost('publisher'),
            'type'                             => $this->request->getPost('type'),
            'medium'                           => $this->request->getPost('medium'),
            'copyright'                        => $this->request->getPost('copyright'),
            'location'                         => $this->request->getPost('location_name') === '' ? null : new Location(
                $this->request->getPost('location_name')
@@ -314,6 +315,7 @@ class PodcastController extends BaseController
        $this->podcast->owner_name = $this->request->getPost('owner_name');
        $this->podcast->owner_email = $this->request->getPost('owner_email');
        $this->podcast->type = $this->request->getPost('type');
        $this->podcast->medium = $this->request->getPost('medium');
        $this->podcast->copyright = $this->request->getPost('copyright');
        $this->podcast->location = $this->request->getPost('location_name') === '' ? null : new Location(
            $this->request->getPost('location_name')
Loading