Esempio n. 1
0
 public static void PowerOffMarantz()
 {
     //Daten vom Marantz ermitteln
     Marantz.Initialisieren(SonosConstants.MarantzUrl);
     //Ist auf Sonos?
     if (Marantz.SelectedInput == MarantzInputs.Sonos && Marantz.PowerOn)
     {
         //Marantz ausschalten.
         Marantz.PowerOn = false;
     }
 }
Esempio n. 2
0
 public static void PowerOnMarantz()
 {
     //Marantz Verarbeiten.
     Marantz.Initialisieren(SonosConstants.MarantzUrl);
     if (Marantz.SelectedInput != MarantzInputs.Sonos)
     {
         Marantz.SelectedInput = MarantzInputs.Sonos;
     }
     if (!Marantz.PowerOn)
     {
         Marantz.PowerOn = true;
     }
     if (Marantz.Volume != "-40.0")
     {
         Marantz.Volume = "-40.0";
     }
 }
Esempio n. 3
0
        public string Dash5(string id)
        {
            const string rsh = "x-sonosapi-stream:s18353?sid=254&flags=8224&sn=0";

            try
            {
                SonosPlayer primaryplayer         = SonosHelper.GetPlayer(primaryPlayerName);
                SonosPlayer secondaryplayer       = SonosHelper.GetPlayer(SonosConstants.KücheName);
                ushort      secondaryPlayerVolume = SonosConstants.KücheVolume;
                SonosPlayer thirdplayer           = SonosHelper.GetPlayer(SonosConstants.EsszimmerName);
                ushort      thirdPlayerVolume     = SonosConstants.EsszimmerVolume;
                var         aktUri = primaryplayer.GetMediaInfoURIMeta()[0];
                //scheint schon dash5 gedrückt worden zu sein.
                if (aktUri == rsh)
                {
                    if (primaryplayer.CurrentState.TransportState == PlayerStatus.PLAYING)
                    {
                        //ausschalten
                        primaryplayer.SetPause();
                        //Daten vom Marantz ermitteln
                        if (Marantz.Initialisieren(SonosConstants.MarantzUrl))
                        {
                            if (Marantz.SelectedInput == MarantzInputs.Sonos && Marantz.PowerOn)
                            {
                                Marantz.PowerOn = false;
                            }
                        }
                        return(retValok + " RSH ausgeschaltet.");
                    }

                    //Daten vom Marantz ermitteln
                    if (Marantz.Initialisieren(SonosConstants.MarantzUrl))
                    {
                        if (Marantz.SelectedInput != MarantzInputs.Sonos || !Marantz.PowerOn)
                        {
                            if (Marantz.PowerOn)
                            {
                                Marantz.SelectedInput = MarantzInputs.Sonos;
                            }
                            else
                            {
                                Marantz.PowerOn = true;
                            }
                            if (Marantz.SelectedInput != MarantzInputs.Sonos)
                            {
                                Marantz.SelectedInput = MarantzInputs.Sonos;
                            }
                        }
                    }
                    primaryplayer.SetPlay();
                    return(retValok + " RSH eingeschaltet.");
                }
                try
                {
                    //ab hier alles neu
                    var primaryZone = SonosHelper.GetZone(primaryPlayerName);
                    if (primaryZone != null && primaryZone.Players.Count == 2 && primaryZone.Players.Contains(thirdplayer) && primaryZone.Players.Contains(secondaryplayer))
                    {
                    }
                    else
                    {
                        if (primaryZone == null)
                        {
                            primaryplayer.BecomeCoordinatorofStandaloneGroup();
                            Thread.Sleep(200);
                            secondaryplayer.SetAVTransportURI(SonosConstants.xrincon + primaryplayer.UUID);
                            Thread.Sleep(300);
                            thirdplayer.SetAVTransportURI(SonosConstants.xrincon + primaryplayer.UUID);
                            Thread.Sleep(300);
                            if (secondaryplayer.GetVolume() != secondaryPlayerVolume)
                            {
                                secondaryplayer.SetVolume(secondaryPlayerVolume);
                            }
                            if (thirdplayer.GetVolume() != thirdPlayerVolume)
                            {
                                thirdplayer.SetVolume(thirdPlayerVolume);
                            }
                        }
                        else
                        {
                            if (!primaryZone.Players.Contains(secondaryplayer))
                            {
                                secondaryplayer.SetAVTransportURI(SonosConstants.xrincon + primaryplayer.UUID);
                                Thread.Sleep(300);
                                if (secondaryplayer.GetVolume() != secondaryPlayerVolume)
                                {
                                    secondaryplayer.SetVolume(secondaryPlayerVolume);
                                }
                            }
                            if (!primaryZone.Players.Contains(thirdplayer))
                            {
                                thirdplayer.SetAVTransportURI(SonosConstants.xrincon + primaryplayer.UUID);
                                Thread.Sleep(300);
                                if (thirdplayer.GetVolume() != thirdPlayerVolume)
                                {
                                    thirdplayer.SetVolume(thirdPlayerVolume);
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    return("Dash5:Block1:" + ex.Message);
                }
                try
                {
                    //Daten vom Marantz ermitteln
                    if (Marantz.Initialisieren(SonosConstants.MarantzUrl))
                    {
                        if (Marantz.SelectedInput != MarantzInputs.Sonos || !Marantz.PowerOn)
                        {
                            if (Marantz.PowerOn)
                            {
                                Marantz.SelectedInput = MarantzInputs.Sonos;
                            }
                            else
                            {
                                Marantz.PowerOn = true;
                            }
                            if (Marantz.SelectedInput != MarantzInputs.Sonos)
                            {
                                Marantz.SelectedInput = MarantzInputs.Sonos;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    return("Dash5:Block2:" + ex.Message);
                }

                if (primaryplayer.GetVolume() != primaryplayerVolume)
                {
                    primaryplayer.SetVolume(primaryplayerVolume);
                }
                if (aktUri != rsh)
                {
                    primaryplayer.SetAVTransportURI(rsh, "<DIDL-Lite xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:upnp=\"urn:schemas-upnp-org:metadata-1-0/upnp/\" xmlns:r=\"urn:schemas-rinconnetworks-com:metadata-1-0/\" xmlns=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\"><item id=\"F00092020s18353\" parentID=\"F00082064y1%3apopular\" restricted=\"true\"><dc:title>R.SH</dc:title><upnp:class>object.item.audioItem.audioBroadcast</upnp:class><desc id=\"cdudn\" nameSpace=\"urn:schemas-rinconnetworks-com:metadata-1-0/\">SA_RINCON65031_</desc></item></DIDL-Lite>");
                    Thread.Sleep(300);
                }
                primaryplayer.SetPlay();
                return(retValok + " eingeschaltet und RSH gestartet");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }