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 headerSent: any = false;
|
||||||
private chromecastIP: any = [];
|
private chromecastIP: any = [];
|
||||||
private localSongs: any = [];
|
private localSongs: any = [];
|
||||||
|
private localSongsArts: any = [];
|
||||||
private clientPort: number = 0;
|
private clientPort: number = 0;
|
||||||
private remotePort: number = 6942;
|
private remotePort: number = 6942;
|
||||||
private EnvironmentVariables: object = {
|
private EnvironmentVariables: object = {
|
||||||
|
@ -550,16 +551,23 @@ export class BrowserWindow {
|
||||||
res.send(`// Theme not found - ${userThemePath}`);
|
res.send(`// Theme not found - ${userThemePath}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/ciderlocal/:songs", (req, res) => {
|
app.get("/ciderlocal/:songs", (req, res) => {
|
||||||
const audio = atob(req.params.songs.replace(/_/g, '/').replace(/-/g, '+'));
|
const audio = atob(req.params.songs.replace(/_/g, '/').replace(/-/g, '+'));
|
||||||
console.log('auss', audio)
|
//console.log('auss', audio)
|
||||||
let data = {
|
let data = {data:
|
||||||
data:
|
this.localSongs.filter((f: any) => audio.split(',').includes(f.id))};
|
||||||
this.localSongs.filter((f: any) => audio.split(',').includes(f.id))
|
|
||||||
};
|
|
||||||
res.send(data);
|
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) => {
|
app.get("/themes/:theme/*", (req: { params: { theme: string, 0: string } }, res) => {
|
||||||
const theme = req.params.theme;
|
const theme = req.params.theme;
|
||||||
|
@ -675,7 +683,7 @@ export class BrowserWindow {
|
||||||
});
|
});
|
||||||
} else if (details.url.includes("ciderlocal")) {
|
} 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));
|
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({
|
callback({
|
||||||
redirectURL: `http://localhost:${this.clientPort}/ciderlocal/${Buffer.from(text).toString('base64url')}`,
|
redirectURL: `http://localhost:${this.clientPort}/ciderlocal/${Buffer.from(text).toString('base64url')}`,
|
||||||
});
|
});
|
||||||
|
@ -1202,7 +1210,7 @@ export class BrowserWindow {
|
||||||
if (folders == null || folders.length == null || folders.length == 0) folders = ["D:\\Music"]
|
if (folders == null || folders.length == null || folders.length == 0) folders = ["D:\\Music"]
|
||||||
console.log('folders', folders)
|
console.log('folders', folders)
|
||||||
let files: any[] = []
|
let files: any[] = []
|
||||||
for (var folder of folders) {
|
for (var folder of folders){
|
||||||
// get files from the Music folder
|
// get files from the Music folder
|
||||||
files = files.concat(await getFiles(folder))
|
files = files.concat(await getFiles(folder))
|
||||||
}
|
}
|
||||||
|
@ -1212,11 +1220,12 @@ export class BrowserWindow {
|
||||||
let audiofiles = files.filter(f => supporttedformats.includes(f.substring(f.lastIndexOf('.') + 1)));
|
let audiofiles = files.filter(f => supporttedformats.includes(f.substring(f.lastIndexOf('.') + 1)));
|
||||||
// console.log("cider.files2", audiofiles, audiofiles.length);
|
// console.log("cider.files2", audiofiles, audiofiles.length);
|
||||||
let metadatalist = []
|
let metadatalist = []
|
||||||
|
let metadatalistart = []
|
||||||
let numid = 0;
|
let numid = 0;
|
||||||
for (var audio of audiofiles) {
|
for (var audio of audiofiles) {
|
||||||
try {
|
try{
|
||||||
const metadata = await mm.parseFile(audio);
|
const metadata = await mm.parseFile(audio);
|
||||||
if (metadata != null) {
|
if (metadata != null){
|
||||||
let form = {
|
let form = {
|
||||||
"id": "ciderlocal" + numid,
|
"id": "ciderlocal" + numid,
|
||||||
"type": "podcast-episodes",
|
"type": "podcast-episodes",
|
||||||
|
@ -1225,7 +1234,7 @@ export class BrowserWindow {
|
||||||
"artwork": {
|
"artwork": {
|
||||||
"width": 3000,
|
"width": 3000,
|
||||||
"height": 3000,
|
"height": 3000,
|
||||||
"url": metadata.common.picture != undefined ? "data:image/png;base64," + metadata.common.picture[0].data.toString('base64') + "" : "",
|
"url": "/ciderlocalart/" + "ciderlocal" + numid,
|
||||||
},
|
},
|
||||||
"topics": [],
|
"topics": [],
|
||||||
"url": "",
|
"url": "",
|
||||||
|
@ -1245,10 +1254,10 @@ export class BrowserWindow {
|
||||||
"albumName": metadata.common.album,
|
"albumName": metadata.common.album,
|
||||||
"artistName": metadata.common.artist,
|
"artistName": metadata.common.artist,
|
||||||
"copyright": metadata.common.copyright ?? "",
|
"copyright": metadata.common.copyright ?? "",
|
||||||
"assetUrl": "file:///" + audio,
|
"assetUrl": "file:///" +audio,
|
||||||
"contentAdvisory": "",
|
"contentAdvisory": "",
|
||||||
"releaseDateTime": "2022-05-13T00:23:00Z",
|
"releaseDateTime": "2022-05-13T00:23:00Z",
|
||||||
"durationInMilliseconds": Math.floor((metadata.format.duration ?? 0) * 1000),
|
"durationInMilliseconds": Math.floor((metadata.format.duration?? 0) * 1000),
|
||||||
|
|
||||||
"offers": [
|
"offers": [
|
||||||
{
|
{
|
||||||
|
@ -1259,7 +1268,7 @@ export class BrowserWindow {
|
||||||
"contentRating": "clean"
|
"contentRating": "clean"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
numid += 1;
|
|
||||||
|
|
||||||
// let form = {"id": "/ciderlocal?" + audio,
|
// let form = {"id": "/ciderlocal?" + audio,
|
||||||
// "type": "library-songs",
|
// "type": "library-songs",
|
||||||
|
@ -1277,9 +1286,18 @@ export class BrowserWindow {
|
||||||
// "name": metadata.common.title,
|
// "name": metadata.common.title,
|
||||||
// "albumName": metadata.common.album,
|
// "albumName": metadata.common.album,
|
||||||
// "artistName": metadata.common.artist}}
|
// "artistName": metadata.common.artist}}
|
||||||
metadatalist.push(form)
|
metadatalistart.push({
|
||||||
|
id : "ciderlocal" + numid,
|
||||||
|
url: metadata.common.picture != undefined ? metadata.common.picture[0].data.toString('base64') : "",
|
||||||
|
})
|
||||||
|
numid += 1;
|
||||||
|
metadatalist.push(form)}
|
||||||
|
} catch (e){}
|
||||||
}
|
}
|
||||||
} catch (e) { }
|
// console.log('metadatalist', metadatalist);
|
||||||
|
this.localSongs = metadatalist;
|
||||||
|
this.localSongsArts = metadatalistart;
|
||||||
|
BrowserWindow.win.webContents.send('getUpdatedLocalList', metadatalist);
|
||||||
}
|
}
|
||||||
// console.log('metadatalist', metadatalist);
|
// console.log('metadatalist', metadatalist);
|
||||||
this.localSongs = metadatalist;
|
this.localSongs = metadatalist;
|
||||||
|
|
|
@ -3500,7 +3500,15 @@ const app = new Vue({
|
||||||
console.log(truekind, id)
|
console.log(truekind, id)
|
||||||
|
|
||||||
try {
|
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)
|
console.log(item)
|
||||||
if (item && ((app.library.songs.displayListing[childIndex].id != item.id))) {
|
if (item && ((app.library.songs.displayListing[childIndex].id != item.id))) {
|
||||||
childIndex = app.library.songs.displayListing.indexOf(item)
|
childIndex = app.library.songs.displayListing.indexOf(item)
|
||||||
|
@ -3804,7 +3812,7 @@ const app = new Vue({
|
||||||
type += "s"
|
type += "s"
|
||||||
}
|
}
|
||||||
type = type.replace("library-", "")
|
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) {
|
let index = types.findIndex(function (type) {
|
||||||
return type.type == this
|
return type.type == this
|
||||||
|
|
|
@ -123,8 +123,8 @@
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.item.attributes.playParams) {
|
if (this.item.attributes.playParams) {
|
||||||
this.itemId = this.item.attributes.playParams.id ?? this.item.id;
|
this.itemId = this.item.attributes.playParams?.id ?? this.item.id;
|
||||||
this.isLibrary = this.item.attributes.playParams.isLibrary ?? false;
|
this.isLibrary = this.item.attributes.playParams?.isLibrary ?? false;
|
||||||
} else {
|
} else {
|
||||||
this.itemId = this.item.id;
|
this.itemId = this.item.id;
|
||||||
}
|
}
|
||||||
|
@ -143,6 +143,9 @@
|
||||||
return color
|
return color
|
||||||
},
|
},
|
||||||
async checkLibrary() {
|
async checkLibrary() {
|
||||||
|
if (this.item.id.startsWith('ciderlocal')){
|
||||||
|
return true
|
||||||
|
}
|
||||||
if (this.addedToLibrary) { return this.addedToLibrary }
|
if (this.addedToLibrary) { return this.addedToLibrary }
|
||||||
if (this.item.type.includes("library-playlists") || this.item.type.includes("station")) {
|
if (this.item.type.includes("library-playlists") || this.item.type.includes("station")) {
|
||||||
this.addedToLibrary = true
|
this.addedToLibrary = true
|
||||||
|
@ -155,7 +158,7 @@
|
||||||
},
|
},
|
||||||
getClasses() {
|
getClasses() {
|
||||||
this.addClasses = {}
|
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
|
this.addClasses["disabled"] = true
|
||||||
}
|
}
|
||||||
if (this.classList) {
|
if (this.classList) {
|
||||||
|
@ -167,7 +170,7 @@
|
||||||
},
|
},
|
||||||
dragStart(evt) {
|
dragStart(evt) {
|
||||||
evt.dataTransfer.setData('text/plain', JSON.stringify({
|
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
|
id: this.item.id
|
||||||
}))
|
}))
|
||||||
},
|
},
|
||||||
|
@ -183,10 +186,10 @@
|
||||||
},
|
},
|
||||||
getDataType() {
|
getDataType() {
|
||||||
if (typeof this.item.attributes.playParams != "undefined") {
|
if (typeof this.item.attributes.playParams != "undefined") {
|
||||||
if (this.item.attributes.playParams.isLibrary) {
|
if (this.item.attributes.playParams?.isLibrary) {
|
||||||
return this.item.type
|
return this.item.type
|
||||||
} else {
|
} else {
|
||||||
return this.item.attributes.playParams.kind
|
return this.item.attributes.playParams?.kind
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return this.item.type
|
return this.item.type
|
||||||
|
@ -194,8 +197,8 @@
|
||||||
},
|
},
|
||||||
select(e) {
|
select(e) {
|
||||||
let data_type = this.getDataType()
|
let data_type = this.getDataType()
|
||||||
let item_id = this.item.attributes.playParams.id ?? this.item.id
|
let item_id = this.item.attributes.playParams?.id ?? this.item.id
|
||||||
let isLibrary = this.item.attributes.playParams.isLibrary ?? false
|
let isLibrary = this.item.attributes.playParams?.isLibrary ?? false
|
||||||
|
|
||||||
if (e.shiftKey) {
|
if (e.shiftKey) {
|
||||||
if (this.index != -1) {
|
if (this.index != -1) {
|
||||||
|
@ -259,8 +262,8 @@
|
||||||
async contextMenu(event) {
|
async contextMenu(event) {
|
||||||
let self = this
|
let self = this
|
||||||
let data_type = this.getDataType()
|
let data_type = this.getDataType()
|
||||||
let item_id = this.item.attributes.playParams.id ?? this.item.id
|
let item_id = this.item.attributes.playParams?.id ?? this.item.id
|
||||||
let isLibrary = this.item.attributes.playParams.isLibrary ?? false
|
let isLibrary = this.item.attributes.playParams?.isLibrary ?? false
|
||||||
|
|
||||||
let useMenu = "normal"
|
let useMenu = "normal"
|
||||||
if (app.selectedMediaItems.length <= 1) {
|
if (app.selectedMediaItems.length <= 1) {
|
||||||
|
@ -319,6 +322,7 @@
|
||||||
app.mk.playLater({ [kind + "s"]: itemsToPlay[kind] })
|
app.mk.playLater({ [kind + "s"]: itemsToPlay[kind] })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log(itemsToPlay)
|
||||||
app.selectedMediaItems = []
|
app.selectedMediaItems = []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -400,7 +404,9 @@
|
||||||
"name": app.getLz('action.playNext'),
|
"name": app.getLz('action.playNext'),
|
||||||
"icon": "./assets/arrow-bend-up.svg",
|
"icon": "./assets/arrow-bend-up.svg",
|
||||||
"action": function () {
|
"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.mk.queue._reindex()
|
||||||
app.selectedMediaItems = []
|
app.selectedMediaItems = []
|
||||||
}
|
}
|
||||||
|
@ -409,7 +415,9 @@
|
||||||
"name": app.getLz('action.playLater'),
|
"name": app.getLz('action.playLater'),
|
||||||
"icon": "./assets/arrow-bend-down.svg",
|
"icon": "./assets/arrow-bend-down.svg",
|
||||||
"action": function () {
|
"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.mk.queue._reindex()
|
||||||
app.selectedMediaItems = []
|
app.selectedMediaItems = []
|
||||||
}
|
}
|
||||||
|
@ -418,7 +426,7 @@
|
||||||
"icon": "./assets/feather/radio.svg",
|
"icon": "./assets/feather/radio.svg",
|
||||||
"name": app.getLz('action.startRadio'),
|
"name": app.getLz('action.startRadio'),
|
||||||
"action": function () {
|
"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.mk.play()
|
||||||
app.selectedMediaItems = []
|
app.selectedMediaItems = []
|
||||||
})
|
})
|
||||||
|
@ -444,7 +452,7 @@
|
||||||
"action": function () {
|
"action": function () {
|
||||||
if (!self.item.attributes.url && self.item.relationships) {
|
if (!self.item.attributes.url && self.item.relationships) {
|
||||||
if (self.item.relationships.catalog) {
|
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 {
|
} else {
|
||||||
self.app.copyToClipboard(self.item.attributes.url)
|
self.app.copyToClipboard(self.item.attributes.url)
|
||||||
|
@ -457,7 +465,7 @@
|
||||||
"action": function () {
|
"action": function () {
|
||||||
if (!self.item.attributes.url && self.item.relationships) {
|
if (!self.item.attributes.url && self.item.relationships) {
|
||||||
if (self.item.relationships.catalog) {
|
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 {
|
} else {
|
||||||
self.app.songLinkShare(self.item.attributes.url)
|
self.app.songLinkShare(self.item.attributes.url)
|
||||||
|
@ -526,9 +534,9 @@
|
||||||
},
|
},
|
||||||
addToLibrary() {
|
addToLibrary() {
|
||||||
let item = this.item
|
let item = this.item
|
||||||
if (item.attributes.playParams.id) {
|
if (item.attributes.playParams?.id) {
|
||||||
console.log('adding to library', item.attributes.playParams.id)
|
console.log('adding to library', item.attributes.playParams?.id)
|
||||||
app.addToLibrary(item.attributes.playParams.id.toString())
|
app.addToLibrary(item.attributes.playParams?.id.toString())
|
||||||
this.addedToLibrary = true
|
this.addedToLibrary = true
|
||||||
} else if (item.id) {
|
} else if (item.id) {
|
||||||
console.log('adding to library', item.id)
|
console.log('adding to library', item.id)
|
||||||
|
@ -539,14 +547,14 @@
|
||||||
async removeFromLibrary() {
|
async removeFromLibrary() {
|
||||||
let item = this.item
|
let item = this.item
|
||||||
let params = { "fields[songs]": "inLibrary", "fields[albums]": "inLibrary", "relate": "library" }
|
let params = { "fields[songs]": "inLibrary", "fields[albums]": "inLibrary", "relate": "library" }
|
||||||
let id = item.id ?? item.attributes.playParams.id
|
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 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) {
|
if (res && res.relationships && res.relationships.library && res.relationships.library.data && res.relationships.library.data.length > 0) {
|
||||||
id = res.relationships.library.data[0].id
|
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;
|
let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
|
||||||
if (item.attributes.playParams.id) {
|
if (item.attributes.playParams?.id) {
|
||||||
console.log('remove from library', id)
|
console.log('remove from library', id)
|
||||||
app.removeFromLibrary(truekind, id)
|
app.removeFromLibrary(truekind, id)
|
||||||
this.addedToLibrary = false
|
this.addedToLibrary = false
|
||||||
|
@ -560,9 +568,9 @@
|
||||||
let item = this.item
|
let item = this.item
|
||||||
let parent = this.parent
|
let parent = this.parent
|
||||||
let childIndex = this.index
|
let childIndex = this.index
|
||||||
let kind = (item.attributes.playParams ? (item.attributes.playParams.kind ?? (item.type ?? '')) : (item.type ?? ''));
|
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 id = (item.attributes.playParams ? (item.attributes.playParams?.id ?? (item.id ?? '')) : (item.id ?? ''));;
|
||||||
let isLibrary = item.attributes.playParams ? (item.attributes.playParams.isLibrary ?? false) : false;
|
let isLibrary = item.attributes.playParams ? (item.attributes.playParams?.isLibrary ?? false) : false;
|
||||||
let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
|
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"))
|
console.log(item, parent, childIndex, kind, id, isLibrary, kind == "playlists", id.startsWith("p.") || id.startsWith("pl.u"))
|
||||||
app.mk.stop().then(() => {
|
app.mk.stop().then(() => {
|
||||||
|
@ -578,7 +586,7 @@
|
||||||
array[j] = temp;
|
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 () {
|
app.mk.play().then(function () {
|
||||||
var playlistId = id
|
var playlistId = id
|
||||||
function getPlaylist(id, isLibrary) {
|
function getPlaylist(id, isLibrary) {
|
||||||
|
@ -624,12 +632,12 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
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() {
|
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')) {
|
if (kind.toLowerCase().includes('album') || kind.toLowerCase().includes('playlist')) {
|
||||||
app.routeView(this.item)
|
app.routeView(this.item)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -207,7 +207,44 @@
|
||||||
openPlaylist(item) {
|
openPlaylist(item) {
|
||||||
this.$root.appRoute(`playlist_` + item.id);
|
this.$root.appRoute(`playlist_` + item.id);
|
||||||
this.$root.showingPlaylist = [];
|
this.$root.showingPlaylist = [];
|
||||||
|
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)
|
this.$root.getPlaylistFromID(this.$root.page.substring(9), true)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getPlaylistChildren(item) {
|
getPlaylistChildren(item) {
|
||||||
let self = this
|
let self = this
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
@click="openInfoModal()"></div>
|
@click="openInfoModal()"></div>
|
||||||
<div v-else-if="((data.attributes.description?.standard ?? data.attributes.editorialNotes?.standard) != null) && (descriptionEditing == false)"
|
<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) +'...'"
|
@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)"
|
<div v-else-if="((data.attributes.description?.standard ?? data.attributes.editorialNotes?.standard) != null) && (descriptionEditing)"
|
||||||
@mouseover="minClass(false)"><input type="text"
|
@mouseover="minClass(false)"><input type="text"
|
||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
|
@ -195,7 +195,7 @@
|
||||||
<template v-if="!hasNestedPlaylist">
|
<template v-if="!hasNestedPlaylist">
|
||||||
<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 displayListing"></mediaitem-list-item>
|
v-for="(item,index) in displayListing"></mediaitem-list-item>
|
||||||
</template>
|
</template>
|
||||||
|
@ -207,7 +207,7 @@
|
||||||
<mediaitem-list-item :item="item" :parent="getItemParent(data)"
|
<mediaitem-list-item :item="item" :parent="getItemParent(data)"
|
||||||
:index="index"
|
: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 disc.tracks"></mediaitem-list-item>
|
v-for="(item,index) in disc.tracks"></mediaitem-list-item>
|
||||||
</div>
|
</div>
|
||||||
|
@ -305,17 +305,24 @@
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
this.$nextTick(function () {
|
this.$nextTick(function () {
|
||||||
|
if (this.data.id != "ciderlocal") {
|
||||||
this.isInLibrary()
|
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() {
|
beforeMount() {
|
||||||
if( window.location.hash.includes("playlist") ) {
|
if (window.location.hash.includes("playlist")) {
|
||||||
window.addEventListener('keydown', this.getCopiedPlayListSongs);
|
window.addEventListener('keydown', this.getCopiedPlayListSongs);
|
||||||
window.addEventListener('keydown', this.pasteSongs);
|
window.addEventListener('keydown', this.pasteSongs);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
if( window.location.hash.includes("playlist") ) {
|
if (window.location.hash.includes("playlist")) {
|
||||||
window.removeEventListener('keydown', this.getCopiedPlayListSongs);
|
window.removeEventListener('keydown', this.getCopiedPlayListSongs);
|
||||||
window.removeEventListener('keydown', this.pasteSongs);
|
window.removeEventListener('keydown', this.pasteSongs);
|
||||||
}
|
}
|
||||||
|
@ -326,12 +333,16 @@
|
||||||
this.isInLibrary()
|
this.isInLibrary()
|
||||||
this.getBadges()
|
this.getBadges()
|
||||||
|
|
||||||
if (this.data.relationships) {
|
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)
|
this.generateNestedPlaylist(this.data.relationships.tracks.data)
|
||||||
if (!this.hasNestedPlaylist) {
|
if (!this.hasNestedPlaylist) {
|
||||||
this.displayListing = this.data.relationships.tracks.data
|
this.displayListing = this.data.relationships.tracks.data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.inPlaylist = this.data.type == "library-playlists";
|
this.inPlaylist = this.data.type == "library-playlists";
|
||||||
},
|
},
|
||||||
|
@ -382,21 +393,21 @@
|
||||||
this.headerVisible = visible
|
this.headerVisible = visible
|
||||||
},
|
},
|
||||||
hasHero() {
|
hasHero() {
|
||||||
if(this.data.attributes?.editorialArtwork?.bannerUber){
|
if (this.data.attributes?.editorialArtwork?.bannerUber) {
|
||||||
return this.data.attributes?.editorialArtwork?.bannerUber.url
|
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
|
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 this.data.attributes?.editorialArtwork?.storeFlowcase.url
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
hasHeroObject() {
|
hasHeroObject() {
|
||||||
if(this.data.attributes?.editorialArtwork?.bannerUber){
|
if (this.data.attributes?.editorialArtwork?.bannerUber) {
|
||||||
return 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
|
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 this.data.attributes?.editorialArtwork?.storeFlowcase
|
||||||
}
|
}
|
||||||
return [];
|
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")
|
//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")
|
//console.log("1")
|
||||||
|
if (kind == "podcast-episodes") {kind = "episode"}
|
||||||
const truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
|
const truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
|
||||||
|
|
||||||
let query = (this.data ?? app.showingPlaylist).relationships.tracks.data.map(item => new MusicKit.MediaItem(item));
|
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.setQueue({ [truekind]: [id], parameters: { l: app.mklang } }).then(function () {
|
||||||
app.mk.play().then(function () {
|
app.mk.play().then(function () {
|
||||||
if (query.length > 100) {
|
if (query.length > 100) {
|
||||||
|
@ -792,7 +806,12 @@
|
||||||
app.mk.queue.append(u)
|
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";
|
return "d-none";
|
||||||
},
|
},
|
||||||
async getCopiedPlayListSongs(event) {
|
async getCopiedPlayListSongs(event) {
|
||||||
if( event.ctrlKey && event.keyCode === 67 ) {
|
if (event.ctrlKey && event.keyCode === 67) {
|
||||||
let urls = [];
|
let urls = [];
|
||||||
app.selectedMediaItems.forEach(item => {
|
app.selectedMediaItems.forEach(item => {
|
||||||
this.app.mk.api.v3.music(`/v1/me/library/songs/${item.id}`).then((response) => {
|
this.app.mk.api.v3.music(`/v1/me/library/songs/${item.id}`).then((response) => {
|
||||||
|
@ -816,14 +835,14 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async pasteSongs(event) {
|
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 clipboard = await navigator.clipboard.readText()
|
||||||
let songs = []
|
let songs = []
|
||||||
|
|
||||||
clipboard = clipboard.split(",")
|
clipboard = clipboard.split(",")
|
||||||
clipboard.forEach(item => {
|
clipboard.forEach(item => {
|
||||||
songs.push({
|
songs.push({
|
||||||
id: item.substring(item.indexOf("i=")+2, item.length),
|
id: item.substring(item.indexOf("i=") + 2, item.length),
|
||||||
type: "songs",
|
type: "songs",
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue