Does "Upcoming Media Card" "Sonarr Upcoming Media" still work?

OK, figured out what was going on here.

I am running v4.

/api is dead in v4. I just confirmed this with the Sonarr Discord

We need to find a new python dev to figure out how to fix this up!!

I agree about this being the best interface for Sonarr/Radarr on HAOS

Oh so you installed Sonarr v4 beta? Interestingly Radarr v4 still uses /api v3.
Man I’m hoping you can find a solution. I would like to upgrade to Sonarr V4 after it’s out of beta.

Can you please post here if/when there’s any news? I REALLY don’t want to lose this capability considering they are the nicest looking integrations on Home Assistant and how useful it is.

I’m trying, but I’m not a python coder by any means. HTML, CSS a little script but that’s it.

Jumping into HAOS has been an exercise in testing my patience.

I’m going through the code and seeing if I can figure out if there were any changes to the returned data. But I don’t have a json return of apiv2 to compare.

That being said, hopefully, we can find a competent Python coder that can jump in.

I forked it myself - GitHub - quadcom/sensor.sonarr_upcoming_media_v3: 📺 Sonarr component to feed Upcoming Media Card. Trying to get v3-v4 support

I’m no expert either. But both my Sonarr V3 and Radarr V4 use the path below:

http://{insert your sonarr/radarr 
address:port}/api/v3/calendar?apikey={insert your sonarr/radarr API 
key}

I know that Sonarr V4 beta mentioned they removed the V2 API. However, I think it still uses API V3 looking at the path above. Maybe it’s wishful thinking. Can you please double-check on Discord if they also removed API V3?

mkanet,

can you run a /api call and send me the raw JSON (un-truncated, preferably).

I have a Python coder willing to help me parse through the returned data and try to figure this out.

you could pastebin it

Totally! Ill provide the full raw API response later this evening via PM. I have to go pickup the kids from school. I will also provide any other information youll need after that until we hopefully have a solution. Thanks!

Just an FYI, my guy said he would look at the two JSON outputs and the scripts tomorrow. I sent him mine already; we just need yours.

If you’re running Sonarr v4 change the following lines

card_item['fanart'] = re.sub('.jpg', '_t.jpg', img['url']) to card_item['fanart'] = re.sub('.jpg', '_t.jpg', img['remoteUrl'])

and

card_item['poster'] = re.sub('.jpg', '_t.jpg', img['url']) to card_item['poster'] = re.sub('.jpg', '_t.jpg', img['remoteUrl'])

@bacco007 so, if I have Sonarr V4,

Edit the file:
\config\custom_components\sonarr_upcoming_media\sensor.py

Change:

card_item['fanart'] = re.sub('.jpg', '_t.jpg', img['url'])

to

card_item['fanart'] = re.sub('.jpg', '_t.jpg', img['remoteUrl'])

.

AND…
.

Change:

card_item['poster'] = re.sub('.jpg', '_t.jpg', img['url']) 

to

card_item['poster'] = re.sub('.jpg', '_t.jpg', img['remoteUrl'])

I will do this as soon a Sonarr V4 is out of beta. Thank you so much for this!

1 Like

Yes, that should fix the problem (did for me)

1 Like

This still does not address the change in URL for API calls in v4.

edit line 142 to add in ‘v3’

api = requests.get('http{0}://{1}:{2}/{3}api/v3/calendar?start={4}'

I’m not sure which lines you are referring to. I’ve looked at my sensor.py, and those lines do not exist.

Which lines are you referring to in this source code?

@quadcom thanks for replying. Here they are:

Change:

Change:

You can edit your local sensor.py. Mine is located here:
\config\custom_components\sonarr_upcoming_media\sensor.py

I still haven’t upgraded to Sonarr V4 since its still in beta. Maybe you can try it after changing these lines? I can’t imagine Sonarr V4 being that much different than Radarr V4. The developer purposefully tried to keep things consistent between the 2 projects.

In any case, maybe @bacco007 can elaborate.

Having some trouble getting the card to populate here.

I’ve done all the sensor.py edits and it’s connecting, according to the HA states, but not populating and reads as 0 upcoming, but calling the API works fine.

(I can only post one embed per post as a new member, sorry if you get too many notifications!)

I still haven’t upgraded to Sonarr V4. I’m hoping @bacco007 or someone else here who’s successfully done this for Sonarr V4 can elaborate. I’m not sure how else to get a hold of @bacco007

I’m here :wink:

I’m pretty sure I’m running sonarr 4 and it works fine - I’ll check tonight though

2 Likes

Thank you. We just need to see what specifically you modified in the original code for Sonarr V4 support. A couple of people unsuccessfully tried to follow your suggestion. I think there may be something we’re missing besides making the changes below:

This is sensor.py file that I run - you should be able to copy this completely and paste it into your sensor.py (overwrite the whole file) and it should work fine

(To confirm, yes, I’m running Sonarr v4)

4 Likes