avraham / hass_radarr_sonarr_search_by_voice

Add movies to radarr by voice
GNU General Public License v3.0
47 stars 8 forks source link

Fix some Typo, New Search Vocal for Sonarr, fix issues with ssh for docker and add some documentation for sonarr use, #14

Closed CyberPoison closed 3 years ago

CyberPoison commented 4 years ago

After some tests i have get some issues with ssh because this kind of access

download_movie: /usr/bin/ssh -i /config/id_rsa -o UserKnownHostsFile=/config/known_hosts root@server_ip '/bin/bash /usr/share/hassio/homeassistant/scripts/download.sh "{{movie}}" 0'
search_movie: /usr/bin/ssh -i /config/id_rsa -o UserKnownHostsFile=/config/known_hosts root@server_ip '/bin/bash /usr/share/hassio/homeassistant/scripts/download.sh "{{movie}}" 1'
download_option: /usr/bin/ssh -i /config/id_rsa -o UserKnownHostsFile=/config/known_hosts root@server_ip '/bin/bash /usr/share/hassio/homeassistant/scripts/download.sh "{{option}}" 2'

it corrupt the single quotes for other languages movies e.g for french text ( Okay Google recherche le film L'home et le Pistolet d'or) .

That two quotes can cause issue on IFTTT and cause problems in Webhook request so <<<>>> 3x is used, you still need of { 2x to get TextField Validated (Surrounded by grey space THIS IS VERY IMPORTANT)

so now IFTTT can passthrough apostrophe on queries, but not the ssh, so today is sunday i have able to figure out a way to get it working because ssh already use single quotes to pass the command on the node and after some time i get it working just replacing the path on download.sh and on shellcommand.yaml to the container path /config --> https://www.home-assistant.io/docs/configuration/

so when docker is running the files like e.g hass_radarr_search_by_voice.py or /scripts/downloads.sh is on /config and not in /usr/share/hassio/homeassistant/ so i have able to run it since the path have been re-writed to the container path and not node path so as i understand now it should work because it works like this

Vocal request ---> IFTTT -- webhook --> HomeAssisntant Automation --> Script-- > /bin/bash /config/scripts/download.sh "L'home aux Pistolet d'or" 0 ---> python3 /config/hass_radarr_search_by_voice.py "L'home aux Pistolet d'or" 0 --> google home device

so on my environment it works and i really suggest to use this method because the ssh like https://community.home-assistant.io/t/quotes-ssh-and-docker-shell-commands/234935

can cause problems/issues when passing single quotes /apostrophe on ssh request so the best way still passing directly to the container the script it works because the docker image of Home Assistant have (python3) so there is no problem with this but very IMPORTANT NOTE when you trigger the script this cause a log error because braces on {{movies}} where the shellcommand execute cause issue on the execution and return error code: 1

long story but short: trigger the script will cause error but when replaced by titles it don't give any issue so just forget trigger the script just test by vocal search to get the results.

The sonarr Search by vocal, need some tests on diferrent evironments to be sure it works nicely.

avraham commented 3 years ago

I just wanted to say thank you for the Sonarr script. I took the liberty to make some small changes.

I switched from thetvdb service to omdb since the latter is free. It might not be as complete for other uses like search by actor, but I found it good enough.

I also merged all configurable variable into a single/common file for simplicity, and some other minor changes.