feat: add platforms tables

This commit is contained in:
Benjamin Bellamy 2020-06-08 16:25:23 +02:00 committed by Yassine Doghri
parent 97cd94b474
commit ce5934419a
3 changed files with 218 additions and 0 deletions

View File

@ -0,0 +1,99 @@
<?php
/**
* Class AddPlatforms
* Creates platforms table in database
* @author Benjamin Bellamy <ben@podlibre.org>
* @copyright 2020 Podlibre
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
namespace App\Database\Migrations;
use \CodeIgniter\Database\Migration;
class AddPlatforms extends Migration
{
public function up()
{
$this->forge->addField([
'id' => [
'type' => 'BIGINT',
'constraint' => 20,
'unsigned' => true,
'auto_increment' => true,
'comment' => 'The platform ID',
],
'name' => [
'type' => 'VARCHAR',
'constraint' => 191,
'unique' => true,
'comment' => 'Platform name.',
],
'home_url' => [
'type' => 'VARCHAR',
'constraint' => 191,
'comment' => 'Platform home URL.',
],
'submit_url' => [
'type' => 'VARCHAR',
'constraint' => 191,
'comment' => 'Platform URL to submit podcasts.',
'null' => true,
],
'iosapp_url' => [
'type' => 'VARCHAR',
'constraint' => 191,
'comment' => 'Platform iOS app URL (if any).',
'null' => true,
],
'androidapp_url' => [
'type' => 'VARCHAR',
'constraint' => 191,
'comment' => 'Platform Android app URL (if any).',
'null' => true,
],
'comment' => [
'type' => 'TEXT',
'comment' => 'Comment.',
'null' => true,
],
'display_by_default' => [
'type' => 'TINYINT',
'constraint' => 1,
'default' => 0,
'comment' => 'True if the platform link should be displayed by default.',
],
'ios_deeplink' => [
'type' => 'TINYINT',
'constraint' => 1,
'default' => 0,
'comment' => 'iOS deeplinking for this platform.',
],
'android_deeplink' => [
'type' => 'TINYINT',
'constraint' => 1,
'default' => 0,
'comment' => 'Android deeplinking for this platform: 0=No, 1=Manual, 2=Automatic.',
],
'logo_file_name' => [
'type' => 'VARCHAR',
'constraint' => 1024,
'comment' => 'The logo for this platform.',
],
'created_at' => [
'type' => 'TIMESTAMP',
],
'updated_at' => [
'type' => 'TIMESTAMP',
],
]);
$this->forge->addKey('id', true);
$this->forge->createTable('platforms');
}
public function down()
{
$this->forge->dropTable('platforms');
}
}

View File

@ -0,0 +1,72 @@
<?php
/**
* Class AddPlatformsLinks
* Creates platformlinks table in database
* @author Benjamin Bellamy <ben@podlibre.org>
* @copyright 2020 Podlibre
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
namespace App\Database\Migrations;
use \CodeIgniter\Database\Migration;
class AddPlatformLinks extends Migration
{
public function up()
{
$this->forge->addField([
'id' => [
'type' => 'BIGINT',
'constraint' => 20,
'unsigned' => true,
'auto_increment' => true,
'comment' => 'The link ID',
],
'podcast_id' => [
'type' => 'BIGINT',
'constraint' => 20,
'unsigned' => true,
'comment' => 'The podcast ID',
],
'platform_id' => [
'type' => 'BIGINT',
'constraint' => 20,
'unsigned' => true,
'comment' => 'The platform ID',
],
'link_url' => [
'type' => 'VARCHAR',
'constraint' => 191,
'comment' => 'Podcast link URL on this platform.',
],
'comment' => [
'type' => 'TEXT',
'comment' => 'Comment.',
'null' => true,
],
'visible' => [
'type' => 'TINYINT',
'constraint' => 1,
'default' => 0,
'comment' => 'Show this link.',
],
'created_at' => [
'type' => 'TIMESTAMP',
],
'updated_at' => [
'type' => 'TIMESTAMP',
],
]);
$this->forge->addKey('id', true);
$this->forge->addForeignKey('podcast_id', 'podcasts', 'id');
$this->forge->addForeignKey('platform_id', 'platforms', 'id');
$this->forge->createTable('platform_links');
}
public function down()
{
$this->forge->dropTable('platform_links');
}
}

View File

@ -0,0 +1,47 @@
<?php
/**
* Class PlatformsSeeder
* Insert values in platforms table in database
* @author Benjamin Bellamy <ben@podlibre.org>
* @copyright 2020 Podlibre
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
namespace App\Database\Seeds;
use CodeIgniter\Database\Seeder;
class PlatformSeeder extends Seeder
{
public function run()
{
$data = array(
array('name' => 'Apple Podcasts', 'home_url' => 'https://www.apple.com/itunes/podcasts/', 'submit_url' => 'https://podcastsconnect.apple.com/my-podcasts/new-feed', 'iosapp_url' => 'https://apps.apple.com/app/apple-podcasts/id525463029', 'androidapp_url' => '', 'comment' => '', 'display_by_default' => 1, 'ios_deeplink' => 0, 'android_deeplink' => 0, 'logo_file_name' => 'ApplePodcasts.png'),
array('name' => 'Blubrry', 'home_url' => 'https://www.blubrry.com/', 'submit_url' => 'https://www.blubrry.com/addpodcast.php', 'iosapp_url' => '', 'androidapp_url' => '', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 0, 'logo_file_name' => 'blubrry.png'),
array('name' => 'Castbox', 'home_url' => 'https://castbox.fm/', 'submit_url' => 'https://helpcenter.castbox.fm/portal/kb/articles/submit-my-podcast', 'iosapp_url' => 'https://apps.apple.com/app/castbox-the-podcast-app/id1243410543', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=fm.castbox.audiobook.radio.podcast&hl=fr', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 2, 'logo_file_name' => 'Castbox.png'),
array('name' => 'Castro', 'home_url' => 'http://castro.fm/', 'submit_url' => '', 'iosapp_url' => 'https://apps.apple.com/app/apple-store/id1080840241?ign-mpt=uo%3D4', 'androidapp_url' => '', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 0, 'logo_file_name' => 'Castro.png'),
array('name' => 'Chartable', 'home_url' => 'https://chartable.com/', 'submit_url' => 'https://chartable.com/podcasts/submit', 'iosapp_url' => '', 'androidapp_url' => '', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 0, 'logo_file_name' => 'Chartable.png'),
array('name' => 'Deezer', 'home_url' => 'https://www.deezer.com/', 'submit_url' => 'https://podcasters.deezer.com/submission', 'iosapp_url' => 'https://apps.apple.com/app/deezer-music-podcast-player/id292738169', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=deezer.android.app', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 2, 'logo_file_name' => 'Deezer.png'),
array('name' => 'Google Podcasts', 'home_url' => 'https://podcasts.google.com/about', 'submit_url' => 'https://search.google.com/search-console/about', 'iosapp_url' => '', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=com.google.android.apps.podcasts', 'comment' => '', 'display_by_default' => 1, 'ios_deeplink' => 0, 'android_deeplink' => 1, 'logo_file_name' => 'GooglePodcasts.png'),
array('name' => 'Ivoox', 'home_url' => 'https://www.ivoox.com/', 'submit_url' => '', 'iosapp_url' => 'https://apps.apple.com/app/apple-store/id542673545', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=com.ivoox.app', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 0, 'logo_file_name' => 'ivoox.png'),
array('name' => 'ListenNotes', 'home_url' => 'https://www.listennotes.com/', 'submit_url' => 'https://www.listennotes.com/submit/', 'iosapp_url' => '', 'androidapp_url' => '', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 0, 'logo_file_name' => 'ListenNotes.png'),
//array('name' => 'Majelan', 'home_url' => 'https://www.majelan.com/', 'submit_url' => 'https://support.majelan.com/article/64-how-to-add-my-podcast-on-majelan', 'iosapp_url' => 'https://apps.apple.com/app/majelan-best-audio-stories/id1443711081', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=com.majelanapp', 'comment' => 'Uses public podcasts indexes. Send a DM if you are not listed.', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 2, 'logo_file_name' => 'Majelan.png'), // https://aide.majelan.com/article/130-pourquoi-nouvelle-application-7-juillet
array('name' => 'Mytuner', 'home_url' => 'https://mytuner-radio.com/', 'submit_url' => 'https://mytuner-radio.com/broadcasters/', 'iosapp_url' => 'https://apps.apple.com/app/apple-store/id520502858', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=com.appgeneration.itunerfree', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 1, 'logo_file_name' => 'myTuner.png'),
array('name' => 'Overcast', 'home_url' => 'https://overcast.fm/', 'submit_url' => 'https://overcast.fm/podcasterinfo', 'iosapp_url' => 'https://apps.apple.com/us/app/overcast-podcast-player/id888422857', 'androidapp_url' => '', 'comment' => 'Overcast uses Apple Podcasts index, no podcast submission needed.', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 1, 'logo_file_name' => 'Overcast.png'),
array('name' => 'Player.Fm', 'home_url' => 'https://player.fm/', 'submit_url' => 'https://player.fm/importer/feed', 'iosapp_url' => 'https://apps.apple.com/app/podcast-app-by-player-fm/id940568467', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=fm.player', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 1, 'logo_file_name' => 'PlayerFM.png'),
array('name' => 'Pocketcasts', 'home_url' => 'https://www.pocketcasts.com/', 'submit_url' => 'https://www.pocketcasts.com/submit/', 'iosapp_url' => 'https://apps.apple.com/app/pocket-casts/id414834813', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=au.com.shiftyjelly.pocketcasts', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 0, 'logo_file_name' => 'PocketCasts.png'),
array('name' => 'Podbean', 'home_url' => 'https://www.podbean.com/', 'submit_url' => 'https://www.podbean.com/site/submitPodcast', 'iosapp_url' => 'https://apps.apple.com/app/apple-store/id973361050', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=com.podbean.app.podcast', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 2, 'logo_file_name' => 'Podbean.png'),
array('name' => 'Podcastland', 'home_url' => 'https://podcastland.com/', 'submit_url' => '', 'iosapp_url' => '', 'androidapp_url' => '', 'comment' => 'Uses Apple Podcasts index.', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 0, 'logo_file_name' => 'PodcastLand.png'),
array('name' => 'Podcastrepublic', 'home_url' => 'https://www.podcastrepublic.net/', 'submit_url' => 'https://www.podcastrepublic.net/for-podcast-publisher', 'iosapp_url' => '', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=com.itunestoppodcastplayer.app', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 1, 'logo_file_name' => 'PodcastRepublic.png'),
array('name' => 'Podchaser', 'home_url' => 'https://www.podchaser.com/', 'submit_url' => 'https://www.podchaser.com/creators/edit', 'iosapp_url' => '', 'androidapp_url' => '', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 0, 'logo_file_name' => 'Podchaser.png'),
array('name' => 'Podtail', 'home_url' => 'https://podtail.com/', 'submit_url' => 'https://podtail.com/about/faq/', 'iosapp_url' => '', 'androidapp_url' => '', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 0, 'logo_file_name' => 'Podtail.png'),
array('name' => 'Radiopublic', 'home_url' => 'https://radiopublic.com/', 'submit_url' => 'https://podcasters.radiopublic.com/signup', 'iosapp_url' => 'https://apps.apple.com/app/radiopublic-free-podcasts/id1113752736', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=com.radiopublic.android', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 1, 'logo_file_name' => 'RadioPublic.png'),
array('name' => 'Spotify', 'home_url' => 'https://www.spotify.com/', 'submit_url' => 'https://podcasters.spotify.com/submit', 'iosapp_url' => 'https://apps.apple.com/app/spotify-music/id324684580', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=com.spotify.music', 'comment' => '', 'display_by_default' => 1, 'ios_deeplink' => 0, 'android_deeplink' => 2, 'logo_file_name' => 'Spotify.png'),
array('name' => 'Spreaker', 'home_url' => 'https://www.spreaker.com/', 'submit_url' => 'https://www.spreaker.com/cms/shows/rss-import', 'iosapp_url' => 'https://apps.apple.com/app/spreaker-podcast-radio/id388449677', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=com.spreaker.android', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 1, 'logo_file_name' => 'Spreaker.png'),
array('name' => 'Stitcher', 'home_url' => 'https://www.stitcher.com/', 'submit_url' => 'https://www.stitcher.com/content-providers', 'iosapp_url' => 'https://apps.apple.com/app/id288087905', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=com.stitcher.app', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 1, 'logo_file_name' => 'Stitcher.png'),
array('name' => 'TuneIn', 'home_url' => 'https://tunein.com/', 'submit_url' => 'https://help.tunein.com/contact/add-podcast-S19TR3Sdf', 'iosapp_url' => 'https://apps.apple.com/app/tunein-radio/id418987775', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=tunein.player', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 2, 'logo_file_name' => 'TuneIn.png'),
);
$this->db->table('platforms')->insertBatch($data);
}
}