mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-08 16:08:54 +00:00
[AutoPodcaster] add feed_only
This commit is contained in:
parent
29d25ad666
commit
5da4de3d5a
@ -5,11 +5,17 @@ class AutoPodcasterBridge extends FeedExpander {
|
|||||||
const URI = '';
|
const URI = '';
|
||||||
const CACHE_TIMEOUT = 300; // 5 minuti
|
const CACHE_TIMEOUT = 300; // 5 minuti
|
||||||
const DESCRIPTION='Make a "multimedia" podcast out of a normal feed';
|
const DESCRIPTION='Make a "multimedia" podcast out of a normal feed';
|
||||||
const PARAMETERS = array('url' => array(
|
const PARAMETERS = array(array(
|
||||||
'url' => array(
|
'url' => [
|
||||||
'name' => 'URL',
|
'name' => 'URL',
|
||||||
'required' => true
|
'required' => true
|
||||||
)));
|
],
|
||||||
|
'feed_only' => [
|
||||||
|
'name' => 'Only look at the content of the feed, don\'t check on the website',
|
||||||
|
'type' => 'checkbox',
|
||||||
|
'required' => false,
|
||||||
|
]
|
||||||
|
));
|
||||||
|
|
||||||
private function archiveIsAudioFormat($formatString) {
|
private function archiveIsAudioFormat($formatString) {
|
||||||
return strpos($formatString, 'MP3') !== false ||
|
return strpos($formatString, 'MP3') !== false ||
|
||||||
@ -63,7 +69,12 @@ class AutoPodcasterBridge extends FeedExpander {
|
|||||||
protected function parseItem($newItem){
|
protected function parseItem($newItem){
|
||||||
$item = parent::parseItem($newItem);
|
$item = parent::parseItem($newItem);
|
||||||
|
|
||||||
$dom = getSimpleHTMLDOMCached($item['uri']);
|
if(! $this->getInput('feed_only')) {
|
||||||
|
$dom = getSimpleHTMLDOMCached($item['uri']);
|
||||||
|
// $dom will be false in case of errors
|
||||||
|
} else {
|
||||||
|
$dom = false;
|
||||||
|
}
|
||||||
$audios = [];
|
$audios = [];
|
||||||
if ($dom !== false) {
|
if ($dom !== false) {
|
||||||
/* 1st extraction method: by "audio" tag */
|
/* 1st extraction method: by "audio" tag */
|
||||||
@ -73,12 +84,13 @@ class AutoPodcasterBridge extends FeedExpander {
|
|||||||
$audios = array_merge($audios, $this->extractIframeArchive($dom));
|
$audios = array_merge($audios, $this->extractIframeArchive($dom));
|
||||||
}
|
}
|
||||||
elseif($item['content'] !== NULL) {
|
elseif($item['content'] !== NULL) {
|
||||||
|
$item_dom = str_get_html($item['content']);
|
||||||
/* 1st extraction method: by "audio" tag */
|
/* 1st extraction method: by "audio" tag */
|
||||||
$audios = array_merge($audios, $this->extractAudio(str_get_html($item['content'])));
|
$audios = array_merge($audios, $this->extractAudio($item_dom));
|
||||||
|
|
||||||
/* 2nd extraction method: by "iframe" tag */
|
/* 2nd extraction method: by "iframe" tag */
|
||||||
$audios = array_merge($audios,
|
$audios = array_merge($audios,
|
||||||
$this->extractIframeArchive(str_get_html($item['content'])));
|
$this->extractIframeArchive($item_dom));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($audios) === 0) {
|
if(count($audios) === 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user