raycast / script-commands

Script Commands let you tailor Raycast to your needs. Think of them as little productivity boosts throughout your day.
https://raycast.com
MIT License
5.96k stars 885 forks source link

Raycast / Endel Scripts: stop or pause #717

Closed mauzon closed 2 years ago

mauzon commented 2 years ago

Is there any way (or script) to pause or stop Endel's playback?

dehesa commented 2 years ago

There is a bunch of Endel scripts here. I have no idea what Endel is, but maybe what you look for is there.

mauzon commented 2 years ago

Thanks @dehesa, I reviewed it already. All of them are about starting some soundscape to play. I was looking for a way to pause or stop its playback, perhaps Endel.io's dev can advise.

dehesa commented 2 years ago

The script developer is @huangsemao, maybe he can tell us how we can do this. You piqued my curiosity @mauzon, so I went and downloaded the app and I am giving it a try. I would be curious how Sergey was able to discover the URL scheme options.

huangsemao commented 2 years ago

Hi guys,

I asked Endel's support - do they have any URL-Scheme or CLI to change soundscape or volume?

They told me their URL-Scheme

Our developers are telling me that we have an internal scheme for these purposes. For example, you can start a soundscape using it like this https://endel.io?type=playing_mode&value=focus. Unfortunately, there are no controls for audio volume in the spec. They are also warning that this scheme is subject to change and they can't guarantee that it will work in the future

Then just using logic and this example I found more commands:

URL: endel://?type=playing_mode&value=mode Modes: study, recovery, relax, focus, sleep, plastikman, alanwatts, grimes

URL: endel://?type=scenario&value=scenario&duration=1200 Scenarios: sports, working, meditation, unwind, studies, powerNap, selfCare, reading, yoga

URL: endel://?type=alarm URL: endel://?type=timer

For such investigation, you could also search strings in the app binary using Hex Editor(e.g. Hopper Disassembler). BUT this method may be illegal, so I won't recommend it

dehesa commented 2 years ago

Great, thanks for the thorough explanation, @huangsemao. If I continue using the app after some weeks, I may build a Raycast extension for it listing the scenarios and letting you choose duration, etc. That would require contacting Endel support again, but they seem to be helpful. Also, any of you may want to pursue that, @huangsemao or @mauzon 😆

mauzon commented 2 years ago

Awesome! Thanks a lot @dehesa! I've built PomoDone App integration (macOS version) using Bash > URL scheme to start my favourite soundscape for my timers, but when my countdown timer is over (or stopped manually, o paused) I'd love to use the best way to stop the playback rather than just exit the Endel (my current workaround).

dehesa commented 2 years ago

That makes sense, but doesn't the play/pause media key works for Endel too? I understand you would like something very specific for Endel, but it is a good work around. You may want to contact Endel support directly @mauzon (same as Sergey did).

huangsemao commented 2 years ago

@mauzon @dehesa as I understand Endel doesn't have play/stop/pause/resume command

I think, the fastest way to pause/resume Endel, install this shortcut(https://www.icloud.com/iclouddrive/067KPYE8-GplLNjv1f-e7Dviw#Endel) and run it by url-scheme shortcuts://run-shortcut?name=endel

mauzon commented 2 years ago

@huangsemao Thanks a lot for the advice and the workaround. This shortcut works with active playback (e.g. YouTube or Spotify) but switching focus to the Endel app solved the problem:

do shell script "open /Applications/Endel.app"
do shell script "open shortcuts://run-shortcut?name=endel"