Jump to content

Emby Connect API/Radarr


fizzyade

Recommended Posts

fizzyade

Is there a problem with the API and Radarr?

 

At some point in the past 6 months Emby has stopped updating when radarr has completed a download, it used to work. 

 

I have connection set up to my Emby server in Radarr and I have every option enabled in the connection, radarr is able to successfully perform a connection test with the Emby server.
 
Radarr version 0.2.0.1358
Emby Server version 4.3.0.2
 
Here's the snippets from both the radarr and emby logs when the update event is "performed".
 
Radarr:
 
19-8-14 05:41:47.3|Debug|MediaBrowserProxy|Looking for error in response: Res: [POST] http://172.29.13.9:8096/mediabrowser/Library/Media/Updated: 204.NoContent

Emby:

2019-08-14 05:41:47.357 Info HttpServer: HTTP POST http://172.29.13.9:8096/mediabrowser/Library/Media/Updated. UserAgent: Radarr/0.2.0.1358 (Linux 4.19)
2019-08-14 05:41:47.359 Info HttpServer: HTTP Response 204 to 172.17.0.10. Time: 2ms. http://172.29.13.9:8096/mediabrowser/Library/Media/Updated

Any ideas?

 

I resorted to just scanning the library more frequently, but I'd like to get this working again.  I can find a reference to a change at the beginning of the year, but as far as I can tell changes were applied to the Radarr code.

 
Link to comment
Share on other sites

PenkethBoy

why not use the real-time monitor - see library settings (for you movie libraries) - make sure to click the advanced option so you can see the real-time monitor option

Link to comment
Share on other sites

fizzyade

why not use the real-time monitor - see library settings (for you movie libraries) - make sure to click the advanced option so you can see the real-time monitor option

i can’t, my media is mounted via a nfs share.

Link to comment
Share on other sites

fizzyade

Hi there, please go over an example and attach the complete emby server log. thanks.

Ok, just did it.

 

https://fizzya.de/s/jGbJPHJwytB3mee

 

Just added a movie to radarr, it downloaded but didn't update the library.  You can see from the log that Radarr contacted Emby.

Edited by fizzyade
Link to comment
Share on other sites

fizzyade

Hi there, please go over an example and attach the complete emby server log. thanks.

is the file accessible, i know you had issues with my links in the past when i had a cloudflare misconfiguration.

Link to comment
Share on other sites

fizzyade

Hi there, please go over an example and attach the complete emby server log. thanks.

 

Was the log file of any use?  Any insight into this?

Link to comment
Share on other sites

fizzyade

Sorry, you didn't really discuss the example. What are we looking at exactly?

 

me finishing a download started from radarr, radarr seemingly connects to the emby update endpoint (as you can see in my original post and in the log file) but the library doesnt refresh as expected.

 

it used to work in emby, but some time in thr past 6 months it has stopped working. im running very up to date versions of both.

Link to comment
Share on other sites

fizzyade

That's still a generalization and not a specific example, meaning, what, when, where, etc.

My emby server is running on 172.29.13.9. Radarr is running on the same host.

 

I have a connection set up in radarr to emby, it’s configuration is:

 

On Grab Enabled

On Download Enabled

On Upgrade Enabled

On Rename Enabled

 

server is set to 172.29.13.9 port 8096

server key is set to a valid displayed in Emby.

 

Send notifications is off (tried on, makes no difference)

Update library enabled

 

Pressing test returns with succesful,

 

 

in the log file i searched at appoximately 22:40 for the movie “Casino” in radarr, this started a download in nzbget which finished shortly after. Once radarr had finished processing the file at approximately 22:40 it informed my Emby server that the library had been updated, this can be seen in the log. However, no actual update of the library took place, Emby did not report the new movie as being available until I had manually forced a library scan.

 

In my very first post I have included both the Emby side and Radarr side of the “update library” conversation, these lines look identical to the version in the log file which you asked for.

 

Radarr is unable to update Emby libraries for whatever reason, as you can see soembody ls is also having this problem. whether its an api change your side or something broken in radarr, i was just hoping you’d be able to shed some light.

Link to comment
Share on other sites

fizzyade

ok, this appears to be radarr. I enabled debug logging and it showed more information, radarr is sendind the updated message but the path it passes in is local to radarr, the substitution system is not used in radarr it would appear for notifications, i set one up and it didnt work.

 

Time to update my bug report on radarr.

Link to comment
Share on other sites

fizzyade

I can fix this by using a custom script and handling the path substitution myself and then call the emby endpoint with the Updated message.

Link to comment
Share on other sites

ok, this appears to be radarr. I enabled debug logging and it showed more information, radarr is sendind the updated message but the path it passes in is local to radarr, the substitution system is not used in radarr it would appear for notifications, i set one up and it didnt work.

 

Time to update my bug report on radarr.

 

When we submitted these changes to radarr, both sides acknowledged that this would be a problem and that we could always return to it in the future and do additional development to address it. So the paths need to match what is in emby server.

 

The server's path substitution settings could be used but it can't be guaranteed to produce the right result. But we could incorporate it just for the sake of trying to improve it from where it currently is.

 

