diff --git a/src/library/playlist/Playlist.vue b/src/library/playlist/Playlist.vue
index 7bf852e..ad7e18b 100644
--- a/src/library/playlist/Playlist.vue
+++ b/src/library/playlist/Playlist.vue
@@ -4,9 +4,6 @@
{{ playlist.name }}
-
- Public
-
Edit
@@ -17,16 +14,37 @@
-
+
+
+
+ {{ playlist.trackCount }} tracks
+
+
+ •
+ {{ formatDuration(playlist.duration) }}
+
+
+ •
+
+ Public
+
+
+
+
+
{{ playlist.comment }}
-
+
+
+
Play
Shuffle
-
+
+
+
@@ -62,6 +80,7 @@
import EditModal from '@/shared/components/EditModal.vue'
import { usePlaylistStore } from '@/library/playlist/store'
import SwitchInput from '@/shared/components/SwitchInput.vue'
+ import { formatDuration } from '@/shared/utils'
export default defineComponent({
components: {
@@ -73,7 +92,10 @@
id: { type: String, required: true }
},
setup() {
- return { playlistStore: usePlaylistStore() }
+ return {
+ playlistStore: usePlaylistStore(),
+ formatDuration,
+ }
},
data() {
return {
diff --git a/src/shared/api.ts b/src/shared/api.ts
index b8b75af..0297bad 100644
--- a/src/shared/api.ts
+++ b/src/shared/api.ts
@@ -1,5 +1,5 @@
import { AuthService } from '@/auth/service'
-import { map, max, orderBy, uniq, uniqBy } from 'lodash-es'
+import { map, max, orderBy, sumBy, uniq, uniqBy } from 'lodash-es'
import { toQueryString } from '@/shared/utils'
export type AlbumSort =
@@ -96,6 +96,7 @@ export interface Playlist {
isPublic: boolean
isReadOnly: boolean
trackCount: number
+ duration: number
createdAt: string
updatedAt: string
image?: string
@@ -262,6 +263,7 @@ export class API {
async getPlaylist(id: string): Promise {
if (id === 'random') {
const tracks = await this.getRandomSongs()
+ const duration = sumBy(tracks, 'duration')
return {
id,
name: 'Random',
@@ -270,6 +272,7 @@ export class API {
updatedAt: '',
tracks,
trackCount: tracks.length,
+ duration,
isPublic: false,
isReadOnly: true,
}
@@ -599,6 +602,7 @@ export class API {
createdAt: response.created || '',
updatedAt: response.changed || '',
trackCount: response.songCount,
+ duration: response.duration,
image: response.songCount > 0 ? this.getCoverArtUrl(response) : undefined,
isPublic: response.public,
isReadOnly: false,