split albums on discNumber
This commit is contained in:
parent
47fac6431b
commit
960abb77a7
2 changed files with 67 additions and 5 deletions
|
@ -147,11 +147,24 @@
|
||||||
<div style="width:100%">
|
<div style="width:100%">
|
||||||
<draggable :sort="data.attributes.canEdit && data.type == 'library-playlists'"
|
<draggable :sort="data.attributes.canEdit && data.type == 'library-playlists'"
|
||||||
v-model="data.relationships.tracks.data" @start="drag=true" @end="drag=false;put()">
|
v-model="data.relationships.tracks.data" @start="drag=true" @end="drag=false;put()">
|
||||||
|
<template v-if="nestedPlaylist == [] || nestedPlaylist.length <= 1">
|
||||||
<mediaitem-list-item :item="item" :parent="getItemParent(data)" :index="index"
|
<mediaitem-list-item :item="item" :parent="getItemParent(data)" :index="index"
|
||||||
:showIndex="true"
|
:showIndex="true"
|
||||||
:showIndexPlaylist="(data.attributes.playParams.kind ?? data.type ?? '').includes('playlist')"
|
:showIndexPlaylist="(data.attributes.playParams.kind ?? data.type ?? '').includes('playlist')"
|
||||||
:context-ext="buildContextMenu()"
|
:context-ext="buildContextMenu()"
|
||||||
v-for="(item,index) in data.relationships.tracks.data"></mediaitem-list-item>
|
v-for="(item,index) in data.relationships.tracks.data"></mediaitem-list-item>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<div v-for="disc in nestedPlaylist">
|
||||||
|
<div class="playlist-time">Disc {{disc.disc}}</div>
|
||||||
|
<mediaitem-list-item :item="item" :parent="getItemParent(data)" :index="index"
|
||||||
|
:showIndex="true"
|
||||||
|
:showIndexPlaylist="(data.attributes.playParams.kind ?? data.type ?? '').includes('playlist')"
|
||||||
|
:context-ext="buildContextMenu()"
|
||||||
|
v-for="(item,index) in disc.tracks"></mediaitem-list-item>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</template>
|
||||||
</draggable>
|
</draggable>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -224,6 +237,7 @@
|
||||||
badgesRequested: false,
|
badgesRequested: false,
|
||||||
headerVisible: true,
|
headerVisible: true,
|
||||||
useArtistChip: false,
|
useArtistChip: false,
|
||||||
|
nestedPlaylist: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
|
@ -233,11 +247,28 @@
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
data: function () {
|
data: function () {
|
||||||
|
this.nestedPlaylist = [];
|
||||||
this.isInLibrary()
|
this.isInLibrary()
|
||||||
this.getBadges()
|
this.getBadges()
|
||||||
|
this.generateNestedPlaylist()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
generateNestedPlaylist(){
|
||||||
|
this.nestedPlaylist = [];
|
||||||
|
if (this.data?.type?.includes("album")){
|
||||||
|
console.log(this.data.relationships.tracks.data)
|
||||||
|
let songlists = this.data.relationships.tracks.data;
|
||||||
|
let discs = songlists.map(x => {return x.attributes.discNumber}).filter((item, i, ar) => ar.indexOf(item) === i);
|
||||||
|
if (discs && discs.length > 1){
|
||||||
|
for (disc of discs){
|
||||||
|
let songs = songlists.filter(x => x.attributes.discNumber == disc);
|
||||||
|
this.nestedPlaylist.push({disc: disc, tracks: songs})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(this.nestedPlaylist)
|
||||||
|
|
||||||
|
}},
|
||||||
isHeaderVisible(visible) {
|
isHeaderVisible(visible) {
|
||||||
this.headerVisible = visible
|
this.headerVisible = visible
|
||||||
},
|
},
|
||||||
|
|
|
@ -157,11 +157,24 @@
|
||||||
<draggable :sort="data.attributes.canEdit && data.type == 'library-playlists'"
|
<draggable :sort="data.attributes.canEdit && data.type == 'library-playlists'"
|
||||||
v-model="data.relationships.tracks.data" @start="drag=true"
|
v-model="data.relationships.tracks.data" @start="drag=true"
|
||||||
@end="drag=false;put()">
|
@end="drag=false;put()">
|
||||||
|
<template v-if="nestedPlaylist == [] || nestedPlaylist.length <= 1">
|
||||||
<mediaitem-list-item :item="item" :parent="getItemParent(data)" :index="index"
|
<mediaitem-list-item :item="item" :parent="getItemParent(data)" :index="index"
|
||||||
:showIndex="true"
|
:showIndex="true"
|
||||||
:showIndexPlaylist="(data.attributes.playParams.kind ?? data.type ?? '').includes('playlist')"
|
:showIndexPlaylist="(data.attributes.playParams.kind ?? data.type ?? '').includes('playlist')"
|
||||||
:context-ext="buildContextMenu()"
|
:context-ext="buildContextMenu()"
|
||||||
v-for="(item,index) in data.relationships.tracks.data"></mediaitem-list-item>
|
v-for="(item,index) in data.relationships.tracks.data"></mediaitem-list-item>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<div v-for="disc in nestedPlaylist">
|
||||||
|
<div class="playlist-time">Disc {{disc.disc}}</div>
|
||||||
|
<mediaitem-list-item :item="item" :parent="getItemParent(data)" :index="index"
|
||||||
|
:showIndex="true"
|
||||||
|
:showIndexPlaylist="(data.attributes.playParams.kind ?? data.type ?? '').includes('playlist')"
|
||||||
|
:context-ext="buildContextMenu()"
|
||||||
|
v-for="(item,index) in disc.tracks"></mediaitem-list-item>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</template>
|
||||||
</draggable>
|
</draggable>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -248,6 +261,7 @@
|
||||||
badgesRequested: false,
|
badgesRequested: false,
|
||||||
headerVisible: true,
|
headerVisible: true,
|
||||||
useArtistChip: false,
|
useArtistChip: false,
|
||||||
|
nestedPlaylist: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
|
@ -257,11 +271,28 @@
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
data: function () {
|
data: function () {
|
||||||
|
this.nestedPlaylist = [];
|
||||||
this.isInLibrary()
|
this.isInLibrary()
|
||||||
this.getBadges()
|
this.getBadges()
|
||||||
|
this.generateNestedPlaylist()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
generateNestedPlaylist(){
|
||||||
|
this.nestedPlaylist = [];
|
||||||
|
if (this.data?.type?.includes("album")){
|
||||||
|
console.log(this.data.relationships.tracks.data)
|
||||||
|
let songlists = this.data.relationships.tracks.data;
|
||||||
|
let discs = songlists.map(x => {return x.attributes.discNumber}).filter((item, i, ar) => ar.indexOf(item) === i);
|
||||||
|
if (discs && discs.length > 1){
|
||||||
|
for (disc of discs){
|
||||||
|
let songs = songlists.filter(x => x.attributes.discNumber == disc);
|
||||||
|
this.nestedPlaylist.push({disc: disc, tracks: songs})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(this.nestedPlaylist)
|
||||||
|
|
||||||
|
}},
|
||||||
isHeaderVisible(visible) {
|
isHeaderVisible(visible) {
|
||||||
this.headerVisible = visible
|
this.headerVisible = visible
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue