diff --git a/package.json b/package.json index bc85142f..ab00ee7a 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,7 @@ "run-script-os": "^1.1.6", "source-map-support": "^0.5.21", "ts-md5": "1.2.11", + "upnp-mediarenderer-client": "github:vapormusic/node-upnp-mediarenderer-client", "v8-compile-cache": "^2.3.0", "wallpaper": "5.0.1", "ws": "^8.8.1", @@ -78,9 +79,9 @@ "@types/adm-zip": "^0.5.0", "@types/discord-rpc": "4.0.3", "@types/express": "^4.17.13", + "@types/node": "^18.7.13", "@types/qrcode-terminal": "^0.12.0", "@types/ws": "^8.5.3", - "@types/node": "^18.7.13", "electron": "git+https://github.com/castlabs/electron-releases.git", "electron-builder": "^23.0.2", "electron-builder-notarize-pkg": "^1.2.0", diff --git a/src/main/plugins/chromecast.ts b/src/main/plugins/chromecast.ts index 4ef8c02c..fa709e06 100644 --- a/src/main/plugins/chromecast.ts +++ b/src/main/plugins/chromecast.ts @@ -2,6 +2,7 @@ import * as electron from "electron"; import * as os from "os"; import { resolve } from "path"; import * as CiderReceiver from "../base/castreceiver"; +const MediaRendererClient = require('upnp-mediarenderer-client') export default class ChromecastPlugin { /** @@ -14,6 +15,7 @@ export default class ChromecastPlugin { private _timer: any; private audioClient = require("castv2-client").Client; private mdns = require("mdns-js"); + private devices: any = []; private castDevices: any = []; @@ -67,19 +69,17 @@ export default class ChromecastPlugin { ssdpBrowser.search("urn:dial-multiscreen-org:device:dial:1"); - // // actual upnp devices - // if (app.cfg.get("audio.enableDLNA")) { - // let ssdpBrowser2 = new Client(); - // ssdpBrowser2.on('response', (headers, statusCode, rinfo) => { - // var location = getLocation(headers); - // if (location != null) { - // this.getServiceDescription(location, rinfo.address); - // } + // actual upnp devices + let ssdpBrowser2 = new Client(); + ssdpBrowser2.on('response', (headers: any, statusCode: any, rinfo: any) => { + var location = getLocation(headers); + if (location != null) { + this.getServiceDescription(location, rinfo.address); + } - // }); - // ssdpBrowser2.search('urn:schemas-upnp-org:device:MediaRenderer:1'); + }); + ssdpBrowser2.search('urn:schemas-upnp-org:device:MediaRenderer:1'); - // } } catch (e) { console.log("Search GC err", e); } @@ -257,26 +257,26 @@ export default class ChromecastPlugin { }); } else { // upnp devices - //try { - // client = new MediaRendererClient(UPNPDesc); - // const options = { - // autoplay: true, - // contentType: 'audio/x-wav', - // dlnaFeatures: 'DLNA.ORG_PN=-;DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01700000000000000000000000000000', - // metadata: { - // title: 'Apple Music Electron', - // creator: 'Streaming ...', - // type: 'audio', // can be 'video', 'audio' or 'image' - // // url: 'http://' + getIp() + ':' + server.address().port + '/', - // // protocolInfo: 'DLNA.ORG_PN=MP3;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000; - // } - // }; - // client.load('http://' + getIp() + ':' + server.address().port + '/a.wav', options, function (err, _result) { - // if (err) throw err; - // console.log('playing ...'); - // }); - // } catch (e) { - // } + try { + let client = new MediaRendererClient(UPNPDesc); + const options = { + autoplay: true, + contentType: 'audio/x-wav', + dlnaFeatures: 'DLNA.ORG_PN=-;DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01700000000000000000000000000000', + metadata: { + title: 'Cider', + creator: 'Streaming ...', + type: 'audio', // can be 'video', 'audio' or 'image' + // url: 'http://' + getIp() + ':' + server.address().port + '/', + // protocolInfo: 'DLNA.ORG_PN=MP3;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000; + } + }; + client.load('http://' + this.getIp() + ':' + this.ciderPort + '/audio.wav', options, function (err: any, _result: any) { + if (err) throw err; + console.log('playing ...'); + }); + } catch (e) { + } } } diff --git a/src/main/plugins/raop.ts b/src/main/plugins/raop.ts index d9ab814f..2bdb51d3 100644 --- a/src/main/plugins/raop.ts +++ b/src/main/plugins/raop.ts @@ -216,7 +216,7 @@ export default class RAOP { password: sepassword, txt: txt, airplay2: airplay2dv, - debug: true, + debug: null, }); // console.log('lol',txt) this.device.on("status", (status: any) => { diff --git a/src/renderer/main/vueapp.js b/src/renderer/main/vueapp.js index ca0b9509..175c1f5d 100644 --- a/src/renderer/main/vueapp.js +++ b/src/renderer/main/vueapp.js @@ -2007,9 +2007,10 @@ const app = new Vue({ include: "grouping,playlists", extend: "editorialArtwork", "art[url]": "f", - }); + }).then(() => { + kind = "appleCurator"; window.location.hash = `${kind}/${id}`; - document.querySelector("#app-content").scrollTop = 0; + document.querySelector("#app-content").scrollTop = 0}); } else if (kind == "editorial-elements" || kind == "editorial-items") { console.debug(item); if (item.relationships?.contents?.data != null && item.relationships?.contents?.data.length > 0) { @@ -4022,6 +4023,7 @@ const app = new Vue({ } }, getMediaItemArtwork(url, height = 64, width) { + try { if (typeof url == "undefined" || url == "") { return "./assets/MissingArtwork.svg"; } @@ -4029,7 +4031,7 @@ const app = new Vue({ if (width) { width = parseInt(width * window.devicePixelRatio); } - let newurl = `${url + let newurl = `${(url ?? "") .replace("{w}", width ?? height) .replace("{h}", height) .replace("{f}", "webp") @@ -4038,7 +4040,11 @@ const app = new Vue({ if (newurl.includes("900x516")) { newurl = newurl.replace("900x516cc", "900x516sr").replace("900x516bb", "900x516sr"); } - return newurl; + return newurl;} + catch (e) { + console.log(url) + return "./assets/MissingArtwork.svg" + } }, _rgbToRgb(rgb = [0, 0, 0]) { // if rgb diff --git a/src/renderer/views/components/mediaitem-mvview-sp.ejs b/src/renderer/views/components/mediaitem-mvview-sp.ejs index ea0bc5aa..5ec81176 100644 --- a/src/renderer/views/components/mediaitem-mvview-sp.ejs +++ b/src/renderer/views/components/mediaitem-mvview-sp.ejs @@ -15,7 +15,7 @@