[ExtremeDownloadBridge] Make URI and titles unique (#854)

- Entry URIs are unique to make sure RSS readers don't treat episodes as duplicates
- Titles are unique to make sure RSS readers don't treat streams and downloads as duplicates
This commit is contained in:
sysadminstory 2018-10-15 18:19:57 +02:00 committed by LogMANOriginal
parent 85e8a67568
commit 9a3c776096

View file

@ -32,16 +32,22 @@ class ExtremeDownloadBridge extends BridgeAbstract {
$filter = $this->getInput('filter');
$typesText = array(
'download' => 'Téléchargement',
'streaming' => 'Streaming'
);
// Get the TV show title
$this->showTitle = $html->find('span[id=news-title]', 0)->plaintext;
$this->showTitle = trim($html->find('span[id=news-title]', 0)->plaintext);
$list = $html->find('div[class=prez_7]');
foreach($list as $element) {
$add = false;
// Link type is needed is needed to generate an unique link
$type = $this->findLinkType($element);
if($filter == 'both') {
$add = true;
} else {
$type = $this->findLinkType($element);
if($type == $filter) {
$add = true;
}
@ -55,9 +61,11 @@ class ExtremeDownloadBridge extends BridgeAbstract {
// Get thee element links
$links = $element->next_sibling()->innertext;
$item['uri'] = self::URI . $this->getInput('url');
$item['content'] = $links;
$item['title'] = $this->showTitle . ' ' . $title;
$item['title'] = $this->showTitle . ' ' . $title . ' - ' . $typesText[$type];
// As RSS Bridge use the URI as GUID they need to be unique : adding a md5 hash of the title element
// should geneerate unique URI to prevent confusion for RSS readers
$item['uri'] = self::URI . $this->getInput('url') . '#' . hash('md5', $item['title']);
$this->items[] = $item;
}
@ -92,4 +100,5 @@ class ExtremeDownloadBridge extends BridgeAbstract {
return $return;
}
}