Announcement

Collapse
No announcement yet.

Create a log on track change

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Create a log on track change

    Is this possible with HS3?

    When a track changes on sonos I would like to write the following information to a log or even to the HS3 log:

    Station name - Artist - Track


    Is this possible currently?

    #2
    Originally posted by sifuhall View Post
    Is this possible with HS3?

    When a track changes on sonos I would like to write the following information to a log or even to the HS3 log:

    Station name - Artist - Track


    Is this possible currently?
    There is a trigger for track change, you could tee off that to run a script and the script should be able to write into the log file. Not sure you can do it without a script, haven't looked at what actions are available from HS3 itself.

    Just for my curiosity, what are you trying to solve?

    Dirk

    Comment


      #3
      I prefer scripting so that is fine.

      However is MusicApi available in HS3?

      Is there something else I can use?

      Comment


        #4
        Originally posted by sifuhall View Post
        I prefer scripting so that is fine.

        However is MusicApi available in HS3?

        Is there something else I can use?
        Actually the MusicAPI doesn't exist anymore it is now a MediaAPI but that is just a different name. What is different w/ HS3 is that there are now standard HS devices which hold track, author, album info. So in your script or events you should use those. The MediaAPI will focus only on navigating through Media Libraries.

        One note of caution, if you tee off the track change triggers, all the new track information might not be "unpacked" or "known" at that point. I've tried to generate the trigger after unpacking all the event information that is received from the Sonos player but the way the underlying UPNP protocol works, there might be multiple events with partial info.

        There was another user who wrote me who did something similar, he built in a 1 second wait between the trigger of track change and reading the HS values for track , album etc.

        Dirk

        Comment


          #5
          Thank you so much!

          I'm having trouble finding information on MediaAPI.

          Can you point me to an example?

          Comment


            #6
            Originally posted by sifuhall View Post
            I'm having trouble finding information on MediaAPI.
            There is none as it has been waiting for the implementation in HS Server / HS Designer / HS Touch Clients. As you may know, HS recently announced end of support on their Media player and iTunes player PI and put the code in the open source repository. They are committed to support the MediaAPI and have announced PIs for Spotify and Pandora (I think).

            What was it that you wanted to use from the MediaAPI? Most functions (from the old API) are still available in the Sonos PI but I don't want to publish them because they are deprecated and will change when the MediaAPI gets introduced.

            Dirk

            Comment


              #7
              Thanks for the reply, Dirk.

              I'm looking to write to the HS log the following information 1 second after track change on Sonos:

              Artist - Track name

              Comment


                #8
                Originally posted by sifuhall View Post
                Thanks for the reply, Dirk.

                I'm looking to write to the HS log the following information 1 second after track change on Sonos:

                Artist - Track name
                I see, just look up the scripting commands (not an expert) to use a string value from an HS device, create a string and then do an HS.writelog command

                Dirk

                Comment


                  #9
                  Thanks, I'll keep searching for that.

                  I'm good with actually writing to the log. I do that with a few things. I just need to find how to get the track name and artist.

                  I'll keep searching and I appreciate the help you have given me.

                  Comment


                    #10
                    Originally posted by sifuhall View Post
                    Thanks, I'll keep searching for that.

                    I'm good with actually writing to the log. I do that with a few things. I just need to find how to get the track name and artist.

                    I'll keep searching and I appreciate the help you have given me.
                    If you haven't found anything by tonight I can do some digging as well what the right syntax is to "identify" the right HS device to go read the valuestring from.

                    Dirk

                    Comment


                      #11
                      Originally posted by sifuhall View Post
                      Thanks, I'll keep searching for that.

                      I'm good with actually writing to the log. I do that with a few things. I just need to find how to get the track name and artist.

                      I'll keep searching and I appreciate the help you have given me.
                      Dug this up from the script help file

                      Sub Main()

                      Dim dvRef
                      Dim dv
                      dvRef = hs.GetDeviceRefByName("Family Room Light")
                      if dvRef > 0 then
                      Set dv = hs.GetDeviceByRef(dvRef)
                      else
                      hs.WriteLog "Error","Could not find the reference for the device specified."
                      exit Sub
                      end if
                      hs.WriteLog "Info","The address for the device is " & dv.hc & dv.dc
                      End Sub

                      Comment

                      Working...
                      X