ich habe ein par Scripts für die Ansteuerung der BOSE SoundTouch geschrieben die ich euch zur Verfügung stellen möchte.
Vorbereitungen:
* CUxD muss auf der CCU installiert sein
* Ihr müst die Adresse von CUxD wissen
* Ihr müsst die IP Adresse des BOSE SoundTouch wissen
Hier nun die Scripts zur BOSE SoundTouch Ansteuerung:
1. SoundTouch Ausschalten/Standby
Code: Alles auswählen
!Soundtouch IP setzen
string ST_Ip ="192.168.1.100";
!Überprüfung ob Soundtuch bereits in STANDBY ist
var url="http://" # ST_Ip #":8090/now_playing";
var cmd = "/usr/local/addons/cuxd/curl -s -k -L " # url ;
dom.GetObject("CUxD.CUX2801001:1.CMD_SETS").State(cmd);
dom.GetObject("CUxD.CUX2801001:1.CMD_QUERY_RET").State(1);
var v = dom.GetObject("CUxD.CUX2801001:1.CMD_RETS").State();
WriteLine("Ret>:" # v);
integer foo = v.Find("STANDBY"); ! World = 6
WriteLine("Find STANDBY at Position>: " # foo);
if (foo <> -1)
{ WriteLine("Soundtouch>: STANDBY");}
else
{
WriteLine("Soundtouch>: ON");
!Press Power Button (down)
string ST_Method = "key";
string ST_Post='<key state="press" sender="Gabbo">POWER</key>';
string CurlCmd='/usr/local/addons/cuxd/curl --data "' # ST_Post # '" http://'# ST_Ip #':8090/' + ST_Method;
dom.GetObject("CUxD.CUX2801001:1.CMD_EXEC").State(CurlCmd);
!Press Power Button (release)
string ST_Method = "key";
string ST_Post='<key state="release" sender="Gabbo">POWER</key>';
string CurlCmd='/usr/local/addons/cuxd/curl --data "' # ST_Post # '" http://'# ST_Ip #':8090/' + ST_Method;
dom.GetObject("CUxD.CUX2801001:1.CMD_EXEC").State(CurlCmd)
}
Code: Alles auswählen
!Soundtouch Sender setzen
string ST_Location ="530"; !SWR3
!string ST_Location ="7297"; !Die Neue 107.7
!Soundtouch IP setzen
string ST_Ip ="192.168.1.100";
!Set volume
string ST_Method = "select";
string ST_Post='<ContentItem source="INTERNET_RADIO" location="' # ST_Location # '"></ContentItem>';
string CurlCmd='/usr/local/addons/cuxd/curl --data "' # ST_Post # '" http://'# ST_Ip #':8090/' + ST_Method;
WriteLine("CurlCmd:" # CurlCmd);
!dom.GetObject("CUxD.CUX2801001:1.CMD_EXEC").State(CurlCmd)
dom.GetObject("CUxD.CUX2801001:1.CMD_SETS").State(CurlCmd);
dom.GetObject("CUxD.CUX2801001:1.CMD_QUERY_RET").State(1);
var v = dom.GetObject("CUxD.CUX2801001:1.CMD_RETS").State();
WriteLine("SetLocationRet>:" # v);
!get volume
var url="http://" # ST_Ip #":8090/volume";
var cmd = "/usr/local/addons/cuxd/curl -s -k -L " # url ;
dom.GetObject("CUxD.CUX2801001:1.CMD_SETS").State(cmd);
dom.GetObject("CUxD.CUX2801001:1.CMD_QUERY_RET").State(1);
var v = dom.GetObject("CUxD.CUX2801001:1.CMD_RETS").State();
WriteLine("GetVolumeRet>:" # v);
Code: Alles auswählen
!Soundtouch Key setzen
string ST_Key ="PRESET_2";
!Soundtouch IP setzen
string ST_Ip ="192.168.1.100";
!Press Power Button (down)
string ST_Method = "key";
string ST_Post='<key state="press" sender="Gabbo">' # ST_Key #'</key>';
string CurlCmd='/usr/local/addons/cuxd/curl --data "' # ST_Post # '" http://'# ST_Ip #':8090/' + ST_Method;
WriteLine("CurlCmd:" # CurlCmd);
!dom.GetObject("CUxD.CUX2801001:1.CMD_EXEC").State(CurlCmd);
dom.GetObject("CUxD.CUX2801001:1.CMD_SETS").State(CurlCmd);
dom.GetObject("CUxD.CUX2801001:1.CMD_QUERY_RET").State(1);
var v = dom.GetObject("CUxD.CUX2801001:1.CMD_RETS").State();
WriteLine("Ret>:" # v);
!Press Power Button (release wichtig!)
string ST_Method = "key";
string ST_Post='<key state="release" sender="Gabbo">' # ST_Key #'</key>';
string CurlCmd='/usr/local/addons/cuxd/curl --data "' # ST_Post # '" http://'# ST_Ip #':8090/' + ST_Method;
WriteLine("CurlCmd:" # CurlCmd);
!dom.GetObject("CUxD.CUX2801001:1.CMD_EXEC").State(CurlCmd)
dom.GetObject("CUxD.CUX2801001:1.CMD_SETS").State(CurlCmd);
dom.GetObject("CUxD.CUX2801001:1.CMD_QUERY_RET").State(1);
var v = dom.GetObject("CUxD.CUX2801001:1.CMD_RETS").State();
WriteLine("Ret>:" # v);
PLAY
PAUSE
STOP
PREV_TRACK
NEXT_TRACK
THUMBS_UP
THUMBS_DOWN
POWER
MUTE
VOLUME_UP
VOLUME_DOWN
PRESET_1
PRESET_2
PRESET_3
PRESET_4
PRESET_5
PRESET_6
AUX_INPUT
SHUFFLE_OFF
SHUFFLE_ON
REPEAT_OFF
REPEAT_ONE
REPEAT_ALL
PLAY_PAUSE
ADD_FAVORITE
REMOVE_FAVORITE
4. SoundTouch Lautstärke einstellen
Code: Alles auswählen
!Soundtouch Lautsterke setzen 0-100
string ST_Value ="40";
!Soundtouch IP setzen
string ST_Ip ="192.168.1.100";
!Set volume
string ST_Method = "volume";
string ST_Post='<volume>' # ST_Value #'</volume>';
string CurlCmd='/usr/local/addons/cuxd/curl --data "' # ST_Post # '" http://'# ST_Ip #':8090/' + ST_Method;
WriteLine("CurlCmd:" # CurlCmd);
!dom.GetObject("CUxD.CUX2801001:1.CMD_EXEC").State(CurlCmd)
dom.GetObject("CUxD.CUX2801001:1.CMD_SETS").State(CurlCmd);
dom.GetObject("CUxD.CUX2801001:1.CMD_QUERY_RET").State(1);
var v = dom.GetObject("CUxD.CUX2801001:1.CMD_RETS").State();
WriteLine("SetvolumeRet>:" # v);
!get volume (Optional)
var url="http://" # ST_Ip #":8090/volume";
var cmd = "/usr/local/addons/cuxd/curl -s -k -L " # url ;
dom.GetObject("CUxD.CUX2801001:1.CMD_SETS").State(cmd);
dom.GetObject("CUxD.CUX2801001:1.CMD_QUERY_RET").State(1);
var v = dom.GetObject("CUxD.CUX2801001:1.CMD_RETS").State();
WriteLine("GetVolumeRet>:" # v);
5. SoundTouch Lautstärke auslesen
+ erstelle eine Systemvariable string SoundTouch_NowPlayingVolume
Code: Alles auswählen
!"Soundtouch_IP" auslesen falls als SystemVariable vorhanden
!var STtempIP = dom.GetObject("Soundtouch_IP"); string ST_Ip= STtempIP .Variable();
!Soundtouch IP setzen (optional wenn nicht Systemvariable)
string ST_Ip ="xx.xx.xx.xx";
WriteLine("Soundtouch IP>: " # ST_Ip);
!get voluume
var url="http://" # ST_Ip #":8090/volume";
var cmd = "/usr/local/addons/cuxd/curl -s -k -L " # url ;
dom.GetObject("CUxD.CUX2801001:1.CMD_SETS").State(cmd);
dom.GetObject("CUxD.CUX2801001:1.CMD_QUERY_RET").State(1);
var v = dom.GetObject("CUxD.CUX2801001:1.CMD_RETS").State();
WriteLine("GetVolumeRet>:" # v);
integer foo = v.Find("encoding");
WriteLine("Find >encoding< at Position>: " # foo);
if (foo <> -1)
{
!"SoundTouch_NowPlayingSID"
string foo4 = v.StrValueByIndex('="',3);
string deviceID = foo4.StrValueByIndex('"',1);
WriteLine("SoundTouch_NowPlayingSID>: " # deviceID);
!var STtempIP = dom.GetObject("SoundTouch_NowPlayingSID"); STtempIP.Variable(deviceID);
!"SoundTouch_NowPlayingTargetVolume"
string targetvolume = foo4.StrValueByIndex(' ',3);
WriteLine("SoundTouch_NowPlayingTargetVolume>: " # targetvolume);
!var STtempIP = dom.GetObject("SoundTouch_NowPlayingTargetVolume"); STtempIP.Variable(targetvolume);
!"SoundTouch_NowPlayingActualVolume"
string actualvolume = foo4.StrValueByIndex(' ',7);
WriteLine("SoundTouch_NowPlayingActualVolume>: " # actualvolume);
var STtempIP = dom.GetObject("SoundTouch_NowPlayingVolume"); STtempIP.Variable(actualvolume);
}
else
{
!"SoundTouch_NowPlayingSID"
string foo4 = v.StrValueByIndex('="',3);
string deviceID = foo4.StrValueByIndex('"',1);
WriteLine("SoundTouch_NowPlayi-ngSID>: NotFound");
!var STtempIP = dom.GetObject("SoundTouch_NowPlayingSID"); STtempIP.Variable("NotFound");
!"SoundTouch_NowPlayingTargetVolume"
string targetvolume = foo4.StrValueByIndex(' ',3);
WriteLine("SoundTouch_NowPlayingTargetVolume>: 0");
!var STtempIP = dom.GetObject("SoundTouch_NowPlayingTargetVolume"); STtempIP.Variable("0");
!"SoundTouch_NowPlayingActualVolume"
string actualvolume = foo4.StrValueByIndex(' ',7);
WriteLine("SoundTouch_NowPlayingActualVolume>: 0");
var STtempIP = dom.GetObject("SoundTouch_NowPlayingVolume"); STtempIP.Variable("0");
}
+ erstelle eine Systemvariable string SoundTouch_NowPlayingSID
+ erstelle eine Systemvariable string SoundTouch_NowPlayingSource
+ erstelle eine Systemvariable string SoundTouch_NowPlayingContentItemSource
+ erstelle eine Systemvariable string SoundTouch_NowPlayingLocation
Code: Alles auswählen
!"Soundtouch_IP" auslesen wenn Systemvariable
!var STtempIP = dom.GetObject("Soundtouch_IP"); string ST_Ip= STtempIP .Variable();
!WriteLine("Soundtouch IP>: " # ST_Ip);
!Soundtouch IP setzen (optional wenn nicht Systemvariable)
string ST_Ip ="xx.xx.xx.xx";
!now_playing auslesen
var url="http://" # ST_Ip #":8090/now_playing";
var cmd = "/usr/local/addons/cuxd/curl -s -k -L " # url ;
dom.GetObject("CUxD.CUX2801001:1.CMD_SETS").State(cmd);
dom.GetObject("CUxD.CUX2801001:1.CMD_QUERY_RET").State(1);
var v = dom.GetObject("CUxD.CUX2801001:1.CMD_RETS").State();
WriteLine("Ret>:" # v);
integer foo = v.Find("encoding");
WriteLine("Find >encoding< at Position>: " # foo);
if (foo <> -1)
{
!"SoundTouch_NowPlayingSID"
string foo4 = v.StrValueByIndex('="',3);
string deviceID = foo4.StrValueByIndex('"',1);
WriteLine("SoundTouch_NowPlayingSID>: " # deviceID);
var STtempIP = dom.GetObject("SoundTouch_NowPlayingSID"); STtempIP.Variable(deviceID);
!"SoundTouch_NowPlayingSource"
string foo4 = v.StrValueByIndex('="',4);
string Source = foo4.StrValueByIndex('"',1);
WriteLine("SoundTouch_NowPlayingSource>: " # Source);
var STtempIP = dom.GetObject("SoundTouch_NowPlayingSource"); STtempIP.Variable(Source);
string foo4 = v.StrValueByIndex('="',5);
string ContentItemSource = foo4.StrValueByIndex('"',1);
WriteLine("SoundTouch_NowPlayingContentItemSource>: " # ContentItemSource);
var STtempIP = dom.GetObject("SoundTouch_NowPlayingContentItemSource"); STtempIP.Variable(ContentItemSource);
!string ST_Location ="530"; !SWR3
!string ST_Location ="7297"; !Die Neue 107.7
string foo4 = v.StrValueByIndex('="',6);
string isPresetable = foo4.StrValueByIndex('"',1);
WriteLine("SoundTouch_NowPlayingLocation>: " # isPresetable);
var STtempIP = dom.GetObject("SoundTouch_NowPlayingLocation"); STtempIP.Variable(isPresetable);
}
else
{
!"SoundTouch_NowPlayingSID"
WriteLine("SoundTouch_NowPlayingSID>: NotFound");
var STtempIP = dom.GetObject("SoundTouch_NowPlayingSID"); STtempIP.Variable("NotFound");
!"SoundTouch_NowPlayingSource"
WriteLine("SoundTouch_NowPlayingSource>: STANDBY");
var STtempIP = dom.GetObject("SoundTouch_NowPlayingSource"); STtempIP.Variable("STANDBY");
WriteLine("SoundTouch_NowPlayingContentItemSource>: NotFound");
var STtempIP = dom.GetObject("SoundTouch_NowPlayingContentItemSource"); STtempIP.Variable("NotFound");
WriteLine("SoundTouch_NowPlayingLocation>: NotFound");
var STtempIP = dom.GetObject("SoundTouch_NowPlayingLocation"); STtempIP.Variable("NotFound");
}
Fraat