vishen / go-chromecast

cli for Google Chromecast, Home devices and Cast Groups
Apache License 2.0
835 stars 80 forks source link

Command "load" works, but stays hanging #150

Closed aleqcz closed 1 year ago

aleqcz commented 1 year ago

Hi, is load command supposed to stay in the application indefinitely? If yes, why? Can I tweak it somehow to exit and return to command-line as soon as Chromecast has been instructed to load the remote resource, please?

loxberry@leloxberry:/tmp $ ./go-chromecast-linux-armv7 -a 192.168.1.51 load http://stream-uk3.radioparadise.com/aac-320 and it stays like that. In contrary to:

loxberry@leloxberry:/tmp $ ./go-chromecast-linux-armv7 -a 192.168.1.51 load http://stream-uk3.radioparadise.com/aac-320 ^C loxberry@leloxberry:/tmp $ ./go-chromecast-linux-armv7 -a 192.168.1.51 status Default Media Receiver (PLAYING), unknown, time remaining=61s/0s, volume=0.20, muted=false loxberry@leloxberry:/tmp $

Thanks

vishen commented 1 year ago

Be default the load command stays alive until the media finished playing. This is kind of a legacy thing when the load command only worked for locally playing media, where the load command spins up a HTTP server for the chromecast to load through.

There is a --detach flag that should exit after sending the load command to the chromecast:


$ go run main.go load --help
Load and play media files on the chromecast, this will
start a HTTP server locally and will stream the media file to the
chromecast if it is a local file, otherwise it will load the url.

If the media file is an unplayable media type by the chromecast, this
will attempt to transcode the media file to mp4 using ffmpeg. This requires
that ffmpeg is installed.

Usage:
  go-chromecast load <filename_or_url> [flags]

Flags:
  -c, --content-type string   content-type to serve the media file as
      --detach                detach from waiting until media finished. Only works with url loaded external media
  -h, --help                  help for load
      --start-time int        start time to play media, in seconds
      --transcode             transcode the media to mp4 if media type is unrecognised (default true)```
aleqcz commented 1 year ago

Hello @vishen thanks for quick answer. I did not notice there's "--help" specific to the command also, hence did not see this option. It works like a charm, many thanks! A.

vishen commented 1 year ago

@aleqcz Ah perfect, glad that did the trick!