Skip to content

Commit

Permalink
Fixed Issue #6 – duration in xml is filesize
Browse files Browse the repository at this point in the history
  • Loading branch information
Noël Bossart committed Apr 1, 2013
1 parent bc07b2f commit 2eba851
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 81 deletions.
14 changes: 8 additions & 6 deletions Classes/Domain/Model/Episode.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ private function getFileDuration($file) {
* @return string $altfiles
*/
public function getAltfiles() {
if(!$this->altfiles){
if(!$this->altfiles || count(explode('|',$this->altfiles)) < 3){
$this->setAltfiles();
}

Expand All @@ -412,6 +412,7 @@ public function getAltfiles() {
$file = explode(',',$all[$i]);
$altfiles[$i]['name'] = $file[0];
$altfiles[$i]['mime'] = $file[1];
$altfiles[$i]['size'] = $file[2];
}

return $altfiles;
Expand All @@ -423,21 +424,22 @@ public function getAltfiles() {
* @return void
*/
public function setAltfiles() {
$fileInfo = t3lib_div::split_fileref($this->getFile());
$file = $this->getFile();
$fileInfo = t3lib_div::split_fileref($file);

/* get mime and duration from provided file */
$this->setMime($this->getFileMime($this->getFile()));
$this->setDuration($this->getFileDuration($this->getFile()));
$this->setMime($this->getFileMime($file));
$this->setDuration($this->getFileDuration($file));

$altfiles = array();
$altfiles[0] = $this->getFile().','.$this->getMime();
$altfiles[0] = $this->getFile().','.$this->getMime().','.filesize($file);

$basepath = $fileInfo['path'].$fileInfo['filebody'].'.*';
$files = glob($basepath);
/* search for other files */
for ($i=0; $i < count($files); $i++) {
if($files[$i] != $this->getFile()){
$altfiles[$i+1] =$files[$i].','.$this->getFileMime($files[$i]);
$altfiles[$i+1] =$files[$i].','.$this->getFileMime($files[$i]).','.filesize($file[$i]);
}
}
$this->altfiles = implode('|',$altfiles);
Expand Down
73 changes: 0 additions & 73 deletions Classes/ViewHelpers/EpisodeViewHelper.php

This file was deleted.

4 changes: 2 additions & 2 deletions Resources/Private/Partials/Episode.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{namespace pc=Tx_Podcast_ViewHelpers}
{namespace pc=Tx_Podcast_ViewHelpers}
<f:if condition="{episode.file}">
<item>
<title><f:format.html parseFuncTSPath="plugin.tx_podcast.feedparser">{episode.title}</f:format.html></title>
Expand Down Expand Up @@ -26,7 +26,7 @@
<keywords><f:format.html parseFuncTSPath="plugin.tx_podcast.feedparser">{episode.keywords}</f:format.html></keywords>
</f:else>
</f:if>
<enclosure url="{episode.fileurl}" length="{pc:duration(timestamp: episode.duration)}" type="{episode.mime}" />
<enclosure url="{episode.fileurl}" length="{episode.altfiles.0.size}" type="{episode.mime}" />
<guid>{episode.fileurl}</guid>
<pubDate><f:format.date date="{episode.publicationDate}" format="{settings.episode.publicationDate}" /></pubDate>
<f:if condition="{episode.website.link}">
Expand Down
3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ The update to 0.5 introduces new URL's and a new plugin configuration. In order
* Update the information in your iTunes Account to refflect the new feed URL

#Changelog
* 0.5.3
* Fixed Issue #6 – duration in xml is filesize

* 0.5.2
* Fixed Issue #18 – HTML errors and removed automatic preload of video and audio files
* Fixed dimensions of poster-image
Expand Down

0 comments on commit 2eba851

Please sign in to comment.