add dlna and ui fixes

This commit is contained in:
vapormusic 2022-08-31 17:43:57 +07:00
parent d5ade09aa7
commit a023bd619c
10 changed files with 64 additions and 46 deletions

View file

@ -68,6 +68,7 @@
"run-script-os": "^1.1.6", "run-script-os": "^1.1.6",
"source-map-support": "^0.5.21", "source-map-support": "^0.5.21",
"ts-md5": "1.2.11", "ts-md5": "1.2.11",
"upnp-mediarenderer-client": "github:vapormusic/node-upnp-mediarenderer-client",
"v8-compile-cache": "^2.3.0", "v8-compile-cache": "^2.3.0",
"wallpaper": "5.0.1", "wallpaper": "5.0.1",
"ws": "^8.8.1", "ws": "^8.8.1",
@ -78,9 +79,9 @@
"@types/adm-zip": "^0.5.0", "@types/adm-zip": "^0.5.0",
"@types/discord-rpc": "4.0.3", "@types/discord-rpc": "4.0.3",
"@types/express": "^4.17.13", "@types/express": "^4.17.13",
"@types/node": "^18.7.13",
"@types/qrcode-terminal": "^0.12.0", "@types/qrcode-terminal": "^0.12.0",
"@types/ws": "^8.5.3", "@types/ws": "^8.5.3",
"@types/node": "^18.7.13",
"electron": "git+https://github.com/castlabs/electron-releases.git", "electron": "git+https://github.com/castlabs/electron-releases.git",
"electron-builder": "^23.0.2", "electron-builder": "^23.0.2",
"electron-builder-notarize-pkg": "^1.2.0", "electron-builder-notarize-pkg": "^1.2.0",

View file

