This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

SONOS app
Hi Marc,

No, i just tested it and the command is still available, but i noticed they have changed the structure of the response, that's why you got errors:

Here is the script changed to current response:
Code:
$(function(){ 
  setInterval(function(){
    // Only poll if current page = 1
    //console.log(currentPlanId)
    var sonosip = "127.0.0.1"
    if (currentPlanId == 1 || currentPlanId == 2 || currentPlanId == 3  ){
      if (currentPlanId == 1 ) {
          sonosip = "192.168.10.26"
      }
      if (currentPlanId == 2 ) {
          sonosip = "192.168.10.27"
      }
      if (currentPlanId == 3 ) {
          sonosip = "192.168.10.28"
      }
      // Request data from sonos API
      $.post("/apps/data/sonos/sonos.lp",
      { action: "getextendedstate", ip: sonosip },
      function(data) {
      var res_parsed = JSON.parse(data);
        if (typeof data !== 'undefined'){
          //console.log(res_parsed)

          var protocolinfo = res_parsed.TrackUri.match("x(.*)://");
          //console.log(protocolinfo[0])

          // Update text label with additional class 'volume'
          $("#plan-" + currentPlanId).find(".volume").html(res_parsed.Volume + ' %');

          // Update text label with additional class 'mute'
          $("#plan-" + currentPlanId).find(".mute").html(res_parsed.Mute);

          // Update text label with additional class 'crossfade'
          $("#plan-" + currentPlanId).find(".crossfade").html(res_parsed.Crossfade);

          // Update text label with additional class 'playmode'    
          $("#plan-" + currentPlanId).find(".playmode").html(res_parsed.Playmode);

          // Update text label with additional class 'transport'
          $("#plan-" + currentPlanId).find(".transport").html(res_parsed.TransportState);

          // Update text label with additional class 'trackuri'
          $("#plan-" + currentPlanId).find(".trackuri").html(res_parsed.TrackUri);

          // Update text label with additional class 'duration'
          $("#plan-" + currentPlanId).find(".duration").html(res_parsed.TrackDuration);

          // Update text label with additional class 'playingtime'
          $("#plan-" + currentPlanId).find(".playingtime").html(res_parsed.Playingtime);

          // Update text label with additional class 'tracktitle'
          $("#plan-" + currentPlanId).find(".tracktitle").html(res_parsed.TrackTitle);

          // Update text label with additional class 'creator'
          $("#plan-" + currentPlanId).find(".creator").html(res_parsed.Creator);

          // Hide Album when mediatype = radio
          if (res_parsed.MediaType == 'radio'){
            $("#plan-" + currentPlanId).find(".album").css( "display", "none" );
          } else {
            $("#plan-" + currentPlanId).find(".album").css( "display", "block" );
            // Update text label with additional class 'album'
            $("#plan-" + currentPlanId).find(".album").html(res_parsed.Album);
          }

          // Update image container with additional class 'albumart'
          $("#plan-" + currentPlanId).find(".albumart").find("img").attr('src', res_parsed.AlbumArt);

          // Update text label with additional class 'mediatype'
          $("#plan-" + currentPlanId).find(".mediatype").html(res_parsed.MediaType);
          //$("#plan-" + currentPlanId).find(".trackuri").html(res_parsed.TrackUri);
          //$("#plan-" + currentPlanId).find(".trackurimetadata").html(res_parsed.TrackMetadata);

          //$("#plan-" + currentPlanId).find(".sonosplayerip").html(res_parsed.ip);

          function FormattedTimeToSeconds(formattedtime) {
            var a = formattedtime.split(':'); // split it at the colons
            // minutes are worth 60 seconds. Hours are worth 60 minutes. 
            var seconds = (+a[0]) * 60 * 60 + (+a[1]) * 60 + (+a[2]); 
            return seconds;
          }

          var passed = 0;
          var durationseconds = FormattedTimeToSeconds(res_parsed.TrackDuration);
          var playingtimeseconds = FormattedTimeToSeconds(res_parsed.PlayingTime)
          if (durationseconds > playingtimeseconds){
              passed = durationseconds - (durationseconds - playingtimeseconds);
              passed = Math.floor(((passed / durationseconds) * 100) * 4); // set to * x for each 100px
          } else {
              passed = 0;
          }  
          $("#plan-" + currentPlanId).find(".playprogress").css("min-width", "0px", 'important');
          $("#plan-" + currentPlanId).find(".playprogress").css("height", "15px", 'important');
          $("#plan-" + currentPlanId).find(".playprogress").css("border-radius", "0px", 'important');
          $("#plan-" + currentPlanId).find(".playprogress").css("max-width", passed + "px", 'important');
          $("#plan-" + currentPlanId).find(".playprogress").css("width", passed + "px");
        }
    }
  ); }; }, 1000);
});

