mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
calculate playlist duration
- use python's `sum()` method to add durations instead of for loop
This commit is contained in:
committed by
Mungai Geoffrey
parent
5bc0eaf8e6
commit
b318c0d324
@@ -27,7 +27,8 @@
|
||||
<span v-else-if="props.info.count == 1"
|
||||
>{{ props.info.count }} Track</span
|
||||
>
|
||||
<span v-else>{{ props.info.count }} Tracks</span> • 3 Hours
|
||||
<span v-else>{{ props.info.count }} Tracks</span> •
|
||||
{{ formatSeconds(props.info.duration, true) }}
|
||||
</div>
|
||||
<div class="desc">
|
||||
{{ props.info.description }}
|
||||
@@ -58,6 +59,7 @@ import useContextStore from "../../stores/context";
|
||||
import useModalStore from "../../stores/modal";
|
||||
import Option from "../shared/Option.vue";
|
||||
import PlayBtnRect from "../shared/PlayBtnRect.vue";
|
||||
import { formatSeconds } from "@/composables/perks";
|
||||
|
||||
const imguri = paths.images.playlist;
|
||||
const context = useContextStore();
|
||||
|
||||
@@ -37,9 +37,12 @@ function getElem(id: string, type: string) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts seconds into minutes and hours.
|
||||
* @param seconds The seconds to convert
|
||||
* @param long Whether to provide the time in the long format
|
||||
*/
|
||||
function formatSeconds(seconds: number, long?: boolean) {
|
||||
// check if there are arguments
|
||||
|
||||
const date = new Date(seconds * 1000);
|
||||
|
||||
const hh = date.getUTCHours();
|
||||
|
||||
@@ -64,6 +64,7 @@ export interface Playlist {
|
||||
count?: number;
|
||||
lastUpdated?: string;
|
||||
thumb?: string;
|
||||
duration?: number
|
||||
}
|
||||
|
||||
export interface Notif {
|
||||
|
||||
Reference in New Issue
Block a user