test
This commit is contained in:
parent
5f78adabc7
commit
5d3853d208
5 changed files with 217 additions and 127 deletions
|
@ -45,6 +45,7 @@ export class BrowserWindow {
|
|||
private headerSent: any = false;
|
||||
private chromecastIP: any = [];
|
||||
private localSongs: any = [];
|
||||
private localSongsArts: any = [];
|
||||
private clientPort: number = 0;
|
||||
private remotePort: number = 6942;
|
||||
private EnvironmentVariables: object = {
|
||||
|
@ -550,16 +551,23 @@ export class BrowserWindow {
|
|||
res.send(`// Theme not found - ${userThemePath}`);
|
||||
}
|
||||
});
|
||||
|
||||
app.get("/ciderlocal/:songs", (req, res) => {
|
||||
const audio = atob(req.params.songs.replace(/_/g, '/').replace(/-/g, '+'));
|
||||
console.log('auss', audio)
|
||||
let data = {
|
||||
data:
|
||||
this.localSongs.filter((f: any) => audio.split(',').includes(f.id))
|
||||
};
|
||||
//console.log('auss', audio)
|
||||
let data = {data:
|
||||
this.localSongs.filter((f: any) => audio.split(',').includes(f.id))};
|
||||
res.send(data);
|
||||
});
|
||||
|
||||
app.get("/ciderlocalart/:songs", (req, res) => {
|
||||
const audio = req.params.songs;
|
||||
// metadata.common.picture[0].data.toString('base64')
|
||||
let data =
|
||||
this.localSongsArts.filter((f: any) => f.id == audio);
|
||||
res.status(200).send(Buffer.from(data[0]?.url, 'base64'));
|
||||
});
|
||||
|
||||
|
||||
app.get("/themes/:theme/*", (req: { params: { theme: string, 0: string } }, res) => {
|
||||
const theme = req.params.theme;
|
||||
|
@ -675,7 +683,7 @@ export class BrowserWindow {
|
|||
});
|
||||
} else if (details.url.includes("ciderlocal")) {
|
||||
let text = details.url.toString().includes('ids=') ? decodeURIComponent(details.url.toString()).split("?ids=")[1] : decodeURIComponent(details.url.toString().substring(details.url.toString().lastIndexOf('/') + 1));
|
||||
console.log('localurl', text)
|
||||
//console.log('localurl',text)
|
||||
callback({
|
||||
redirectURL: `http://localhost:${this.clientPort}/ciderlocal/${Buffer.from(text).toString('base64url')}`,
|
||||
});
|
||||
|
@ -1198,69 +1206,70 @@ export class BrowserWindow {
|
|||
return dirent.isDirectory() ? getFiles(res) : res;
|
||||
}));
|
||||
return Array.prototype.concat(...files);
|
||||
}
|
||||
if (folders == null || folders.length == null || folders.length == 0) folders = ["D:\\Music"]
|
||||
console.log('folders', folders)
|
||||
let files: any[] = []
|
||||
for (var folder of folders) {
|
||||
// get files from the Music folder
|
||||
files = files.concat(await getFiles(folder))
|
||||
}
|
||||
|
||||
//console.log("cider.files", files2);
|
||||
let supporttedformats = ["mp3", "aac", "webm", "flac", "m4a", "ogg", "wav", "opus"]
|
||||
let audiofiles = files.filter(f => supporttedformats.includes(f.substring(f.lastIndexOf('.') + 1)));
|
||||
// console.log("cider.files2", audiofiles, audiofiles.length);
|
||||
let metadatalist = []
|
||||
let numid = 0;
|
||||
for (var audio of audiofiles) {
|
||||
try {
|
||||
const metadata = await mm.parseFile(audio);
|
||||
if (metadata != null) {
|
||||
let form = {
|
||||
"id": "ciderlocal" + numid,
|
||||
"type": "podcast-episodes",
|
||||
"href": audio,
|
||||
"attributes": {
|
||||
"artwork": {
|
||||
"width": 3000,
|
||||
"height": 3000,
|
||||
"url": metadata.common.picture != undefined ? "data:image/png;base64," + metadata.common.picture[0].data.toString('base64') + "" : "",
|
||||
},
|
||||
"topics": [],
|
||||
"url": "",
|
||||
"subscribable": true,
|
||||
"mediaKind": "audio",
|
||||
"genreNames": [
|
||||
""
|
||||
],
|
||||
// "playParams": {
|
||||
// "id": "ciderlocal" + numid,
|
||||
// "kind": "podcast",
|
||||
// "isLibrary": true,
|
||||
// "reporting": false },
|
||||
"trackNumber": metadata.common.track?.no ?? 0,
|
||||
"discNumber": metadata.common.disk?.no ?? 0,
|
||||
"name": metadata.common.title ?? audio.substring(audio.lastIndexOf('\\') + 1),
|
||||
"albumName": metadata.common.album,
|
||||
"artistName": metadata.common.artist,
|
||||
"copyright": metadata.common.copyright ?? "",
|
||||
"assetUrl": "file:///" + audio,
|
||||
"contentAdvisory": "",
|
||||
"releaseDateTime": "2022-05-13T00:23:00Z",
|
||||
"durationInMilliseconds": Math.floor((metadata.format.duration ?? 0) * 1000),
|
||||
|
||||
"offers": [
|
||||
{
|
||||
"kind": "get",
|
||||
"type": "STDQ"
|
||||
}
|
||||
],
|
||||
"contentRating": "clean"
|
||||
}
|
||||
};
|
||||
numid += 1;
|
||||
|
||||
}
|
||||
if (folders == null || folders.length == null || folders.length == 0) folders = ["D:\\Music"]
|
||||
console.log('folders', folders)
|
||||
let files: any[] = []
|
||||
for (var folder of folders){
|
||||
// get files from the Music folder
|
||||
files = files.concat(await getFiles(folder))
|
||||
}
|
||||
|
||||
//console.log("cider.files", files2);
|
||||
let supporttedformats = ["mp3", "aac", "webm", "flac", "m4a", "ogg", "wav", "opus"]
|
||||
let audiofiles = files.filter(f => supporttedformats.includes(f.substring(f.lastIndexOf('.') + 1)));
|
||||
// console.log("cider.files2", audiofiles, audiofiles.length);
|
||||
let metadatalist = []
|
||||
let metadatalistart = []
|
||||
let numid = 0;
|
||||
for (var audio of audiofiles) {
|
||||
try{
|
||||
const metadata = await mm.parseFile(audio);
|
||||
if (metadata != null){
|
||||
let form = {
|
||||
"id": "ciderlocal" + numid,
|
||||
"type": "podcast-episodes",
|
||||
"href": audio,
|
||||
"attributes": {
|
||||
"artwork": {
|
||||
"width": 3000,
|
||||
"height": 3000,
|
||||
"url": "/ciderlocalart/" + "ciderlocal" + numid,
|
||||
},
|
||||
"topics": [],
|
||||
"url": "",
|
||||
"subscribable": true,
|
||||
"mediaKind": "audio",
|
||||
"genreNames": [
|
||||
""
|
||||
],
|
||||
// "playParams": {
|
||||
// "id": "ciderlocal" + numid,
|
||||
// "kind": "podcast",
|
||||
// "isLibrary": true,
|
||||
// "reporting": false },
|
||||
"trackNumber": metadata.common.track?.no ?? 0,
|
||||
"discNumber": metadata.common.disk?.no ?? 0,
|
||||
"name": metadata.common.title ?? audio.substring(audio.lastIndexOf('\\') + 1),
|
||||
"albumName": metadata.common.album,
|
||||
"artistName": metadata.common.artist,
|
||||
"copyright": metadata.common.copyright ?? "",
|
||||
"assetUrl": "file:///" +audio,
|
||||
"contentAdvisory": "",
|
||||
"releaseDateTime": "2022-05-13T00:23:00Z",
|
||||
"durationInMilliseconds": Math.floor((metadata.format.duration?? 0) * 1000),
|
||||
|
||||
"offers": [
|
||||
{
|
||||
"kind": "get",
|
||||
"type": "STDQ"
|
||||
}
|
||||
],
|
||||
"contentRating": "clean"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// let form = {"id": "/ciderlocal?" + audio,
|
||||
// "type": "library-songs",
|
||||
// "href": "/ciderlocal?" + audio,
|
||||
|
@ -1277,9 +1286,18 @@ export class BrowserWindow {
|
|||
// "name": metadata.common.title,
|
||||
// "albumName": metadata.common.album,
|
||||
// "artistName": metadata.common.artist}}
|
||||
metadatalist.push(form)
|
||||
}
|
||||
} catch (e) { }
|
||||
metadatalistart.push({
|
||||
id : "ciderlocal" + numid,
|
||||
url: metadata.common.picture != undefined ? metadata.common.picture[0].data.toString('base64') : "",
|
||||
})
|
||||
numid += 1;
|
||||
metadatalist.push(form)}
|
||||
} catch (e){}
|
||||
}
|
||||
// console.log('metadatalist', metadatalist);
|
||||
this.localSongs = metadatalist;
|
||||
this.localSongsArts = metadatalistart;
|
||||
BrowserWindow.win.webContents.send('getUpdatedLocalList', metadatalist);
|
||||
}
|
||||
// console.log('metadatalist', metadatalist);
|
||||
this.localSongs = metadatalist;
|
||||
|
|
|
@ -3500,7 +3500,15 @@ const app = new Vue({
|
|||
console.log(truekind, id)
|
||||
|
||||
try {
|
||||
if (app.library.songs.displayListing.length > childIndex && parent == "librarysongs") {
|
||||
if (parent == 'playlist:ciderlocal'){
|
||||
let u = app.library.localsongs.map(i => {return i.id})
|
||||
app.mk.setQueue({"episodes" : u}).then(()=>{
|
||||
let id = app.mk.queue._itemIDs.findIndex(element => element == item.id);
|
||||
app.mk.changeToMediaAtIndex(id)
|
||||
})
|
||||
|
||||
}
|
||||
else if (app.library.songs.displayListing.length > childIndex && parent == "librarysongs") {
|
||||
console.log(item)
|
||||
if (item && ((app.library.songs.displayListing[childIndex].id != item.id))) {
|
||||
childIndex = app.library.songs.displayListing.indexOf(item)
|
||||
|
@ -3804,7 +3812,7 @@ const app = new Vue({
|
|||
type += "s"
|
||||
}
|
||||
type = type.replace("library-", "")
|
||||
let id = item.attributes.playParams.catalogId ?? item.attributes.playParams.id ?? item.id
|
||||
let id = item.attributes.playParams?.catalogId ?? item.attributes.playParams.id ?? item.id
|
||||
|
||||
let index = types.findIndex(function (type) {
|
||||
return type.type == this
|
||||
|
|
|
@ -123,8 +123,8 @@
|
|||
},
|
||||
mounted() {
|
||||
if (this.item.attributes.playParams) {
|
||||
this.itemId = this.item.attributes.playParams.id ?? this.item.id;
|
||||
this.isLibrary = this.item.attributes.playParams.isLibrary ?? false;
|
||||
this.itemId = this.item.attributes.playParams?.id ?? this.item.id;
|
||||
this.isLibrary = this.item.attributes.playParams?.isLibrary ?? false;
|
||||
} else {
|
||||
this.itemId = this.item.id;
|
||||
}
|
||||
|
@ -143,6 +143,9 @@
|
|||
return color
|
||||
},
|
||||
async checkLibrary() {
|
||||
if (this.item.id.startsWith('ciderlocal')){
|
||||
return true
|
||||
}
|
||||
if (this.addedToLibrary) { return this.addedToLibrary }
|
||||
if (this.item.type.includes("library-playlists") || this.item.type.includes("station")) {
|
||||
this.addedToLibrary = true
|
||||
|
@ -155,7 +158,7 @@
|
|||
},
|
||||
getClasses() {
|
||||
this.addClasses = {}
|
||||
if (typeof this.item.attributes.playParams == "undefined") {
|
||||
if (typeof this.item.attributes.playParams == "undefined" && this.item.type != "podcast-episodes") {
|
||||
this.addClasses["disabled"] = true
|
||||
}
|
||||
if (this.classList) {
|
||||
|
@ -167,7 +170,7 @@
|
|||
},
|
||||
dragStart(evt) {
|
||||
evt.dataTransfer.setData('text/plain', JSON.stringify({
|
||||
type: this.item.attributes.playParams.kind ?? this.item.type,
|
||||
type: this.item.attributes.playParams?.kind ?? this.item.type,
|
||||
id: this.item.id
|
||||
}))
|
||||
},
|
||||
|
@ -183,10 +186,10 @@
|
|||
},
|
||||
getDataType() {
|
||||
if (typeof this.item.attributes.playParams != "undefined") {
|
||||
if (this.item.attributes.playParams.isLibrary) {
|
||||
if (this.item.attributes.playParams?.isLibrary) {
|
||||
return this.item.type
|
||||
} else {
|
||||
return this.item.attributes.playParams.kind
|
||||
return this.item.attributes.playParams?.kind
|
||||
}
|
||||
} else {
|
||||
return this.item.type
|
||||
|
@ -194,8 +197,8 @@
|
|||
},
|
||||
select(e) {
|
||||
let data_type = this.getDataType()
|
||||
let item_id = this.item.attributes.playParams.id ?? this.item.id
|
||||
let isLibrary = this.item.attributes.playParams.isLibrary ?? false
|
||||
let item_id = this.item.attributes.playParams?.id ?? this.item.id
|
||||
let isLibrary = this.item.attributes.playParams?.isLibrary ?? false
|
||||
|
||||
if (e.shiftKey) {
|
||||
if (this.index != -1) {
|
||||
|
@ -259,8 +262,8 @@
|
|||
async contextMenu(event) {
|
||||
let self = this
|
||||
let data_type = this.getDataType()
|
||||
let item_id = this.item.attributes.playParams.id ?? this.item.id
|
||||
let isLibrary = this.item.attributes.playParams.isLibrary ?? false
|
||||
let item_id = this.item.attributes.playParams?.id ?? this.item.id
|
||||
let isLibrary = this.item.attributes.playParams?.isLibrary ?? false
|
||||
|
||||
let useMenu = "normal"
|
||||
if (app.selectedMediaItems.length <= 1) {
|
||||
|
@ -319,6 +322,7 @@
|
|||
app.mk.playLater({ [kind + "s"]: itemsToPlay[kind] })
|
||||
}
|
||||
}
|
||||
console.log(itemsToPlay)
|
||||
app.selectedMediaItems = []
|
||||
}
|
||||
},
|
||||
|
@ -400,7 +404,9 @@
|
|||
"name": app.getLz('action.playNext'),
|
||||
"icon": "./assets/arrow-bend-up.svg",
|
||||
"action": function () {
|
||||
app.mk.playNext({ [self.item.attributes.playParams.kind ?? self.item.type]: self.item.attributes.playParams.id ?? self.item.id })
|
||||
let type = self.item.attributes.playParams?.kind ?? self.item.type
|
||||
if (type == "podcast-episodes") {type = "episode"}
|
||||
app.mk.playNext({ [type]: self.item.attributes.playParams?.id ?? self.item.id })
|
||||
app.mk.queue._reindex()
|
||||
app.selectedMediaItems = []
|
||||
}
|
||||
|
@ -409,7 +415,9 @@
|
|||
"name": app.getLz('action.playLater'),
|
||||
"icon": "./assets/arrow-bend-down.svg",
|
||||
"action": function () {
|
||||
app.mk.playLater({ [self.item.attributes.playParams.kind ?? self.item.type]: self.item.attributes.playParams.id ?? self.item.id })
|
||||
let type = self.item.attributes.playParams?.kind ?? self.item.type
|
||||
if (type == "podcast-episodes") {type = "episode"}
|
||||
app.mk.playLater({ [type]: self.item.attributes.playParams?.id ?? self.item.id })
|
||||
app.mk.queue._reindex()
|
||||
app.selectedMediaItems = []
|
||||
}
|
||||
|
@ -418,7 +426,7 @@
|
|||
"icon": "./assets/feather/radio.svg",
|
||||
"name": app.getLz('action.startRadio'),
|
||||
"action": function () {
|
||||
app.mk.setStationQueue({ song: self.item.attributes.playParams.id ?? self.item.id }).then(() => {
|
||||
app.mk.setStationQueue({ song: self.item.attributes.playParams?.id ?? self.item.id }).then(() => {
|
||||
app.mk.play()
|
||||
app.selectedMediaItems = []
|
||||
})
|
||||
|
@ -444,7 +452,7 @@
|
|||
"action": function () {
|
||||
if (!self.item.attributes.url && self.item.relationships) {
|
||||
if (self.item.relationships.catalog) {
|
||||
app.mkapi(self.item.attributes.playParams.kind, false, self.item.relationships.catalog.data[0].id).then(u => { self.app.copyToClipboard((u.data.data.length && u.data.data.length > 0) ? u.data.data[0].attributes.url : u.data.data.attributes.url) })
|
||||
app.mkapi(self.item.attributes.playParams?.kind, false, self.item.relationships.catalog.data[0].id).then(u => { self.app.copyToClipboard((u.data.data.length && u.data.data.length > 0) ? u.data.data[0].attributes.url : u.data.data.attributes.url) })
|
||||
}
|
||||
} else {
|
||||
self.app.copyToClipboard(self.item.attributes.url)
|
||||
|
@ -457,7 +465,7 @@
|
|||
"action": function () {
|
||||
if (!self.item.attributes.url && self.item.relationships) {
|
||||
if (self.item.relationships.catalog) {
|
||||
app.mkapi(self.item.attributes.playParams.kind, false, self.item.relationships.catalog.data[0].id).then(u => { self.app.songLinkShare((u.data.data.length && u.data.data.length > 0) ? u.data.data[0].attributes.url : u.data.data.attributes.url) })
|
||||
app.mkapi(self.item.attributes.playParams?.kind, false, self.item.relationships.catalog.data[0].id).then(u => { self.app.songLinkShare((u.data.data.length && u.data.data.length > 0) ? u.data.data[0].attributes.url : u.data.data.attributes.url) })
|
||||
}
|
||||
} else {
|
||||
self.app.songLinkShare(self.item.attributes.url)
|
||||
|
@ -526,9 +534,9 @@
|
|||
},
|
||||
addToLibrary() {
|
||||
let item = this.item
|
||||
if (item.attributes.playParams.id) {
|
||||
console.log('adding to library', item.attributes.playParams.id)
|
||||
app.addToLibrary(item.attributes.playParams.id.toString())
|
||||
if (item.attributes.playParams?.id) {
|
||||
console.log('adding to library', item.attributes.playParams?.id)
|
||||
app.addToLibrary(item.attributes.playParams?.id.toString())
|
||||
this.addedToLibrary = true
|
||||
} else if (item.id) {
|
||||
console.log('adding to library', item.id)
|
||||
|
@ -539,14 +547,14 @@
|
|||
async removeFromLibrary() {
|
||||
let item = this.item
|
||||
let params = { "fields[songs]": "inLibrary", "fields[albums]": "inLibrary", "relate": "library" }
|
||||
let id = item.id ?? item.attributes.playParams.id
|
||||
let res = await app.mkapi(item.attributes.playParams.kind ?? item.type, item.attributes.playParams.isLibrary ?? false, item.attributes.playParams.id ?? item.id, params);
|
||||
let id = item.id ?? item.attributes.playParams?.id
|
||||
let res = await app.mkapi(item.attributes.playParams?.kind ?? item.type, item.attributes.playParams?.isLibrary ?? false, item.attributes.playParams?.id ?? item.id, params);
|
||||
if (res && res.relationships && res.relationships.library && res.relationships.library.data && res.relationships.library.data.length > 0) {
|
||||
id = res.relationships.library.data[0].id
|
||||
}
|
||||
let kind = this.item.attributes.playParams.kind ?? this.data.item ?? '';
|
||||
let kind = this.item.attributes.playParams?.kind ?? this.data.item ?? '';
|
||||
let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
|
||||
if (item.attributes.playParams.id) {
|
||||
if (item.attributes.playParams?.id) {
|
||||
console.log('remove from library', id)
|
||||
app.removeFromLibrary(truekind, id)
|
||||
this.addedToLibrary = false
|
||||
|
@ -560,9 +568,9 @@
|
|||
let item = this.item
|
||||
let parent = this.parent
|
||||
let childIndex = this.index
|
||||
let kind = (item.attributes.playParams ? (item.attributes.playParams.kind ?? (item.type ?? '')) : (item.type ?? ''));
|
||||
let id = (item.attributes.playParams ? (item.attributes.playParams.id ?? (item.id ?? '')) : (item.id ?? ''));;
|
||||
let isLibrary = item.attributes.playParams ? (item.attributes.playParams.isLibrary ?? false) : false;
|
||||
let kind = (item.attributes.playParams ? (item.attributes.playParams?.kind ?? (item.type ?? '')) : (item.type ?? ''));
|
||||
let id = (item.attributes.playParams ? (item.attributes.playParams?.id ?? (item.id ?? '')) : (item.id ?? ''));;
|
||||
let isLibrary = item.attributes.playParams ? (item.attributes.playParams?.isLibrary ?? false) : false;
|
||||
let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
|
||||
console.log(item, parent, childIndex, kind, id, isLibrary, kind == "playlists", id.startsWith("p.") || id.startsWith("pl.u"))
|
||||
app.mk.stop().then(() => {
|
||||
|
@ -578,7 +586,7 @@
|
|||
array[j] = temp;
|
||||
}
|
||||
}
|
||||
app.mk.setQueue({ [truekind]: [item.attributes.playParams.id ?? item.id], parameters: { l: this.app.mklang } }).then(function () {
|
||||
app.mk.setQueue({ [truekind]: [item.attributes.playParams?.id ?? item.id], parameters: { l: this.app.mklang } }).then(function () {
|
||||
app.mk.play().then(function () {
|
||||
var playlistId = id
|
||||
function getPlaylist(id, isLibrary) {
|
||||
|
@ -624,12 +632,12 @@
|
|||
|
||||
}
|
||||
else {
|
||||
app.playMediaItemById(item.attributes.playParams.id ?? item.id, item.attributes.playParams.kind ?? item.type, item.attributes.playParams.isLibrary ?? false, item.attributes.url)
|
||||
app.playMediaItemById(item.attributes.playParams?.id ?? item.id, item.attributes.playParams?.kind ?? item.type, item.attributes.playParams?.isLibrary ?? false, item.attributes.url)
|
||||
}
|
||||
})
|
||||
},
|
||||
route() {
|
||||
let kind = (this.item.attributes.playParams ? (this.item.attributes.playParams.kind ?? (this.item.type ?? '')) : (this.item.type ?? ''));
|
||||
let kind = (this.item.attributes.playParams ? (this.item.attributes.playParams?.kind ?? (this.item.type ?? '')) : (this.item.type ?? ''));
|
||||
if (kind.toLowerCase().includes('album') || kind.toLowerCase().includes('playlist')) {
|
||||
app.routeView(this.item)
|
||||
} else {
|
||||
|
|
|
@ -207,7 +207,44 @@
|
|||
openPlaylist(item) {
|
||||
this.$root.appRoute(`playlist_` + item.id);
|
||||
this.$root.showingPlaylist = [];
|
||||
this.$root.getPlaylistFromID(this.$root.page.substring(9), true)
|
||||
if (item.id == 'ciderlocal') {
|
||||
this.$root.showingPlaylist = {
|
||||
"id": "ciderlocal",
|
||||
"type": "library-playlists",
|
||||
"href": "",
|
||||
"attributes": {
|
||||
"artwork": {
|
||||
"width": null,
|
||||
"height": null,
|
||||
"url": "",
|
||||
"hasP3": false
|
||||
},
|
||||
"dateAdded": "2021-02-16T03:39:47Z",
|
||||
"name": "Local Songs",
|
||||
"canDelete": true,
|
||||
"hasCatalog": true,
|
||||
"canEdit": true,
|
||||
"playParams": {
|
||||
"id": "ciderlocal",
|
||||
"kind": "playlist",
|
||||
"isLibrary": true,
|
||||
},
|
||||
"isPublic": true,
|
||||
"description": {
|
||||
"standard": "LocalSongs"
|
||||
}
|
||||
},
|
||||
"relationships": {
|
||||
"tracks": {
|
||||
"href": "",
|
||||
"data": this.$root.library.localsongs
|
||||
}
|
||||
}
|
||||
}
|
||||
this.$root.playlists.loadingState = 1;
|
||||
} else {
|
||||
this.$root.getPlaylistFromID(this.$root.page.substring(9), true)
|
||||
}
|
||||
},
|
||||
getPlaylistChildren(item) {
|
||||
let self = this
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
@click="openInfoModal()"></div>
|
||||
<div v-else-if="((data.attributes.description?.standard ?? data.attributes.editorialNotes?.standard) != null) && (descriptionEditing == false)"
|
||||
@mouseover="minClass(false)" @click="editPlaylistDescription()" v-html="(data.attributes.description?.standard ?? (data.attributes.editorialNotes?.standard ?? '')).substring(0, 255) +'...'"
|
||||
@click="if((data.attributes.description?.standard ?? (data.attributes.editorialNotes?.standard ?? '')).length > 255) {openInfoModal()}"></div>
|
||||
></div>
|
||||
<div v-else-if="((data.attributes.description?.standard ?? data.attributes.editorialNotes?.standard) != null) && (descriptionEditing)"
|
||||
@mouseover="minClass(false)"><input type="text"
|
||||
spellcheck="false"
|
||||
|
@ -195,7 +195,7 @@
|
|||
<template v-if="!hasNestedPlaylist">
|
||||
<mediaitem-list-item :item="item" :parent="getItemParent(data)" :index="index"
|
||||
:showIndex="true"
|
||||
:showIndexPlaylist="(data.attributes.playParams.kind ?? data.type ?? '').includes('playlist')"
|
||||
:showIndexPlaylist="(data.attributes.playParams?.kind ?? data.type ?? '').includes('playlist')"
|
||||
:context-ext="buildContextMenu()"
|
||||
v-for="(item,index) in displayListing"></mediaitem-list-item>
|
||||
</template>
|
||||
|
@ -207,7 +207,7 @@
|
|||
<mediaitem-list-item :item="item" :parent="getItemParent(data)"
|
||||
:index="index"
|
||||
:showIndex="true"
|
||||
:showIndexPlaylist="(data.attributes.playParams.kind ?? data.type ?? '').includes('playlist')"
|
||||
:showIndexPlaylist="(data.attributes.playParams?.kind ?? data.type ?? '').includes('playlist')"
|
||||
:context-ext="buildContextMenu()"
|
||||
v-for="(item,index) in disc.tracks"></mediaitem-list-item>
|
||||
</div>
|
||||
|
@ -305,17 +305,24 @@
|
|||
},
|
||||
mounted: function () {
|
||||
this.$nextTick(function () {
|
||||
this.isInLibrary()
|
||||
})
|
||||
if (this.data.id != "ciderlocal") {
|
||||
this.isInLibrary()
|
||||
} else {
|
||||
if (this.data.relationships != null && this.data.id == "ciderlocal") {
|
||||
this.displayListing = this.data.relationships.tracks.data
|
||||
}
|
||||
|
||||
this.inPlaylist = this.data.type == "library-playlists";
|
||||
}})
|
||||
},
|
||||
beforeMount() {
|
||||
if( window.location.hash.includes("playlist") ) {
|
||||
if (window.location.hash.includes("playlist")) {
|
||||
window.addEventListener('keydown', this.getCopiedPlayListSongs);
|
||||
window.addEventListener('keydown', this.pasteSongs);
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
if( window.location.hash.includes("playlist") ) {
|
||||
if (window.location.hash.includes("playlist")) {
|
||||
window.removeEventListener('keydown', this.getCopiedPlayListSongs);
|
||||
window.removeEventListener('keydown', this.pasteSongs);
|
||||
}
|
||||
|
@ -326,10 +333,14 @@
|
|||
this.isInLibrary()
|
||||
this.getBadges()
|
||||
|
||||
if (this.data.relationships) {
|
||||
this.generateNestedPlaylist(this.data.relationships.tracks.data)
|
||||
if (!this.hasNestedPlaylist) {
|
||||
if (this.data.relationships != null) {
|
||||
if (this.data.id == "ciderlocal") {
|
||||
this.displayListing = this.data.relationships.tracks.data
|
||||
} else {
|
||||
this.generateNestedPlaylist(this.data.relationships.tracks.data)
|
||||
if (!this.hasNestedPlaylist) {
|
||||
this.displayListing = this.data.relationships.tracks.data
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -382,21 +393,21 @@
|
|||
this.headerVisible = visible
|
||||
},
|
||||
hasHero() {
|
||||
if(this.data.attributes?.editorialArtwork?.bannerUber){
|
||||
if (this.data.attributes?.editorialArtwork?.bannerUber) {
|
||||
return this.data.attributes?.editorialArtwork?.bannerUber.url
|
||||
} else if(this.data.attributes?.editorialArtwork?.subscriptionHero) {
|
||||
} else if (this.data.attributes?.editorialArtwork?.subscriptionHero) {
|
||||
return this.data.attributes?.editorialArtwork?.subscriptionHero.url
|
||||
} else if(this.data.attributes?.editorialArtwork?.storeFlowcase){
|
||||
} else if (this.data.attributes?.editorialArtwork?.storeFlowcase) {
|
||||
return this.data.attributes?.editorialArtwork?.storeFlowcase.url
|
||||
}
|
||||
return false;
|
||||
},
|
||||
hasHeroObject() {
|
||||
if(this.data.attributes?.editorialArtwork?.bannerUber){
|
||||
if (this.data.attributes?.editorialArtwork?.bannerUber) {
|
||||
return this.data.attributes?.editorialArtwork?.bannerUber
|
||||
} else if(this.data.attributes?.editorialArtwork?.subscriptionHero) {
|
||||
} else if (this.data.attributes?.editorialArtwork?.subscriptionHero) {
|
||||
return this.data.attributes?.editorialArtwork?.subscriptionHero
|
||||
} else if(this.data.attributes?.editorialArtwork?.storeFlowcase){
|
||||
} else if (this.data.attributes?.editorialArtwork?.storeFlowcase) {
|
||||
return this.data.attributes?.editorialArtwork?.storeFlowcase
|
||||
}
|
||||
return [];
|
||||
|
@ -774,14 +785,17 @@
|
|||
}
|
||||
}
|
||||
|
||||
const id = this.data.attributes.playParams.id ?? this.data.id;
|
||||
const id = this.data.attributes.playParams?.id ?? this.data.id;
|
||||
//console.log("1")
|
||||
const kind = this.data.attributes.playParams.kind ?? this.data.type ?? '';
|
||||
const kind = this.data.attributes.playParams?.kind ?? this.data.type ?? '';
|
||||
//console.log("1")
|
||||
if (kind == "podcast-episodes") {kind = "episode"}
|
||||
const truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
|
||||
|
||||
let query = (this.data ?? app.showingPlaylist).relationships.tracks.data.map(item => new MusicKit.MediaItem(item));
|
||||
app.mk.stop().then(function () {
|
||||
|
||||
app.mk.stop().then(() => {
|
||||
if (id != 'ciderlocal'){
|
||||
app.mk.setQueue({ [truekind]: [id], parameters: { l: app.mklang } }).then(function () {
|
||||
app.mk.play().then(function () {
|
||||
if (query.length > 100) {
|
||||
|
@ -792,7 +806,12 @@
|
|||
app.mk.queue.append(u)
|
||||
}
|
||||
})
|
||||
})
|
||||
})} else {
|
||||
let u = app.library.localsongs.map(i => {return i.id})
|
||||
app.mk.setQueue({"episodes" : u}).then(()=>{
|
||||
app.mk.play()
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
@ -802,7 +821,7 @@
|
|||
return "d-none";
|
||||
},
|
||||
async getCopiedPlayListSongs(event) {
|
||||
if( event.ctrlKey && event.keyCode === 67 ) {
|
||||
if (event.ctrlKey && event.keyCode === 67) {
|
||||
let urls = [];
|
||||
app.selectedMediaItems.forEach(item => {
|
||||
this.app.mk.api.v3.music(`/v1/me/library/songs/${item.id}`).then((response) => {
|
||||
|
@ -816,14 +835,14 @@
|
|||
}
|
||||
},
|
||||
async pasteSongs(event) {
|
||||
if( event.ctrlKey && event.keyCode === 86 && this.data.attributes.canEdit ) {
|
||||
if (event.ctrlKey && event.keyCode === 86 && this.data.attributes.canEdit) {
|
||||
let clipboard = await navigator.clipboard.readText()
|
||||
let songs = []
|
||||
|
||||
clipboard = clipboard.split(",")
|
||||
clipboard.forEach(item => {
|
||||
songs.push({
|
||||
id: item.substring(item.indexOf("i=")+2, item.length),
|
||||
id: item.substring(item.indexOf("i=") + 2, item.length),
|
||||
type: "songs",
|
||||
})
|
||||
})
|
||||
|
@ -901,4 +920,4 @@
|
|||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue