chore: Prettified Code
[ci skip]
This commit is contained in:
parent
4c3ace12de
commit
4b2513330c
1 changed files with 15 additions and 16 deletions
|
@ -90,16 +90,17 @@ export default class RAOP {
|
|||
private ondeviceup(name: any, host: any, port: any, addresses: any, text: any, airplay2: any = null) {
|
||||
// console.log(this.castDevices.findIndex((item: any) => {return (item.name == host.replace(".local","") && item.port == port )}))
|
||||
|
||||
let d = ""
|
||||
let audiook = true
|
||||
let d = "";
|
||||
let audiook = true;
|
||||
try {
|
||||
d = text.filter((u: any) => String(u).startsWith('features='))
|
||||
if(d.length == 0) d = text.filter((u: any) => String(u).startsWith('ft='))
|
||||
let features_set = d.length > 0 ? d[0].substring(d[0].indexOf("=")+1).split(',') : []
|
||||
let features = [... features_set.length > 0 ? parseInt(features_set[0]).toString(2).split('') : [], ... features_set.length > 1 ? parseInt(features_set[1]).toString(2).split('') : []]
|
||||
d = text.filter((u: any) => String(u).startsWith("features="));
|
||||
if (d.length == 0) d = text.filter((u: any) => String(u).startsWith("ft="));
|
||||
let features_set = d.length > 0 ? d[0].substring(d[0].indexOf("=") + 1).split(",") : [];
|
||||
let features = [...(features_set.length > 0 ? parseInt(features_set[0]).toString(2).split("") : []), ...(features_set.length > 1 ? parseInt(features_set[1]).toString(2).split("") : [])];
|
||||
if (features.length > 0) {
|
||||
audiook = (features[features.length - 1 - 9] == '1')
|
||||
}} catch (_){}
|
||||
audiook = features[features.length - 1 - 9] == "1";
|
||||
}
|
||||
} catch (_) {}
|
||||
if (audiook) {
|
||||
let shown_name = name;
|
||||
try {
|
||||
|
@ -138,7 +139,8 @@ export default class RAOP {
|
|||
} else {
|
||||
this._win.webContents.executeJavaScript(`console.log('deviceFound (added)','ip: ${host_name} name:${shown_name}')`).catch((err: any) => console.error(err));
|
||||
console.log("deviceFound (added)", host_name, shown_name);
|
||||
}}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -511,7 +513,4 @@ export default class RAOP {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue