Announcement

Collapse
No announcement yet.

Repeat Last spoken phrase ?

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

    Repeat Last spoken phrase ?

    Hi Dirk, First of thank you for all the work that has gone into this plugin, its easily the most used one in my environment. Great job!

    Is there a way to maybe populate a global variable with the last phrase spoken so we could have an option to repeat the last announcement if it was missed?

    I see the announcements are stored in the C:\Program Files (x86)\HomeSeer HS3\html\Sonos\Announcements folder, so some scripting could be done to play the last group of wav files played for a linkgroup but modified dates of the files don't always make sense, (maybe it uses the original modified date of the wav file as your plugin isn't changing the file) I just wanted to check that something like this isn't already possible without another script.

    Hope this makes sense.

    Thank you,
    Mike

    #2
    Originally posted by mikesnook View Post
    Hi Dirk, First of thank you for all the work that has gone into this plugin, its easily the most used one in my environment. Great job!

    Is there a way to maybe populate a global variable with the last phrase spoken so we could have an option to repeat the last announcement if it was missed?

    I see the announcements are stored in the C:\Program Files (x86)\HomeSeer HS3\html\Sonos\Announcements folder, so some scripting could be done to play the last group of wav files played for a linkgroup but modified dates of the files don't always make sense, (maybe it uses the original modified date of the wav file as your plugin isn't changing the file) I just wanted to check that something like this isn't already possible without another script.

    Hope this makes sense.

    Thank you,
    Mike
    Are these announcements "fixed" or "variable" ie an event that has some static text or the output of some PI or Service that is variable in nature (ex weather announcement, news ...). If the former, I'd recommend you make announcement files and use those to play on any player in any linkgroup (see help file how to play files). If the latter, the PI always overwrites existing files, so the name tend to stay the same. You could however write a script that copies the .wav file into another file and now you can play that file as many times as you want. The tricky part here is to synchronize your script with the actions happening during the TTS event. Example: you copy to early and you have the wrong info, you copy while it happens, you are likely to get multiple access errors; you copy too late and you may have the next announcement starting to overwrite the announcement file. I do believe that you can add variables like time etc to the announcement string, maybe you can do a global string (virtual device). Now all of this requires scripting SOOOO I'm sure you can script it by storing the string somewhere and the script retrieves it and issues an HS.Speak command with that string. No need to copy .wav files etc.

    Dirk

    Comment


      #3
      Thanks Dirk, they are almost all using variables., weather, device status etc

      if others require a similar option the below vbs seems to be working, it just gets the most recently created announcement from the folder specified below and plays it as a wav file to a custom link group.

      This allows me to have a button on our touch screens to click if we missed an announcement.


      Code:
        
       Sub Main(Parm As Object)
       Dim fso, path, file, recentDate, recentFile, announcementLocation
       announcementLocation = "C:\Program Files (x86)\HomeSeer HS3\html\Sonos\Announcements"
       fso = CreateObject("Scripting.FileSystemObject")
      recentFile = Nothing
      For Each file in fso.GetFolder(announcementLocation).Files
        If (recentFile is Nothing) Then
          recentFile = file
        ElseIf (file.DateLastModified > recentFile.DateLastModified) Then
          recentFile = file
        End If
      Next
       If recentFile is Nothing Then
        hs.WriteLog("Repeat Last Speech", "no recent files")
      Else
        hs.speak (recentFile.path, False, "$SONOS$repeatLinkGroup$DEFAULT:*")
        hs.WriteLog("Repeat Last Speech", "Recent file to speak will be:" & recentFile.path)
      End If
       End Sub
      Cheers!
      Mike

      Comment

      Working...
      X