owncloud / music

:notes: Music app for ownCloud
GNU Affero General Public License v3.0
565 stars 197 forks source link

Allow importing of podcasts by .opml file [feature request] #904

Open MarkWieczorek opened 2 years ago

MarkWieczorek commented 2 years ago

The music app is great, but at present you can only add one podcast at a time to your music library by manually typing in the url of an RSS feed. For those of us with extensive podcast collections, it would be very useful to allow us to import (and export) an entire collection using an opml file.

paulijar commented 2 years ago

Thanks for the suggestion, sounds like a good idea although I'm not familiar with the opml files.

With the currently available features, the easiest way to import a large list of podcasts would be to use the occ command podcast-add. It can be used to import multiple channels with a single command using syntax like

php ./occ music:podcast-add your_user_name --rss=first_url --rss=second_url --rss=third_url
vasyugan commented 2 years ago

Thanks for the suggestion, sounds like a good idea although I'm not familiar with the opml files.

With the currently available features, the easiest way to import a large list of podcasts would be to use the occ command podcast-add. It can be used to import multiple channels with a single command using syntax like

php ./occ music:podcast-add your_user_name --rss=first_url --rss=second_url --rss=third_url

` Great that there is such a possibility! I guess one has to understand how to properly extract URLs from an exported OPML in order to use this command for batch adding.

However, OPML is`the standard for interoperability between podcatcher and newsreader apps, so this is definitely a must.

Areopagitics commented 1 month ago

I have not looked into this PHP app yet, but would this be somewhere to start?

https://packagist.org/packages/celd/opml-import-export

Import OPML file:

<?php
use Celd\Opml\Importer;
$importer = new Importer(file_get_contents('http://opml-url'));
$feedList = $importer->getFeedList();
foreach ($feedList->getItems() as $item) {
  if ($item->getType() == 'category') {
    echo $item->getTitle(); // Category title
    foreach($item->getFeeds() as $feed) {
      echo $feed->getTitle() . "\n";
    }
  }
  echo $item->getTitle(); //Root feed title
}

// Properties of Model/Feed are:
// title, xmlUrl, htmlUrl, type (rss/atom/etc)

Exporting OPML file

<?php
use Celd\Opml\Importer;
use Celd\Opml\Model\FeedList;
use Celd\Opml\Model\Feeed;

$feedList = new FeedList();

$feed = new Feed();
$feed->setTitle('Feed title');
$feed->setXmlUrl('http://rss-feed-url');
$feed->setType('rss');
$feed->setHtmlUrl('http://html-url');

$feedList->addItem($feed);

$importer = new Importer();
echo $importer->export($feedList);