BR,

Erwin
Reply


Messages In This Thread
SONOS app - by edgars - 07.10.2016, 09:28
RE: SONOS app - by FatMax - 07.10.2016, 12:24
RE: SONOS app - by Erwin van der Zwart - 07.10.2016, 12:59
RE: SONOS app - by andeug - 09.10.2016, 17:33
RE: SONOS app - by rocfusion - 10.10.2016, 18:03
RE: SONOS app - by Erwin van der Zwart - 10.10.2016, 19:59
RE: SONOS app - by rocfusion - 11.10.2016, 00:26
RE: SONOS app - by Erwin van der Zwart - 11.10.2016, 09:29
RE: SONOS app - by Erwin van der Zwart - 13.10.2016, 20:28
RE: SONOS app - by andeug - 11.10.2016, 08:18
RE: SONOS app - by andeug - 11.10.2016, 10:05
RE: SONOS app - by andeug - 19.10.2016, 07:44
RE: SONOS app - by Erwin van der Zwart - 19.10.2016, 09:51
RE: SONOS app - by kythas100 - 18.08.2017, 12:08
RE: SONOS app - by kythas100 - 29.08.2017, 10:16
RE: SONOS app - by Erwin van der Zwart - 29.08.2017, 10:58
RE: SONOS app - by kythas100 - 31.08.2017, 13:02
RE: SONOS app - by kythas100 - 05.09.2017, 09:53
SONOS app - by Erwin van der Zwart - 21.10.2016, 17:51
RE: SONOS app - by andeug - 21.10.2016, 18:04
RE: SONOS app - by Erwin van der Zwart - 21.10.2016, 19:06
RE: SONOS app - by andeug - 21.10.2016, 22:32
RE: SONOS app - by Erwin van der Zwart - 22.10.2016, 09:00
RE: SONOS app - by Erwin van der Zwart - 25.10.2016, 13:32
RE: SONOS app - by andeug - 25.10.2016, 13:49
RE: SONOS app - by Erwin van der Zwart - 25.10.2016, 14:25
RE: SONOS app - by andeug - 25.10.2016, 15:08
RE: SONOS app - by Erwin van der Zwart - 25.10.2016, 16:06
RE: SONOS app - by Erwin van der Zwart - 25.10.2016, 18:55
RE: SONOS app - by Erwin van der Zwart - 25.10.2016, 23:13
RE: SONOS app - by PassivPluss - 26.10.2016, 23:36
RE: SONOS app - by andeug - 26.10.2016, 23:51
RE: SONOS app - by andeug - 03.11.2016, 00:06
RE: SONOS app - by Erwin van der Zwart - 04.11.2016, 13:48
RE: SONOS app - by Erwin van der Zwart - 04.11.2016, 16:54
RE: SONOS app - by andeug - 04.11.2016, 14:07
RE: SONOS app - by andeug - 04.11.2016, 22:15
RE: SONOS app - by bmodeco - 13.01.2017, 08:35
RE: SONOS app - by Erwin van der Zwart - 13.01.2017, 16:52
RE: SONOS app - by bmodeco - 14.01.2017, 07:20
RE: SONOS app - by Habib - 14.01.2017, 08:24
RE: SONOS app - by Erwin van der Zwart - 14.01.2017, 11:51
RE: SONOS app - by admin - 14.01.2017, 11:50
RE: SONOS app - by bmodeco - 14.01.2017, 12:41
RE: SONOS app - by admin - 14.01.2017, 11:52
RE: SONOS app - by Erwin van der Zwart - 14.01.2017, 12:49
RE: SONOS app - by bmodeco - 15.02.2017, 19:14
RE: SONOS app - by Erwin van der Zwart - 15.02.2017, 19:19
RE: SONOS app - by bmodeco - 15.02.2017, 19:27
RE: SONOS app - by bmodeco - 15.02.2017, 19:33
RE: SONOS app - by admin - 15.02.2017, 19:30
RE: SONOS app - by Erwin van der Zwart - 15.02.2017, 19:34
RE: SONOS app - by admin - 15.02.2017, 19:34
RE: SONOS app - by bmodeco - 15.02.2017, 19:38
RE: SONOS app - by josep - 23.02.2017, 15:36
RE: SONOS app - by Erwin van der Zwart - 23.02.2017, 23:05
RE: SONOS app - by josep - 24.02.2017, 09:04
RE: SONOS app - by Erwin van der Zwart - 24.02.2017, 09:26
RE: SONOS app - by josep - 24.02.2017, 10:31
RE: SONOS app - by admin - 24.02.2017, 10:38
RE: SONOS app - by josep - 24.02.2017, 12:11
RE: SONOS app - by josep - 24.02.2017, 14:07
RE: SONOS app - by Erwin van der Zwart - 24.02.2017, 14:11
RE: SONOS app - by josep - 24.02.2017, 14:26
RE: SONOS app - by Erwin van der Zwart - 25.02.2017, 09:28
RE: SONOS app - by josep - 25.02.2017, 11:30
RE: SONOS app - by Erwin van der Zwart - 25.02.2017, 12:01
RE: SONOS app - by josep - 25.02.2017, 18:58
RE: SONOS app - by Erwin van der Zwart - 25.02.2017, 19:12
RE: SONOS app - by bmodeco - 25.02.2017, 19:36
RE: SONOS app - by Erwin van der Zwart - 25.02.2017, 20:08
RE: SONOS app - by Erwin van der Zwart - 27.02.2017, 13:59
RE: SONOS app - by josep - 25.02.2017, 22:12
RE: SONOS app - by Erwin van der Zwart - 25.02.2017, 22:38
RE: SONOS app - by josep - 27.02.2017, 14:21
RE: SONOS app - by Erwin van der Zwart - 27.02.2017, 16:52
RE: SONOS app - by josep - 27.02.2017, 17:32
RE: SONOS app - by Erwin van der Zwart - 28.02.2017, 01:11
RE: SONOS app - by admin - 28.02.2017, 07:44
RE: SONOS app - by admin - 28.02.2017, 07:51
RE: SONOS app - by Erwin van der Zwart - 28.02.2017, 07:58
RE: SONOS app - by josep - 28.02.2017, 08:29
RE: SONOS app - by Erwin van der Zwart - 28.02.2017, 08:56
RE: SONOS app - by josep - 28.02.2017, 09:07
RE: SONOS app - by Erwin van der Zwart - 28.02.2017, 09:21
RE: SONOS app - by josep - 28.02.2017, 10:20
RE: SONOS app - by Erwin van der Zwart - 28.02.2017, 10:32
RE: SONOS app - by josep - 28.02.2017, 10:53
RE: SONOS app - by Erwin van der Zwart - 28.02.2017, 11:27
RE: SONOS app - by josep - 28.02.2017, 11:32
RE: SONOS app - by Erwin van der Zwart - 28.02.2017, 11:37
RE: SONOS app - by josep - 28.02.2017, 14:31
RE: SONOS app - by domotiqa - 06.04.2017, 07:59
RE: SONOS app - by Erwin van der Zwart - 06.04.2017, 14:09
RE: SONOS app - by domotiqa - 07.04.2017, 16:55
RE: SONOS app - by Mr.D - 01.05.2017, 19:11
RE: SONOS app - by Erwin van der Zwart - 01.05.2017, 19:16
RE: SONOS app - by Mr.D - 01.05.2017, 21:29
RE: SONOS app - by Erwin van der Zwart - 01.05.2017, 22:48
RE: SONOS app - by Mr.D - 02.05.2017, 20:38
RE: SONOS app - by rocfusion - 16.05.2017, 05:12
RE: SONOS app - by Erwin van der Zwart - 16.05.2017, 07:39
RE: SONOS app - by josep - 05.06.2017, 14:38
RE: SONOS app - by Erwin van der Zwart - 05.06.2017, 15:02
RE: SONOS app - by josep - 05.06.2017, 15:25
RE: SONOS app - by Erwin van der Zwart - 05.06.2017, 15:45
RE: SONOS app - by josep - 05.06.2017, 15:55
RE: SONOS app - by Erwin van der Zwart - 05.06.2017, 16:12
RE: SONOS app - by Mr.D - 21.06.2017, 15:49
RE: SONOS app - by Erwin van der Zwart - 21.06.2017, 15:59
RE: SONOS app - by Erwin van der Zwart - 21.07.2017, 15:27
RE: SONOS app - by Mr.D - 29.07.2017, 09:56
SONOS app - by Erwin van der Zwart - 30.07.2017, 07:23
RE: SONOS app - by Mr.D - 10.08.2017, 19:37
RE: SONOS app - by morak - 11.08.2017, 14:40
RE: SONOS app - by Hippolyte - 18.08.2017, 05:33
RE: SONOS app - by Erwin van der Zwart - 18.08.2017, 06:33
RE: SONOS app - by ivanposada - 18.08.2017, 10:42
RE: SONOS app - by Erwin van der Zwart - 18.08.2017, 11:02
RE: SONOS app - by ivanposada - 18.08.2017, 14:25
RE: SONOS app - by Erwin van der Zwart - 18.08.2017, 20:55
RE: SONOS app - by ivanposada - 19.08.2017, 12:25
RE: SONOS app - by admin - 18.08.2017, 10:52
SONOS app - by Erwin van der Zwart - 19.08.2017, 12:54
RE: SONOS app - by ivanposada - 19.08.2017, 20:21
RE: SONOS app - by Erwin van der Zwart - 19.08.2017, 22:10
RE: SONOS app - by ivanposada - 20.08.2017, 17:27
RE: SONOS app - by Erwin van der Zwart - 20.08.2017, 18:28
RE: SONOS app - by ivanposada - 20.08.2017, 20:42
RE: SONOS app - by Erwin van der Zwart - 21.08.2017, 08:21
RE: SONOS app - by ivanposada - 21.08.2017, 10:01
RE: SONOS app - by admin - 19.08.2017, 14:13
RE: SONOS app - by ivanposada - 29.08.2017, 09:34
RE: SONOS app - by Erwin van der Zwart - 29.08.2017, 09:45
RE: SONOS app - by ivanposada - 05.09.2017, 10:54
RE: SONOS app - by Erwin van der Zwart - 05.09.2017, 11:16
RE: SONOS app - by ivanposada - 05.09.2017, 13:30
RE: SONOS app - by Erwin van der Zwart - 05.09.2017, 13:47
RE: SONOS app - by Mr.D - 24.09.2017, 07:23
RE: SONOS app - by Erwin van der Zwart - 24.09.2017, 08:18
RE: SONOS app - by Mr.D - 24.09.2017, 08:45
RE: SONOS app - by Erwin van der Zwart - 24.09.2017, 09:19
RE: SONOS app - by Mr.D - 24.09.2017, 09:27
RE: SONOS app - by Erwin van der Zwart - 24.09.2017, 09:49
RE: SONOS app - by Mr.D - 27.01.2018, 12:33
RE: SONOS app - by Mr.D - 13.03.2018, 12:51
RE: SONOS app - by Mr.D - 24.09.2017, 09:59
RE: SONOS app - by Erwin van der Zwart - 24.09.2017, 10:04
RE: SONOS app - by Mr.D - 24.09.2017, 10:08
RE: SONOS app - by marc - 25.09.2017, 16:55
RE: SONOS app - by Erwin van der Zwart - 25.09.2017, 17:15
RE: SONOS app - by marc - 02.10.2017, 12:15
RE: SONOS app - by Erwin van der Zwart - 02.10.2017, 19:59
RE: SONOS app - by marc - 03.10.2017, 12:30
RE: SONOS app - by John94 - 25.10.2017, 13:16
RE: SONOS app - by Erwin van der Zwart - 25.10.2017, 13:28
RE: SONOS app - by John94 - 25.10.2017, 13:55
RE: SONOS app - by GenaV - 26.10.2017, 14:09
RE: SONOS app - by John94 - 30.10.2017, 14:49
RE: SONOS app - by Erwin van der Zwart - 31.10.2017, 20:40
RE: SONOS app - by galust - 07.11.2017, 13:57
RE: SONOS app - by Erwin van der Zwart - 07.11.2017, 16:16
RE: SONOS app - by galust - 07.11.2017, 16:20
RE: SONOS app - by John94 - 07.11.2017, 19:02
RE: SONOS app - by galust - 08.11.2017, 10:34
RE: SONOS app - by Erwin van der Zwart - 09.11.2017, 11:20
RE: SONOS app - by unaxboy - 21.11.2017, 21:46
RE: SONOS app - by unaxboy - 28.11.2017, 19:16
RE: SONOS app - by Erwin van der Zwart - 29.11.2017, 11:46
RE: SONOS app - by unaxboy - 29.11.2017, 12:45
RE: SONOS app - by Northwind - 23.11.2017, 10:35
RE: SONOS app - by balatis - 19.03.2018, 18:06
RE: SONOS app - by Daniel. - 28.03.2018, 12:15
RE: SONOS app - by CHOUAIBOU - 28.03.2018, 13:18
RE: SONOS app - by Daniel. - 28.03.2018, 13:40
RE: SONOS app - by Erwin van der Zwart - 28.03.2018, 17:22
RE: SONOS app - by balatis - 02.04.2018, 16:54
RE: SONOS app - by Erwin van der Zwart - 02.04.2018, 21:04
RE: SONOS app - by balatis - 05.04.2018, 11:51
RE: SONOS app - by balatis - 05.04.2018, 17:00
RE: SONOS app - by Erwin van der Zwart - 05.04.2018, 18:18
RE: SONOS app - by balatis - 05.04.2018, 18:52
RE: SONOS app - by Erwin van der Zwart - 05.04.2018, 20:04
RE: SONOS app - by balatis - 05.04.2018, 20:07
RE: SONOS app - by Erwin van der Zwart - 05.04.2018, 20:55
RE: SONOS app - by balatis - 05.04.2018, 22:16
RE: SONOS app - by admin - 06.04.2018, 06:37
RE: SONOS app - by balatis - 06.04.2018, 08:57
RE: SONOS app - by Daniel. - 11.04.2018, 14:12
RE: SONOS app - by Mr.D - 04.05.2018, 09:35
RE: SONOS app - by balatis - 04.05.2018, 10:50
RE: SONOS app - by Erwin van der Zwart - 04.05.2018, 12:00
RE: SONOS app - by Mr.D - 04.05.2018, 12:08
RE: SONOS app - by Erwin van der Zwart - 04.05.2018, 12:09
RE: SONOS app - by Bitver - 23.05.2018, 11:05
RE: SONOS app - by Erwin van der Zwart - 23.05.2018, 20:42
Balance control on SONOS:AMP - by puntukas - 22.07.2018, 19:41
RE: SONOS app - by Jose - 06.08.2018, 12:10
RE: SONOS app - by Mr.D - 16.10.2018, 18:28
RE: SONOS app - by Erwin van der Zwart - 16.10.2018, 21:34
RE: SONOS app - by Daniel. - 17.10.2018, 07:10
RE: SONOS app - by FatMax - 17.10.2018, 09:31
RE: SONOS app - by Daniel. - 17.10.2018, 09:43
RE: SONOS app - by CHOUAIBOU - 20.10.2018, 06:04
RE: SONOS app - by Erwin van der Zwart - 20.10.2018, 07:23
RE: SONOS app - by CHOUAIBOU - 21.10.2018, 06:01
RE: SONOS app - by Mr.D - 01.11.2018, 18:44
RE: SONOS app - by Daniel. - 01.11.2018, 18:48
RE: SONOS app - by Mr.D - 05.02.2019, 18:39
RE: SONOS app - by Erwin van der Zwart - 05.02.2019, 19:12
RE: SONOS app - by lenze90 - 22.02.2019, 16:39
RE: SONOS app - by Daniel. - 22.02.2019, 16:43
RE: SONOS app - by lenze90 - 22.02.2019, 19:08
RE: SONOS app - by Erwin van der Zwart - 23.02.2019, 18:35
RE: SONOS app - by lenze90 - 24.02.2019, 13:39
RE: SONOS app - by Daniel. - 25.02.2019, 09:20
RE: SONOS app - by Firechief - 15.03.2019, 16:03
RE: SONOS app - by Mr.D - 16.03.2019, 17:01
RE: SONOS app - by Erwin van der Zwart - 16.03.2019, 17:55
RE: SONOS app - by lenze90 - 17.03.2019, 14:16
RE: SONOS app - by Mr.D - 16.03.2019, 17:58
RE: SONOS app - by admin - 16.03.2019, 19:36
RE: SONOS app - by Erwin van der Zwart - 16.03.2019, 20:42
RE: SONOS app - by Evens - 16.03.2019, 22:59
RE: SONOS app - by Mr.D - 17.03.2019, 12:07
RE: SONOS app - by admin - 18.03.2019, 07:41
RE: SONOS app - by Daniel. - 18.03.2019, 08:56
RE: SONOS app - by phongvucba - 01.04.2019, 10:42
RE: SONOS app - by admin - 01.04.2019, 11:17
RE: SONOS app - by phongvucba - 02.04.2019, 01:58
RE: SONOS app - by Daniel. - 02.04.2019, 07:28
RE: SONOS app - by Kai-Roger - 24.04.2019, 13:41
RE: SONOS app - by Daniel. - 24.04.2019, 13:47
RE: SONOS app - by Kai-Roger - 24.04.2019, 13:54
RE: SONOS app - by andeug - 01.05.2019, 12:12
RE: SONOS app - by Daniel. - 01.05.2019, 14:09
RE: SONOS app - by andeug - 01.05.2019, 22:18
RE: SONOS app - by Daniel. - 02.05.2019, 07:07
RE: SONOS app - by Bitver - 24.05.2019, 08:53
RE: SONOS app - by Daniel. - 24.05.2019, 09:04
RE: SONOS app - by Kam - 13.06.2019, 12:47
RE: SONOS app - by admin - 13.06.2019, 13:00
RE: SONOS app - by Kam - 13.06.2019, 13:46
RE: SONOS app - by Daniel. - 13.06.2019, 13:02
RE: SONOS app - by Kam - 14.06.2019, 09:38
RE: SONOS app - by Daniel. - 14.06.2019, 10:21
RE: SONOS app - by Kam - 14.06.2019, 10:58
RE: SONOS app - by theodosiou - 17.06.2019, 15:54
RE: SONOS app - by Evens - 08.07.2019, 18:21
RE: SONOS app - by andeug - 21.07.2019, 10:06
RE: SONOS app - by Erwin van der Zwart - 21.07.2019, 11:11
RE: SONOS app - by thomasoppida - 01.08.2019, 05:20
RE: SONOS app - by admin - 01.08.2019, 06:05
RE: SONOS app - by thomasoppida - 01.08.2019, 06:14
RE: SONOS app - by admin - 01.08.2019, 06:18
RE: SONOS app - by thomasoppida - 01.08.2019, 14:48
RE: SONOS app - by Hippolyte - 09.09.2019, 11:45
RE: SONOS app - by Erwin van der Zwart - 10.09.2019, 21:47
RE: SONOS app - by Daniel. - 11.09.2019, 07:47
RE: SONOS app - by Trond Hoyem - 06.10.2019, 13:09
RE: SONOS app - by Hippolyte - 11.09.2019, 14:00
RE: SONOS app - by Daniel. - 07.10.2019, 07:36
RE: SONOS app - by Daniel. - 07.10.2019, 11:54
RE: SONOS app - by Trond Hoyem - 14.10.2019, 17:12
RE: SONOS app - by Igor68 - 26.10.2019, 04:28
RE: SONOS app - by Igor68 - 26.10.2019, 05:42
RE: SONOS app - by Erwin van der Zwart - 28.10.2019, 13:18
RE: SONOS app - by Igor68 - 28.10.2019, 14:12
RE: SONOS app - by Erwin van der Zwart - 28.10.2019, 15:42
RE: SONOS app - by Daniel. - 28.10.2019, 08:18
RE: SONOS app - by Igor68 - 29.10.2019, 15:24
RE: SONOS app - by Erwin van der Zwart - 29.10.2019, 15:31
RE: SONOS app - by Igor68 - 29.10.2019, 16:02

Forum Jump: