Giter VIP home page Giter VIP logo

Comments (3)

foxthefox avatar foxthefox commented on July 18, 2024

Leider hat die Yamaha API kein Interface ähnlich text2speech wie es bei Sonos geht. Ideen hatte ich da schon, aber es braucht umfangreiches (reverse)-engineering.

from iobroker.musiccast.

foxthefox avatar foxthefox commented on July 18, 2024

Es geht evtl. doch wenn es einen DLNA Server im Netzwerk gibt. Dann kann man sich durch die Verzeichnisse hangeln und dann eine Datei abspielen. Sehr umständlich, aber geht.
Arbeite gerade an einer simplen Implementierung.

Mir schwebt eher ein Befehl playFile=datei.mp3 vor, aber da sind wir weit entfernt.

from iobroker.musiccast.

foxthefox avatar foxthefox commented on July 18, 2024

Also es geht mit etwas scripting und nodejs8.

Zuvor ist über Browser zu ermitteln welchen Index man jeweils zum erreichen des mp3 benötigt.

Dazu die folgenden Befehle benutzen:

am Anfang dies nur 1x

http://IP/YamahaExtendedControl/v1/main/setInput?input=server&mode=autoplay_disabled

zum Anfang mit index 0 und später mit anderem index, zur Auswahl der nächsten Stufe

http://IP/YamahaExtendedControl/v1/netusb/setListControl?list_id=main&type=select&index=0

zur Anzeige des Verzeichnisses mit dem index, den man gerade gewählt hat

http://IP/YamahaExtendedControl/v1/netusb/getListInfo?input=server&index=0&size=8&lang=de

zum Abspielen des Songs mit dem entsprechenden Index

http://IP/YamahaExtendedControl/v1/netusb/setListControl?list_id=main&type=play&index=0

In meinem Fall ist es 5mal der select Aufruf und dann der Song ->0,0,0,0,0,0

var YamahaYXC = require('yamaha-yxc-nodejs');
yamaha = new YamahaYXC('IP'); //deine IP

var cmd = [0,0,0,0,0,0]; // hier die Abfolge aus dem vorherigen Test eintragen
var file = cmd.pop();

function setDisable() {
return new Promise(resolve => {
yamaha.setInput('server','main','autoplay_disabled').then(function (result) {
if (JSON.parse(result).response_code === 0) {
console.log('disable success ' + result);
resolve();
}
else { console.log('set disable bad '+result); }
resolve();
});
});
}

function listDir(index) {
return new Promise(resolve => {
yamaha.getListInfo('server', index, '8', 'en').then(function (result) {
if (JSON.parse(result).response_code === 0) {
console.log('list dir success '+index + result);
}
else { console.log('listDir bad ' + result); }
resolve();
});
});
}

function changeDir(index){
return new Promise(resolve => {
yamaha.setListControl('main','select',index).then(function(result) {
if (JSON.parse(result).response_code === 0 ){
console.log('dir change success ' +index+ result);
}
else {console.log('dir change bad '+ result);}
resolve();
});
})
}

function playFile(song){
return new Promise(resolve => {
yamaha.setListControl('main','play',song).then(function(result) {
if (JSON.parse(result).response_code === 0 ){
console.log('play file success' + song + result);
resolve();
}
else {console.log('playFile bad' + result);}
resolve();
});
});
}

function backToStart(cmd){
return new Promise(resolve => {
yamaha.setListControl('main','return').then(function(result) {
if (JSON.parse(result).response_code === 0 ){
console.log('rezurn success' + result);
}
else {console.log('return gone bad' + result);}
resolve();
});
});
}

async function playSong() {
await setDisable();
for(item in cmd){
if(item === 0){await listDir(0)}
else{await listDir(cmd[item-1]);}
await changeDir(cmd[item]);
if(item === cmd.length){}
else{await listDir(cmd[item]);}
}
await playFile(file);
}

playSong();

from iobroker.musiccast.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.