avraham / hass_radarr_sonarr_search_by_voice

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

I found a movie, but I wasn't able to add it #16

Closed Shawn9347 closed 2 years ago

Shawn9347 commented 3 years ago

Hi, I am getting this error when testing the script manually. I don't know what could be wrong. radarr/sonarr are both on a different server than home assistant as you can see. They are in docker containers and those paths are the paths for radarr/sonarr. Do I add it like that or the complete path on the host server?

I used the api to get the profile id. It should be these numbers.

config error

avraham commented 3 years ago

Hi, What radarr version are you using? Your paths should work like that.

Shawn9347 commented 3 years ago

I am using radarr v3 and sonarr v3. I managed to fix the issue for radarr when testing the script manually. Doesn't work when talking to the google assistant however. Weirdly it's not working for sonarr when I test the script manually. I have everything the same as radarr and the right api key etc.

avraham commented 3 years ago

One possible problem is that I made these scripts for radarr v2 and sonarr v2 and I haven't upgraded them. There are probably breaking changes in the api v3.

How did you fix the issue with radarr?

There are a few things that can be the problem when adding a movie with voice through Home Assistant.

If everything in the configuration file is correct, even when when adding a movie manually it should send a feedback message through your smart speaker. So, if this works the problem should be on IFTTT webhook / automation part that runs the script by voice.

On Sat, Jan 2, 2021, 1:24 PM Rick notifications@github.com wrote:

I am using radarr v3 and sonarr v3. I managed to fix the issue for radarr when testing the script manually. Doesn't work when talking to the google assistant however. Weirdly it's not working for sonarr when I test the script manually. I have everything the same as radarr and the right api key etc.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/avraham/hass_radarr_sonarr_search_by_voice/issues/16#issuecomment-753531526, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQAXBZLUKTZKIVM4JZVR5DSX6FJHANCNFSM4VQGNYTQ .

Shawn9347 commented 3 years ago

I changed the script to work with https and added my domain urls. So it should work with v3. I have checked the scripts in home assistant like a 1000 times so yeah. I'll check again. Same ifftt.

Shawn9347 commented 3 years ago

Is there any way to see logs?

Shawn9347 commented 3 years ago

I fixed sonarr as well. Now the rest.

avraham commented 3 years ago

I have a modified version locally that has logs capabilities. I'll push the change to GitHub in 1-2 days

On Sat, Jan 2, 2021, 2:23 PM Rick notifications@github.com wrote:

I fixed sonarr as well. Now the rest.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/avraham/hass_radarr_sonarr_search_by_voice/issues/16#issuecomment-753537374, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQAXB3CS2J2QYIU4TY73FLSX6MHZANCNFSM4VQGNYTQ .

Shawn9347 commented 3 years ago

I got it working last night. It was too late to respond but here I am. Everything is working. Things I changed: I changed the python file to work with https. Put it my domain urls. Also at first I had the scripts path wrong. I thought I wasn't using docker but I forgot somehow. I have too many servers xD. So I changed the scripts path to /confing/scripts. the "/" in front is really important otherwise it doesn't work. Also you have to change the webhook url from homeassistant to your https url. And add external url in homeassistant for ifttt to work at all.

AlexGreenUK commented 3 years ago

@Rickexe I am having the same issue with the not being able to add it part and I also run Radarr/Sonarr V3. Would you mind giving a bit more detail about the parts you changed?

Thanks

I got it working last night. It was too late to respond but here I am. Everything is working. Things I changed: I changed the python file to work with https. Put it my domain urls. Also at first I had the scripts path wrong. I thought I wasn't using docker but I forgot somehow. I have too many servers xD. So I changed the scripts path to /confing/scripts. the "/" in front is really important otherwise it doesn't work. Also you have to change the webhook url from homeassistant to your https url. And add external url in homeassistant for ifttt to work at all.

Shawn9347 commented 3 years ago

Can you include screenshots of your config files? Do you have the external url set up in home assistant? Do you have your containers set up with https? I don't know if this is a must but for me it wasn't working with http.

AlexGreenUK commented 3 years ago

This config doesn't have the https but I have tried it with the https as well and I also edited the .py file and put the addresses in there instead of the variables.

When I ask it to download a movie I already have in radarr it tells me it's already there so I know it can see radarr. It's only when I try to add a movie that I don't have. I also have external URL set up.

inCollage_20210113_133235729

avraham commented 3 years ago

Hi, I'm testing with radarr v3 and it seems to work. With what movie are you testing it?

spicerackk commented 3 years ago

I am having the same issue as above. The script now works, it can detect if I have a movie in my list, however if it does find one, it is unable to add. I have 0 idea on how to modify python to allow https, an updated guide would be really helpful!

avraham commented 3 years ago

I updated the code. Update to the latest, add your IP addresses with protocol https in the config file. Let's see if that fixes it.

spicerackk commented 3 years ago

ok will do, thank you!

spicerackk commented 3 years ago

Tried running again after updating and got this error:


