Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1

    Control via sirs / Siri shortcuts (Pengsupport for Siri shortcuts?)

    Hi

    Now that we have Siri shortcuts in iOS, is there a chance that I could control the players via Siri? A start would be play/pause/stop, volume up and down, switch off.

    Anybody done this already?

    Along these lines, would it be possible to include these shortcuts in Peng?

    Cheers,

    Rainer

  2. #2
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    14,656
    Yes, working on it
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com
    New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch

  3. #3
    Quote Originally Posted by pippin View Post
    Yes, working on it
    Any news on this front?

  4. #4
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    14,656
    Quote Originally Posted by rkrug View Post
    Any news on this front?
    No, not really. For now I moved all new functionality to the iPeng redesign. Doesn’t make sense to have to write stuff twice...
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com
    New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch

  5. #5
    Junior Member thouky's Avatar
    Join Date
    Dec 2010
    Location
    Cottenham, England
    Posts
    27

    Siri Squeezebox Control

    Quote Originally Posted by rkrug View Post
    Now that we have Siri shortcuts in iOS, is there a chance that I could control the players via Siri? A start would be play/pause/stop, volume up and down, switch off.

    Anybody done this already?
    Now that the iOS 13 version of Shortcuts allows interaction within Siri, including on HomePods, it seemed worth giving this a go. I decided to implement most of it as a JavaScript script running in Simon Støvring's Scriptable app (https://scriptable.app/), with just the initial Siri interaction in Shortcuts.

    In addition to play/pause/stop it also supports turning players on/off, changing volume, selecting playlists/genres/artists/albums/tracks, and asking what’s playing.

    The script and installation/usage instructions can be found at:
    https://github.com/thoukydides/siri-squeezebox-control

  6. #6
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Posts
    1,329
    Excellent - thanks for doing this. I jumped on it straight away, but I must have missed a step:

    "OK. Something unexpected happened. (Dictation is not supported in Siri.)"

  7. #7
    Junior Member thouky's Avatar
    Join Date
    Dec 2010
    Location
    Cottenham, England
    Posts
    27
    Quote Originally Posted by chill View Post
    Excellent - thanks for doing this. I jumped on it straight away, but I must have missed a step:

    "OK. Something unexpected happened. (Dictation is not supported in Siri.)"
    It sounds like you are attempting to run the Scriptable script directly from Siri, instead of using the Shortcuts app to request input. Unfortunately that does not work (unless you also set Always Run in App, but that breaks the Siri experience); see https://talk.automators.fm/t/dictation-from-siri/3617.

    Instead of using the Add to Siri within Scriptable you need to install or create a shortcut within the Shortcuts app that acts as an intermediary to act for the dictation. Step 2 of the installation instructions on https://github.com/thoukydides/siri-squeezebox-control is to install:
    https://www.icloud.com/shortcuts/4b6...28d204e58c8021

    If you used the Add to Siri option within Scriptable before installing the Shortcut then that will have created a shortcut that just runs the Scriptable script. If you then installed the proper Shortcut then the name would have clashed, so the app would have renamed it automatically to be unique. In this case you will need to delete the wrong shortcut and rename (or reinstall) the correct one.

    If you still can’t get it to work then try running the Scriptable script directly within its app, and the shortcut directly within the Shortcuts app. Both of these should work, albeit without the benefits of Siri.

  8. #8
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,312

    Control via sirs / Siri shortcuts(Pengsupport for Siri shortcuts?)

    This sounds very interesting! I hadn't seen scriptable before...

    Alas, at this point it looks as if I had to translate most of your code
    to German, otherwise it wouldn't work, correct? I'm even having problems
    making Siri understand "Squeezebox". She's always making "Squeeze Box"
    out of it. Maybe I'd have to register the activity under that term
    instead. I'll play with it.

    --

    Michael

  9. #9
    Junior Member thouky's Avatar
    Join Date
    Dec 2010
    Location
    Cottenham, England
    Posts
    27
    Quote Originally Posted by mherger View Post
    This sounds very interesting! I hadn't seen scriptable before...
    Scriptable is quite a powerful tool. It is a lot easier doing anything non-trivial in Javascript than within Shortcuts' visual programming environment. The main limitation currently is that it can only present information to Siri, not request input. Hence, any non-trivial interaction within Siri requires Shortcuts to be used to obtain the necessary input first.

    Alas, at this point it looks as if I had to translate most of your code
    to German, otherwise it wouldn't work, correct?
    Yes, I'm afraid that all of the language processing in the script is currently just for English. My foreign language skills aren't adequate for it to be worth me attempting translations...

    If you don't mind the responses being in English then I think the only required changes to support input in a different language are:
    • The commands and componentPatterns constants which do the main command parsing. commands provides the structure of the commands with different sentence structures, and componentPatterns provides the detailed regexps for the components of those commands and synonyms that can be used.
    • The digits array which is used to convert words for single-digit numbers into their values. Siri in English tends to use words for single digit numbers, but numerals for larger values. Both need to be handled for setting volume, or for matching against playlist names like "Radio 2".
    • The regexp used in doPlaylistLoad for the assignment to compoundParsed. This is used to handle search terms like "album|track by artist".

    Nothing else within the script applies any meaning to the input.

    Unfortunately, construction of responses is littered throughout the script. Translating all of the output would be a much bigger job.

    I'm even having problems making Siri understand "Squeezebox". She's always making "Squeeze Box" out of it.
    You could rename the shortcut(s) to any other trigger phrase that you like.

    However, this touches on a problem with my script in its current form. Siri's speech recognition attempts to apply its own sense of context to what it hears... which the script then supplies to LMS as the search: parameter of the genres, artists, albums, and/or titles commands. Unless Siri ended up with precisely the same spelling the server obviously won't provide a match. It works most of the time for me, but there are a few artist and album names that rarely, if ever, work.

    For playlists the script retrieves all of the playlist names and performs the matching on the client, which provides some scope for checking alternatives, such as allowing words to be substituted for numerals. Actually, this local matching is also applied to the other queries, mainly to restrict the results of the albums search to matches in the album title rather than those that only match a track title on the album... but it doesn't help if the required item wasn't returned by the server in the first place.

    Using this approach for artists, albums, and titles would probably be too slow (and consume too much memory) for Scriptable to run in the Siri context... at least not without keeping a local cache.

  10. #10
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Posts
    1,329
    Quote Originally Posted by thouky View Post
    It sounds like you are attempting to run the Scriptable script directly from Siri, instead of using the Shortcuts app to request input. Unfortunately that does not work (unless you also set Always Run in App, but that breaks the Siri experience); see https://talk.automators.fm/t/dictation-from-siri/3617.

    Instead of using the Add to Siri within Scriptable you need to install or create a shortcut within the Shortcuts app that acts as an intermediary to act for the dictation. Step 2 of the installation instructions on https://github.com/thoukydides/siri-squeezebox-control is to install:
    https://www.icloud.com/shortcuts/4b6...28d204e58c8021

    If you used the Add to Siri option within Scriptable before installing the Shortcut then that will have created a shortcut that just runs the Scriptable script. If you then installed the proper Shortcut then the name would have clashed, so the app would have renamed it automatically to be unique. In this case you will need to delete the wrong shortcut and rename (or reinstall) the correct one.

    If you still can’t get it to work then try running the Scriptable script directly within its app, and the shortcut directly within the Shortcuts app. Both of these should work, albeit without the benefits of Siri.
    Thank you - got it now. I thought I'd followed the steps, but at one point my phone told me that it couldn't install the shortcut because it's from an untrusted source - but it seemed to skip past that when I clicked 'Add to Siri'. That was clearly the wrong thing to do.

    In their infinite wisdom Apple don't let you see the option to allow untrusted shortcuts until you first install and run a shortcut from their gallery. I'm slow to criticise Apple, but that's just dumb, sorry.*

    So after allowing untrusted shortcuts, I was able to complete the installation as intended. It's working well now. Siri is struggling to understand me at the moment because a cold virus this week has robbed me of my voice! But I've managed to make it do a few things, and am looking forward to doing more when my voice returns.

    @Michael - a couple of times Siri has repeated the word 'Squeezebox' back to me, and she says it 'Squeezerbox'**. Maybe she'll understand you better if you say that!

    EDIT:
    * because the only way to sort that out is to Google the issue.
    ** or perhaps 'Squeezabox'
    Last edited by chill; 2019-10-20 at 09:15.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •