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,
|
||||
* size: ?int,
|
||||
* pubDate: ?\DateTime,
|
||||
* duration: ?int,
|
||||
* duration: ?string,
|
||||
* action: ?EpisodeActionType
|
||||
* }
|
||||
*/
|
||||
@ -42,7 +42,7 @@ class EpisodeActionExtraData implements \JsonSerializable
|
||||
private ?string $type,
|
||||
private ?int $size,
|
||||
private ?\DateTime $pubDate,
|
||||
private ?int $duration,
|
||||
private ?string $duration,
|
||||
private ?EpisodeAction $action
|
||||
) {}
|
||||
|
||||
@ -94,7 +94,7 @@ class EpisodeActionExtraData implements \JsonSerializable
|
||||
return $this->pubDate;
|
||||
}
|
||||
|
||||
public function getDuration(): ?int {
|
||||
public function getDuration(): ?string {
|
||||
return $this->duration;
|
||||
}
|
||||
|
||||
|
@ -93,16 +93,11 @@ class EpisodeActionReader extends CoreEpisodeActionReader
|
||||
|
||||
// Get episode duration
|
||||
if ($iTunesItemChildren) {
|
||||
$rawDuration = $this->stringOrNull($iTunesItemChildren->duration);
|
||||
$duration = $this->stringOrNull($iTunesItemChildren->duration);
|
||||
} 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
|
||||
$rawPubDate = $this->stringOrNull($item->pubDate);
|
||||
$pubDate = $rawPubDate ? new \DateTime($rawPubDate) : null;
|
||||
|
@ -17,7 +17,7 @@
|
||||
:url="episode.image" />
|
||||
</template>
|
||||
<template #subname>
|
||||
{{ episode.duration > 0 ? formatTimer(new Date(episode.duration*1000)) : '' }}
|
||||
{{ episode.duration }}
|
||||
</template>
|
||||
<template #actions>
|
||||
<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 StopButton from 'vue-material-design-icons/Stop.vue'
|
||||
import axios from '@nextcloud/axios'
|
||||
import { formatTimer } from '../../utils/time.js'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
import moment from '@nextcloud/moment'
|
||||
import { showError } from '@nextcloud/dialogs'
|
||||
@ -102,7 +101,6 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatTimer,
|
||||
moment,
|
||||
hasEnded(episode) {
|
||||
return episode.action
|
||||
|
Loading…
Reference in New Issue
Block a user