@ -2,6 +2,7 @@ import * as electron from "electron";
import * as os from "os"; import * as os from "os";
import { resolve } from "path"; import { resolve } from "path";
import * as CiderReceiver from "../base/castreceiver"; import * as CiderReceiver from "../base/castreceiver";
const MediaRendererClient = require('upnp-mediarenderer-client')
export default class ChromecastPlugin { export default class ChromecastPlugin {
/** /**
@ -14,6 +15,7 @@ export default class ChromecastPlugin {
private _timer: any; private _timer: any;
private audioClient = require("castv2-client").Client; private audioClient = require("castv2-client").Client;
private mdns = require("mdns-js"); private mdns = require("mdns-js");
private devices: any = []; private devices: any = [];
private castDevices: any = []; private castDevices: any = [];
@ -67,19 +69,17 @@ export default class ChromecastPlugin {
ssdpBrowser.search("urn:dial-multiscreen-org:device:dial:1"); ssdpBrowser.search("urn:dial-multiscreen-org:device:dial:1");
// // actual upnp devices // actual upnp devices
// if (app.cfg.get("audio.enableDLNA")) { let ssdpBrowser2 = new Client();
// let ssdpBrowser2 = new Client(); ssdpBrowser2.on('response', (headers: any, statusCode: any, rinfo: any) => {
// ssdpBrowser2.on('response', (headers, statusCode, rinfo) => { var location = getLocation(headers);
// var location = getLocation(headers); if (location != null) {
// if (location != null) { this.getServiceDescription(location, rinfo.address);
// 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) { } catch (e) {
console.log("Search GC err", e); console.log("Search GC err", e);
} }
@ -257,26 +257,26 @@ export default class ChromecastPlugin {
}); });
} else { } else {
// upnp devices // upnp devices
//try { try {
// client = new MediaRendererClient(UPNPDesc); let client = new MediaRendererClient(UPNPDesc);
// const options = { const options = {
// autoplay: true, autoplay: true,
// contentType: 'audio/x-wav', contentType: 'audio/x-wav',
// dlnaFeatures: 'DLNA.ORG_PN=-;DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01700000000000000000000000000000', dlnaFeatures: 'DLNA.ORG_PN=-;DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01700000000000000000000000000000',
// metadata: { metadata: {
// title: 'Apple Music Electron', title: 'Cider',
// creator: 'Streaming ...', creator: 'Streaming ...',
// type: 'audio', // can be 'video', 'audio' or 'image' type: 'audio', // can be 'video', 'audio' or 'image'
// // url: 'http://' + getIp() + ':' + server.address().port + '/', // url: 'http://' + getIp() + ':' + server.address().port + '/',
// // protocolInfo: 'DLNA.ORG_PN=MP3;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000; // 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) { client.load('http://' + this.getIp() + ':' + this.ciderPort + '/audio.wav', options, function (err: any, _result: any) {
// if (err) throw err; if (err) throw err;
// console.log('playing ...'); console.log('playing ...');
// }); });
// } catch (e) { } catch (e) {
// } }
} }
} }

View file

@ -216,7 +216,7 @@ export default class RAOP {
password: sepassword, password: sepassword,
txt: txt, txt: txt,
airplay2: airplay2dv, airplay2: airplay2dv,
debug: true, debug: null,
}); });
// console.log('lol',txt) // console.log('lol',txt)
this.device.on("status", (status: any) => { this.device.on("status", (status: any) => {

View file

@ -2007,9 +2007,10 @@ const app = new Vue({
include: "grouping,playlists", include: "grouping,playlists",
extend: "editorialArtwork", extend: "editorialArtwork",
"art[url]": "f", "art[url]": "f",
}); }).then(() => {
kind = "appleCurator";
window.location.hash = `${kind}/${id}`; 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") { } else if (kind == "editorial-elements" || kind == "editorial-items") {
console.debug(item); console.debug(item);
if (item.relationships?.contents?.data != null && item.relationships?.contents?.data.length > 0) { 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) { getMediaItemArtwork(url, height = 64, width) {
try {
if (typeof url == "undefined" || url == "") { if (typeof url == "undefined" || url == "") {
return "./assets/MissingArtwork.svg"; return "./assets/MissingArtwork.svg";
} }
@ -4029,7 +4031,7 @@ const app = new Vue({
if (width) { if (width) {
width = parseInt(width * window.devicePixelRatio); width = parseInt(width * window.devicePixelRatio);
} }
let newurl = `${url let newurl = `${(url ?? "")
.replace("{w}", width ?? height) .replace("{w}", width ?? height)
.replace("{h}", height) .replace("{h}", height)
.replace("{f}", "webp") .replace("{f}", "webp")
@ -4038,7 +4040,11 @@ const app = new Vue({
if (newurl.includes("900x516")) { if (newurl.includes("900x516")) {
newurl = newurl.replace("900x516cc", "900x516sr").replace("900x516bb", "900x516sr"); 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]) { _rgbToRgb(rgb = [0, 0, 0]) {
// if rgb // if rgb

View file

@ -15,7 +15,7 @@
</div> </div>
<div class="artwork"> <div class="artwork">
<mediaitem-artwork <mediaitem-artwork
:url="item.attributes?.editorialArtwork.subscriptionHero.url ?? item.attributes?.artwork" :url="item.attributes?.editorialArtwork?.subscriptionHero?.url ?? item.attributes?.artwork?.url"
:video="(item.attributes != null && item.attributes?.editorialVideo != null) ? (item.attributes?.editorialVideo?.motionDetailSquare ? item.attributes?.editorialVideo?.motionDetailSquare?.video : (item.attributes?.editorialVideo?.motionSquareVideo1x1 ? item?.attributes?.editorialVideo?.motionSquareVideo1x1?.video : '')) : '' " :video="(item.attributes != null && item.attributes?.editorialVideo != null) ? (item.attributes?.editorialVideo?.motionDetailSquare ? item.attributes?.editorialVideo?.motionDetailSquare?.video : (item.attributes?.editorialVideo?.motionSquareVideo1x1 ? item?.attributes?.editorialVideo?.motionSquareVideo1x1?.video : '')) : '' "
:size="516" :width="900" :size="516" :width="900"
></mediaitem-artwork> ></mediaitem-artwork>

View file

@ -45,9 +45,9 @@
<div class="title" <div class="title"
:title="item.attributes?.name ?? (item.relationships?.contents?.data[0]?.attributes?.name ?? (item.attributes?.editorialNotes?.name ?? ''))" :title="item.attributes?.name ?? (item.relationships?.contents?.data[0]?.attributes?.name ?? (item.attributes?.editorialNotes?.name ?? ''))"
v-if="item.attributes.artistNames == null || kind != 'card'" @click='app.routeView(item)'> v-if="item.attributes.artistNames == null || kind != 'card'" @click='app.routeView(item)'>
<div class="item-navigate text-overflow-elipsis">{{ item.attributes?.name.replace(/&nbsp;/g, ' ').replace(/Apple Music |^Apple |/g, '') ?? <div class="item-navigate text-overflow-elipsis">{{ (item.attributes?.editorialElementKind == "394" && item.relationships?.contents?.data[0]?.attributes?.shortName != null ) ? item.relationships?.contents?.data[0]?.attributes?.shortName : (item.attributes?.name ? ((removeamtext ) ? item.attributes?.name.replace(/&nbsp;/g, ' ').replace(/Apple Music |^Apple |/g, '') : item.attributes?.name.replace(/&nbsp;/g, ' ')) :
(item.relationships?.contents?.data[0]?.attributes?.name ?? (item.relationships?.contents?.data[0]?.attributes?.name ??
(item.attributes?.editorialNotes?.name ?? '')) }} (item.attributes?.editorialNotes?.name ?? ''))) }}
</div> </div>
<div class="explicit-icon" v-if="item.attributes && item.attributes.contentRating == 'explicit'" <div class="explicit-icon" v-if="item.attributes && item.attributes.contentRating == 'explicit'"
style="background-image: url(./assets/explicit.svg);height: 12px;width: 12px;filter: contrast(0);background-repeat: no-repeat;margin-top: 2.63px;margin-left: 4px;"></div> style="background-image: url(./assets/explicit.svg);height: 12px;width: 12px;filter: contrast(0);background-repeat: no-repeat;margin-top: 2.63px;margin-left: 4px;"></div>
@ -98,6 +98,11 @@ Vue.component('mediaitem-square', {
default: 'cc', default: 'cc',
required: false required: false
}, },
removeamtext: {
type: Boolean,
default: false,
required: false
},
'contextExt': { type: Object, required: false }, 'contextExt': { type: Object, required: false },
}, },
data: function () { data: function () {

View file

@ -1,6 +1,6 @@
<script type="text/x-template" id="cider-applecurator"> <script type="text/x-template" id="cider-applecurator">
<div class="content-inner"> <div class="content-inner">
<h1 class="header-text">{{ data.attributes.shortName ?? data.attributes.name}}</h1> <h1 class="header-text">{{ data.attributes?.shortName ?? data.attributes.name}}</h1>
<template v-if="data.relationships && data.relationships.grouping"> <template v-if="data.relationships && data.relationships.grouping">
<template <template
v-for="(recom,index) in data.relationships.grouping.data[0].relationships.tabs.data[0].relationships.children.data"> v-for="(recom,index) in data.relationships.grouping.data[0].relationships.tabs.data[0].relationships.children.data">
@ -43,6 +43,9 @@
return { return {
app: this.$root app: this.$root
} }
} },
mounted() {
console.log('ping')
},
}) })
</script> </script>

View file

@ -142,10 +142,10 @@
</div> </div>
</div> </div>
<div class="categories"> <div class="categories">
<mediaitem-square :kind="'385'" :imageformat="'bb'" size="600" <mediaitem-square :kind="'385'" :imageformat="'bb'" size="600" :removeamtext="true"
:item="item ? (item.attributes.kind ? item : ((item.relationships && item.relationships.contents ) ? item.relationships.contents.data[0] : item)) : []" :item="item ? (item.attributes.kind ? item : ((item.relationships && item.relationships.contents ) ? item.relationships.contents.data[0] : item)) : []"
:imagesize="800" :imagesize="800"
v-for="item of getFlattenedCategories()"> v-for="item of getFlattenedCategories()"/>
</div> </div>
</div> </div>
</div> </div>

View file

@ -86,6 +86,7 @@
this.isVisible = isVisible this.isVisible = isVisible
}, },
getMediaItemArtwork(url, height = 64, width) { getMediaItemArtwork(url, height = 64, width) {
try{
if (typeof url == "undefined" || url == "") { if (typeof url == "undefined" || url == "") {
return "./assets/MissingArtwork.svg" return "./assets/MissingArtwork.svg"
} }
@ -98,7 +99,9 @@
if (newurl.includes("900x516")) { if (newurl.includes("900x516")) {
newurl = newurl.replace("900x516cc", "900x516sr").replace("900x516bb", "900x516sr"); newurl = newurl.replace("900x516cc", "900x516sr").replace("900x516bb", "900x516sr");
} }
return newurl return newurl} catch (e){
return "./assets/MissingArtwork.svg"
}
}, },
} }
}); });

View file

@ -213,7 +213,7 @@
} }
switch (this.kind) { switch (this.kind) {
case "385": case "385":
artwork = this.item.attributes.editorialArtwork.subscriptionHero.url artwork = this.item.attributes?.editorialArtwork?.subscriptionHero?.url
break; break;
} }
if (!includeUrl) { if (!includeUrl) {