catt
catt copied to clipboard
Improvements to `add`
I want two improvements to the add
subcommand.
- I wish it would fall back to using the
cast
subcommand if no video is already playing. - I wish it would fall back to using the
cast
subcommand if it was an unsupported URL.
This is only because I launch catt
from my browser, where I have one command/button for each my chromecasts and I would I would not want many more permutations to be able to queue the videos.
Meanwhile I'll just write a wrapper script
I think those are reasonable feature requests (although from a general user perspective, 1 makes a lot more sense than 2). It's not going to be super-easy to implement, because of the way that the code is currently structured, so I'm afraid it's not going to be at the top of my todo list.
@theychx Thanks, I whipped up a quick wrapper that I will use in the meantime in my browsers (Firefox using youtube 2 player addon, and qutebrowser just using keybinding)
#!/usr/bin/env bash
# Author: Sigurd Bøe
# Open domain code
[[ -x "$(command -v catt)" ]] || { echo "catt not found" ; exit 1 ; }
while (( "${#}" )); do
case "${1}" in
-d)
device="${2}"
d="-d"
shift 2
;;
*)
url="${1}"
shift
;;
esac
done
[[ -z "${url}" ]] && { echo "url not provided" ; exit 1 ; }
case "${url}" in
*youtub*)
youtube="true" ;;
*)
youtube="false" ;;
esac
deviceactive="false"
catt -d "${device}" info > /dev/null 2> /dev/null && deviceactive="true"
if [[ "${deviceactive}" == "true" ]] && [[ "${youtube}" == "true" ]]; then
catt "${d}" "${device}" add "${url}"
else
catt "${d}" "${device}" cast "${url}"
fi
That script looks nice, though I agree that 1 is much more sensible than 2. With 2, I'm not sure I'd want it overwriting your entire playlist if you send a weird URL, but catt should definitely default to "play" if nothing is already playing.
What about optionally?
Hmm, I'm not sure I see the rationale for "add" performing a "cast" on an unsupported URL ever (no matter the option). It's a different operation.