If you want it bulletproof, then radarr needs to send the correct path and that means they may need to add their own path substitution settings. But of course, they may not want to have to do all of that work just for this one thing.

Link to comment
Share on other sites

fizzyade

its ok, now that i know what is going on I’m writing a script to send the correct path to emby, i have the emby api working for triggering the refresh, but its late here now so i’ll finish it tomorrow.

 

That way instead of using the emby connection in radarr i’ll use the script connection and call the api myself.

  • Like 1
Link to comment
Share on other sites

That will work. I think we can also have it do a reverse path substitution and while that won't guarantee the right result for all users, it probably will for most.

  • Like 1
Link to comment
Share on other sites

fizzyade

it would be nice if in the log file if the path excluding the last bit doesn’t exist then it should say something like “API Request to scan folder failed, path does not exist <path>”

 

At the moment the log just says triggering scan on folder. It would have made it easier to spot, Im definitely not the first to come up against this and I wont be the last, so providing a hint in the log cant be a bad thing,

 

The git issue I filed I posted a script which is actually one that came from here that i found when going to upload my own, i must have downloaded it a long time ago. i modified it to do the path substiution.

 

Theres probably more chance of you guys putting in a path substitution (maybe per api key) than I think radarr actually fixing the issue, this would absolutely fix it for me as all my media is mounted under a single folder, the mismatch occurs because of some complexity and me having to map stuff in such a way to allow files to be moved rather than copied which can take a while.

Link to comment
Share on other sites

fizzyade

Yes i agree that would make sense. Thanks for the feedback.

Not a problem, we got there in the end! Your interaction with us is one of the major things that differentiates you from your competitor.

 

Emby is absolutely rock solid for me, and we use it a LOT on multiple devices in and outside of our local network! It never gives me grief, and I am running the beta server, I always update it when a new update is available. Switching 6 months ago was the best decision I made, thanks for all your efforts.

 

Even my wife loves emby, she loves the boxsets feature.

Link to comment
Share on other sites

I can fix this by using a custom script and handling the path substitution myself and then call the emby endpoint with the Updated message.

I would be interested in this script. In my case I'm using 2 different mounts of the same media. I use Rclone for Sonarr/Radarr and use Plexdrive for Emby (read only)

Link to comment
Share on other sites

fizzyade

I would be interested in this script. In my case I'm using 2 different mounts of the same media. I use Rclone for Sonarr/Radarr and use Plexdrive for Emby (read only)

#!/bin/bash

apiKey="<your emby api key>"
url="http://<emby server ip>:8096"
local_movie_path="/unraid/Movies/"
local_tv_path="/unraid/TV/"
remote_movie_path="/mnt/Movies/"
remote_tv_path="/mnt/TV/"

if [ -z "$apiKey" ]
then
      printf "*******************************\n"
      printf "* Error: No API Key specified.*\n"
      printf "*******************************\n"
      exit 1
fi

if [ -z "$url" ]
then
      printf "********************************\n"
      printf "* Error: No Emby URL specified.*\n"
      printf "********************************\n"
      exit 1
fi

if [ -z "$sonarr_eventtype" ] && [ -z "$radarr_eventtype" ]
then
      printf "******************************************************************\n"
      printf "* Error: Must be called as a custom script from Sonarr or Radarr.*\n"
      printf "******************************************************************\n"
      exit 1
fi

#SONARR
if [ "$sonarr_eventtype" == "Download" ];  then
  UpdateType="Series"
  Path=$(echo "$sonarr_episodefile_path" | sed "s|$local_tv_path|$remote_tv_path|")
fi

if [ "$sonarr_eventtype" == "Rename" ]; then
  UpdateType="Series"
  Path=$(echo "$sonarr_episodefile_path" | sed "s|$local_tv_path|$remote_tv_path|")
fi

if [ "$sonarr_eventtype" == "Test" ]; then
  exit 0
fi

# RADARR
if [ "$radarr_eventtype" == "Download" ]; then
  UpdateType="Movie"
  Path=$(echo "$radarr_movie_path" | sed "s|$local_movie_path|$remote_movie_path|")
fi

if [ "$radarr_eventtype" == "Rename" ]; then
  UpdateType="Movie"
  Path=$(echo "$radarr_movie_path" | sed "s|$local_movie_path|$remote_movie_path|")
fi

if [ "$radarr_eventtype" == "Test" ]; then
  exit 0
fi

if [ -z "$UpdateType" ] || [ -z "$Path" ]
then
      printf "*************************************************\n"
      printf "* Error: Script unsupported for this event type.*\n"
      printf "*************************************************\n"
      exit 1
fi

curl -s -X POST "$url/mediabrowser/Library/Media/Updated?api_key=$apiKey" -H "accept: */*" -H "Content-Type: application/json" -d "{ \"Updates\": [ { \"Path\": \"$Path\", \"UpdateType\" \"$UpdateType\" } ]}"
Here you go, you need to fill in the variables at the top appropriately.

 

the movie_local_path and movie_remote_path represent the mount locations to the same destination folder, the script will replace the local part with the remote part if it matches.

Edited by fizzyade
  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...