21 Bridges
0
Warning. tmdmid_api_key_v3 (optional)(recommended) is not set. You won't be able                                                                     to search movies by actor or actress and your speaker's feedback will miss cast                                                                     details for movies. https://www.themoviedb.org/settings/api v3 auth
Traceback (most recent call last):
  File "./hass_radarr_search_by_voice.py", line 352, in <module>
    downloader = MovieDownloader(query, int(mode))
  File "./hass_radarr_search_by_voice.py", line 41, in __init__
    media_list = r.json()
  File "/usr/lib/python3.8/site-packages/requests/models.py", line 898, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)```
avraham commented 3 years ago

There's probably an error on your server_url value in the config file. It should look something like this. [Radarr] server_url = https://192.168.1.140:7878

Use http or https depending on your setup.

spicerackk commented 3 years ago

if i have a base URL set does that need to be put in also?

spicerackk commented 3 years ago

server_url = http://192.168.86.245:7878/radarr
api_key = *api_key*
root_directory = /mnt/media/Movies
profile_id = 4```

This is what I have tried, I'm not sure how to pull profile ID so could that be an issue?
spicerackk commented 3 years ago

Also getting an error saying something about `no connection adapters were found for '192.168.86.6:8123/api/services/tts/google_say'

avraham commented 3 years ago

So, if you put http://192.168.86.245:7878/radarr in the browser it loads the radarr UI, right?

About the profile_id, you can run the following on the command line. It will return an array of your radarr movies with several values, like "qualityProfileId", just copy the integer value of a movie that has the profile you use.

curl -X GET "http://localhost:7878/api/v3/movie?apiKey=API_KEY_HERE" -H "accept: application/json"

Make sure to replace it with your IP and API_KEY

avraham commented 3 years ago

If the command curl -X GET "http://localhost:7878/api/v3/movie?apiKey=API_KEY_HERE" -H "accept: application/json" doesn't work, then your server_url value in the config file is also wrong. It will be the same base url right before the /api/ part.

avraham commented 3 years ago

Also getting an error saying something about `no connection adapters were found for '192.168.86.6:8123/api/services/tts/google_say'

The value of tts_service in the config file should match of the Text to speech service_name on your home assistant configuration.yaml

Here's the important part of my configuration.yaml

tts:

  • platform: google_translate cache: true service_name: google_say
spicerackk commented 3 years ago

Ok, so, I got it working from Terminal, and I also have the IFTTT set up. If I ask my speaker to search for the series $, it responds like it should (Searching for $), but it doesn't add it to Sonarr or Radarr.

spicerackk commented 3 years ago

New error:


Traceback (most recent call last):
  File "./hass_radarr_search_by_voice.py", line 352, in <module>
    downloader = MovieDownloader(query, int(mode))
  File "./hass_radarr_search_by_voice.py", line 55, in __init__
    self.add_movie(data)
  File "./hass_radarr_search_by_voice.py", line 147, in add_movie
    with open(self.HASS_SCRIPTS_PATH+"/last_download_added.txt", "w") as myfile:
FileNotFoundError: [Errno 2] No such file or directory: '/config/scripts/last_download_added.txt'```
spicerackk commented 3 years ago

I'm also struggling to integrate it with HA, I am running Home Assistant OS on r-pi, but not sure how to copy the files across.

avraham commented 3 years ago

New error:

Traceback (most recent call last):
  File "./hass_radarr_search_by_voice.py", line 352, in <module>
    downloader = MovieDownloader(query, int(mode))
  File "./hass_radarr_search_by_voice.py", line 55, in __init__
    self.add_movie(data)
  File "./hass_radarr_search_by_voice.py", line 147, in add_movie
    with open(self.HASS_SCRIPTS_PATH+"/last_download_added.txt", "w") as myfile:
FileNotFoundError: [Errno 2] No such file or directory: '/config/scripts/last_download_added.txt'```

Ok. Home Assistant OS (hassos) Is relatively new and it wasn't around when I wrote the instructions. That error is because the file structure for hassos is different so the _scriptspath value changes too.

I don't have a hassos installation, but according to this (https://community.home-assistant.io/t/file-structure-in-hassos/194491) it should be "/mnt/data/supervisor/scripts". I'm taking a guess here. It's quite likely you will need to create the scripts directory.

About how to copy or access your Home Assistant config directory, you can install a Samba add-on like it says in this other forum question. (https://community.home-assistant.io/t/how-to-access-root-local-directory-to-insert-images-required-for-person-component/185427)

One important step is to give executable permissions. You might need to install an ssh add-on for that.

The script is still usable even with that error. It's just trying to save to a text file the movie id of the movie you just added to radarr in case you wish to implement a voice command to delete the last entry. The full search option that gives you a list of movies won't work either, but we can sort that out later.

ados8 commented 3 years ago

Having this very same issue. Movie was found but cannot be added, have not configured any further as I can't get even the testing stage to work. Using Radarr V3 and HTTP Confirmed API key and tried through root console, HA docker and Radarr docker.

Even through Radarr container console it fails. image

Really want to use this but few hours in and about to admit defeat.