Announcement

Collapse
No announcement yet.

Announce Artist and TrackName?

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

    Announce Artist and TrackName?

    I'm trying to announce Artist and Tack Name when song change.

    For some reason I get "Running script LRCurrentSongAnounsment.vb :method not found"

    Here is the script:

    Sub Main(ZoneName as string)
    Dim MusicApi
    Try
    Dim pi As Object
    pi = hs.Plugin("SONOSCONTROLLER")

    If pi Is Nothing Then
    hs.writelog("Script", "empty")
    Exit sub
    End If

    MusicApi = pi.GetMusicAPI(ZoneName )

    hs.Speak( MusicApi.CurrentArtist )
    hs.Speak( MusicApi.CurrentTrack )
    Catch ex As Exception
    hs.writelog("Script", "Music API not found")
    Exit sub
    End Try
    End Sub


    What I'm doing wrong?

    #2
    Hi Flame,

    I assume you have saved this file as LRCurrentSongAnounsment.vb correct?

    Did you reference the procedure when you call this script?

    I quickly cut/paste your script and ran it without a problem, here is my screenshot.
    Attached Files

    Comment


      #3
      Do you mean -> Optional Parameters: ("main", "Living Room").
      Yes, I do.

      Comment


        #4
        Originally posted by Flame View Post
        Do you mean -> Optional Parameters: ("main", "Living Room").
        Yes, I do.
        Try it with capital "Main", not sure how case (in)sensitive this all is.

        From the error, it seems more that the parameter is missing, it doesn't state "main:method not found" it reads ":method" not found.

        Now another question: the script you posted, is this the whole script or is there something (other methods) prior to the Main Sub? If so, there could be a typo, like a "End Sub" or "End Function" missing and therefore the procedure is "hidden".

        IN fact, if you select the .vb script in "Existing script" (see my example), you should see the code in the edit box below else there is something else off.

        Hope this give you some other pointers

        Dirk

        Comment


          #5
          Capital M for "Main" did it.
          Looks like it is case sensitive.

          Also I noticed some problem with un-linking players.

          Thak you Dirk.

          Comment


            #6
            Originally posted by Flame View Post
            Also I noticed some problem with un-linking players.
            Let me know what problems you see with un-linking, if we can't figure it out, best is that you turn the debug flag on, do your action, capture the log file and email it to me personally with the sonoscontroller.ini file so we can have a look.

            By the way, I would change the script to wait for the announcement to complete, I see you omitted the "wait parameter" when you call hs.speak, not sure the default is true, wouldn't hurt to specifically state it.

            Cheers,

            Dirk

            Comment


              #7
              I did put the wait to "true" for the second parameter. Also look like MusicApi.CurrentTrack and MusicApi.CurrentArtist are giving reverse information. First I tought is Pandora, but then I tryed with Sirius and Rhapsody and is reverse too. Another thing: the change song event is triggered in the middle of the song for second time. I'm not sure if this is triggered by Pandora radio or the plugin.

              Comment


                #8
                Originally posted by Flame View Post
                Also look like MusicApi.CurrentTrack and MusicApi.CurrentArtist are giving reverse information.
                DANG, not sure how I missed that, but you are right. Need to check whether this is special to these type of radio stations and it is OK for others. Suggest you reverse you script code for time being, should be posting a new beta not later then this weekend

                Originally posted by Flame View Post
                Another thing: the change song event is triggered in the middle of the song for second time. I'm not sure if this is triggered by Pandora radio or the plugin.
                Another good find. I played Rhapsody and I indeed get an event after a few minutes into the song, need to investigate what this is all about.

                Comment


                  #9
                  Originally posted by Flame View Post
                  I tryed with Sirius and Rhapsody and is reverse too. Another thing: the change song event is triggered in the middle of the song for second time. I'm not sure if this is triggered by Pandora radio or the plugin.
                  Flame, can you confirm the tittle/artist swap is also for Sirius? Sirius reports its info in a very specific way and I coded it up a while back but I ran out of my free trial so I can't try it anymore. I did find the mistake for Lastfm/Rhapsody and Pandora and have fixed it for the next beta. If someone has Wolfgang's vault it would be interesting to know whether that is also wrong. I think it should be OK. Any users out there that have tried the new Rdio service or UK users with Spotify?

                  Originally posted by Flame View Post
                  the change song event is triggered in the middle of the song for second time. I'm not sure if this is triggered by Pandora radio or the plugin.
                  There is indeed a second event, I suspect it is the radio station indicating what the next song is going to be, but the information the event passes along is exactly the same as the start of the song. Pretty hard for me to go filter these out as someone can play multiple version of the same song/artist in a row and then I would suppress it incorrectly. What do you us it for? Maybe you can script (prevent) it.

                  Dirk

                  Comment


                    #10
                    For Sirius the plugin apears to report corectly atrist and track name. For the other radiostations provided by Sonos some of them are correct some of them are swap.

                    Comment


                      #11
                      Originally posted by Flame View Post
                      For the other radiostations provided by Sonos some of them are correct some of them are swap.
                      Thanks Flame. Currently testing the fix to prevent announcing a song change in the middle of a song. As far as I can tell, LastFm, Rhapsody and Pandora should be OK. Also added 4 more methods (NextTrack, NextArtist and NextAlbum and NextAlbumArtPath) so you can announce the next track or display it on a HST Screen.

                      Would you mind be more specific which radio statiostation work and which don't so I could look at those before I release.

                      Thanks

                      Dirk

                      Comment


                        #12
                        They are so many radio stations. Most of the ones I tested are correct. Some are giving the radio station name only and they are puting it in artist name or track name ( Radio Ultra Pernik. , Focus, Focus Radio - Sliven ...)

                        Comment


                          #13
                          New beta v.58 posted

                          Hi Flame,

                          Just posted beta v58 here (http://board.homeseer.com/showpost.p...45&postcount=1). That should solve your problems. For radiostations, I tested those I could. There is a clear distinction between the Sonos supported radio stations like Sirius/Pandora ... and the regular streaming radio stations. The latter don't provide a proper tagging like tittle/artist/album-art/next track info but just some streaming info which usually contains artist and track separated by a "-". However, when the artist name or the tittle has it's own "-" character in them, it is impossible for the plug-in to figure out what is what so in those circumstances the info might be off. Moreover some internet stations do generate a bit of chatter in the streaming info tag, like their radiostation name etc, so they will cause your events to fire as well. I had it running here whole day yesterday, I kinda like the "say your artist/track" info in the background (was using speaker on my PC with S5 players in the background) and the occasional info that comes trough like the radio station name didn't bother me.

                          Have fun, let me know how it is going for you.

                          Dirk

                          Comment

                          Working...
                          X