fix: duration wrongly displayed
This commit is contained in:
parent
c399a20de3
commit
2d6f2cb5e7
@ -24,7 +24,7 @@ use OCA\GPodderSync\Core\EpisodeAction\EpisodeAction;
|
|||||||
* type: ?string,
|
* type: ?string,
|
||||||
* size: ?int,
|
* size: ?int,
|
||||||
* pubDate: ?\DateTime,
|
* pubDate: ?\DateTime,
|
||||||
* duration: ?int,
|
* duration: ?string,
|
||||||
* action: ?EpisodeActionType
|
* action: ?EpisodeActionType
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
@ -42,7 +42,7 @@ class EpisodeActionExtraData implements \JsonSerializable
|
|||||||
private ?string $type,
|
private ?string $type,
|
||||||
private ?int $size,
|
private ?int $size,
|
||||||
private ?\DateTime $pubDate,
|
private ?\DateTime $pubDate,
|
||||||
private ?int $duration,
|
private ?string $duration,
|
||||||
private ?EpisodeAction $action
|
private ?EpisodeAction $action
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ class EpisodeActionExtraData implements \JsonSerializable
|
|||||||
return $this->pubDate;
|
return $this->pubDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDuration(): ?int {
|
public function getDuration(): ?string {
|
||||||
return $this->duration;
|
return $this->duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,16 +93,11 @@ class EpisodeActionReader extends CoreEpisodeActionReader
|
|||||||
|
|
||||||
// Get episode duration
|
// Get episode duration
|
||||||
if ($iTunesItemChildren) {
|
if ($iTunesItemChildren) {
|
||||||
$rawDuration = $this->stringOrNull($iTunesItemChildren->duration);
|
$duration = $this->stringOrNull($iTunesItemChildren->duration);
|
||||||
} else {
|
} else {
|
||||||
$rawDuration = $this->stringOrNull($item->duration);
|
$duration = $this->stringOrNull($item->duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
$splitDuration = array_reverse(explode(':', $rawDuration ?? ''));
|
|
||||||
$duration = (int) $splitDuration[0];
|
|
||||||
$duration += !empty($splitDuration[1]) ? (int) $splitDuration[1] * 60 : 0;
|
|
||||||
$duration += !empty($splitDuration[2]) ? (int) $splitDuration[2] * 60 : 0;
|
|
||||||
|
|
||||||
// Get episode pubDate
|
// Get episode pubDate
|
||||||
$rawPubDate = $this->stringOrNull($item->pubDate);
|
$rawPubDate = $this->stringOrNull($item->pubDate);
|
||||||
$pubDate = $rawPubDate ? new \DateTime($rawPubDate) : null;
|
$pubDate = $rawPubDate ? new \DateTime($rawPubDate) : null;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
:url="episode.image" />
|
:url="episode.image" />
|
||||||
</template>
|
</template>
|
||||||
<template #subname>
|
<template #subname>
|
||||||
{{ episode.duration > 0 ? formatTimer(new Date(episode.duration*1000)) : '' }}
|
{{ episode.duration }}
|
||||||
</template>
|
</template>
|
||||||
<template #actions>
|
<template #actions>
|
||||||
<NcActionButton v-if="!isCurrentEpisode(episode)" @click="load(episode)">
|
<NcActionButton v-if="!isCurrentEpisode(episode)" @click="load(episode)">
|
||||||
@ -56,7 +56,6 @@ import Modal from './Modal.vue'
|
|||||||
import PlayButton from 'vue-material-design-icons/Play.vue'
|
import PlayButton from 'vue-material-design-icons/Play.vue'
|
||||||
import StopButton from 'vue-material-design-icons/Stop.vue'
|
import StopButton from 'vue-material-design-icons/Stop.vue'
|
||||||
import axios from '@nextcloud/axios'
|
import axios from '@nextcloud/axios'
|
||||||
import { formatTimer } from '../../utils/time.js'
|
|
||||||
import { generateUrl } from '@nextcloud/router'
|
import { generateUrl } from '@nextcloud/router'
|
||||||
import moment from '@nextcloud/moment'
|
import moment from '@nextcloud/moment'
|
||||||
import { showError } from '@nextcloud/dialogs'
|
import { showError } from '@nextcloud/dialogs'
|
||||||
@ -102,7 +101,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
formatTimer,
|
|
||||||
moment,
|
moment,
|
||||||
hasEnded(episode) {
|
hasEnded(episode) {
|
||||||
return episode.action
|
return episode.action
|
||||||
|
Loading…
Reference in New Issue
Block a user