logs.gokuls.in

1 pull request merged across 1 repo

bahdotsh/hopchat

What changed

@home play Ithinno Aadame on jstv used to open YouTube's home page while the assistant said it was playing. There was no tool that could take a title. The new tv_play tool takes a title and an app, and YouTube is the default.

With /home lookups on:

AppAndroid TVLG webOSHome Assistant TVs
YouTubeStarts the top matchStarts the top matchStarts the top match if the TV accepts links
YouTube MusicStarts the top matchStarts the top match in YouTubeStarts the top match if the TV accepts links
Netflix, Prime Video, Disney+, Hotstar and other apps JustWatch listsOpens the title's pageOpens the title's pageOpens the title's page if the TV accepts links
SpotifyOpens a searchOnly opens the appOpens a search if the TV accepts links
Any other appOnly opens the appOnly opens the appOnly opens the app

With lookups off, which is the default, nothing is sent. YouTube, YouTube Music, Netflix, Prime Video, Disney+ and Spotify get a search where the TV takes links. Everything else only opens.

  • The tool's answer says whether it sent a video, opened a page, ran a search or only opened the app. The assistant is told not to say something is playing otherwise.
  • If a lookup fails or finds nothing, the app gets a search or is opened.
  • A catalogue link is used only if the title matches what was asked for. An exact name beats a near one, and a subscription beats a rental.
  • Only a value shaped like a video ID is taken from YouTube's page, only a plain https:// link is taken from JustWatch, and titles are percent-encoded.
  • On Home Assistant, the lookup runs only if the TV takes play_media. A refused link falls back to opening the app.

Separate fix

Any https:// request through ureq panicked, because native-tls-no-default doesn't turn on the feature ureq checks at runtime. This would have crashed on the first lookup. It also affects Home Assistant over https://. The fix has its own commit and adds webpki-root-certs to the build.

Privacy

Lookups are off until someone runs /home lookups on [COUNTRY]. Once on, titles go from this machine to youtube.com or apis.justwatch.com, including @home play X with no app named. The country comes from the language setting unless one is given. The README says all of this.

Known limitations

  • A title page is one press short of playing. Nothing presses play for you.
  • Spotify stays a search, because its IDs take an account to look up.
  • The top YouTube result can be the wrong video.
  • Both lookups use unofficial interfaces, so a change on their side breaks them. A YouTube results page with no videos on it is reported to the owner.
  • The search links are unverified, and an app may ignore them or a title link.

Testing

  • cargo test passes and clippy reports no warnings. CI passes on ffc0d23.
  • Live lookups through the real HTTP client returned a YouTube video ID and a Netflix title link.
  • Home Assistant play is tested against the fake hub, including no play_media and a refused link.
  • The webOS launch payloads are unit tested. The Netflix webOS payload format has not been confirmed against any source or device.
  • The Android TV and webOS play paths have no end-to-end tests.
  • Not tried on any real TV.