[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:
parent
85e8a67568
commit
9a3c776096
1 changed files with 14 additions and 5 deletions
|
@ -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;
|
||||
}
|
||||
|
@ -67,7 +75,7 @@ class ExtremeDownloadBridge extends BridgeAbstract {
|
|||
public function getName(){
|
||||
switch($this->queriedContext) {
|
||||
case 'Suivre la publication des épisodes d\'une série en cours de diffusion':
|
||||
return $this->showTitle . ' - ' . self::NAME;
|
||||
return $this->showTitle . ' - ' . self::NAME;
|
||||
break;
|
||||
default:
|
||||
return self::NAME;
|
||||
|
@ -92,4 +100,5 @@ class ExtremeDownloadBridge extends BridgeAbstract {
|
|||
|
||||
return $return;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue