Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please finally fix notify flow #975

Closed
CurlyFlow opened this issue Mar 17, 2024 · 34 comments · Fixed by HaveAGitGat/Tdarr_Plugins#600
Closed

Please finally fix notify flow #975

CurlyFlow opened this issue Mar 17, 2024 · 34 comments · Fixed by HaveAGitGat/Tdarr_Plugins#600

Comments

@CurlyFlow
Copy link

CurlyFlow commented Mar 17, 2024

To make it short, the sonarr part is working fine, the radarr one doesnt work.

It never did since you added it.. i think its very important because i dont want to redownload things just because radarr thinks it has a "old" file...

@HaveAGitGat
Copy link
Owner

Thanks, last time I tried this it worked fine for me. You can see here the same method is used for both radarr and sonarr:

https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/FlowPluginsTs/CommunityFlowPlugins/tools/notifyRadarrOrSonarr/1.0.0/index.ts#L115

Which radarr and sonarr versions are you using?

@CurlyFlow
Copy link
Author

CurlyFlow commented Mar 20, 2024

Hi,
im using
radarr 5.3.6.8612-ls208 by linuxserver.io
sonarr 4.0.2.1183-ls231 by linuxserver.io

sonarr was working from begining, i never saw the radarr part work. Every single transcode fails because of this part of the flow.

I think someone found something out. It might have to do with the "old filename" and "new filename". Could u try to swap that?

@dennix85
Copy link

No issues here neither, i do also file rename incl {avcodec} (soundcodec} since day 1 i use notify radarr and sonarr,
are you sure the api key is correct ?
And is it the last step of the entire flow ?
(i use binhex containers for the arrs btw)

@CurlyFlow
Copy link
Author

CurlyFlow commented Mar 20, 2024

No issues here neither, i do also file rename incl {avcodec} (soundcodec} since day 1 i use notify radarr and sonarr, are you sure the api key is correct ? And is it the last step of the entire flow ? (i use binhex containers for the arrs btw)

I doubt it.

Radarr:

edit

@Marnalas
Copy link

Marnalas commented Mar 21, 2024

I had this exact issue with the notify plugin but only on some specific movies. I rewrote this plugin to make it more robust then opened a pull request some time ago : HaveAGitGat/Tdarr_Plugins#600
The version I submitted fixed all the inconsistences I observed in my library. Might be worth a try.

One thing I added was to try to get the id of the movie using the inputFileObj._id (current file name) if the plugin fails with the originalLibraryFile._id (original file name). I also added some logs to understand a little what's happing.

@dennix85
Copy link

your radarr errors out, its a communication issue with your radarr it should look almost the same as the sonarr one
really check radarr, firewall settings and portmappings on your containers
Have you checked your radarr logs if there are errors in there ?
image

@Marnalas
Copy link

Marnalas commented Mar 23, 2024

I remember investigating this issue (before I made the modifications on the plugin). I imported the open API file of the Radarr API on Postman and made some tests there.

  1. Any problem on the URL, port or protocol (and I suppose firewall settings in most cases) gets you an ECONNREFUSED error in return. Not the problem here.

  2. If the api-key is incorrect you get an empty body response :

image

  1. If the movie's title is not found :

image

  1. At the time I also confirmed through Postman (so nothing to do with the plugin) that sometimes everything is correct, but Radarr just doesn't find the movie using the original name. Given the file names I saw causing this situation, I supposed it was some special characters in the file name posing problem to the Radarr API.

Given the error :

  1. can be eliminated right away.
  2. is very possible so I suggest you check your api-key once more.
  3. is a possibility but you won't be able to ascertain it without using an external tool that shows the response provided by Radarr's API. You can use their Swagger if you don't want to install Postman : https://radarr.video/docs/api/
  4. is a possibility but it wouldn't happen on ALL your movies.

I would still suggest using the modifications I made on this plugin as it provides a little more information for understanding what's happening and is a little more resilient.

In addition to all this, can you provide a screen shot of how you use this plugin in your flow please ? It would help if you could show how you handle passing the different parameters for Radarr and Sonarr depending on your file type (movie or serie).

@CurlyFlow
Copy link
Author

CurlyFlow commented Mar 23, 2024

So thats my flow: edit

(all my flows are the same just with or without notify)

@Marnalas
Copy link

Marnalas commented Mar 23, 2024

Am I correct in assuming that you use two separate libraries for your movies and series and that the movie library uses another flow which has the Radarr configuration ?

Did you also check your API key for the Radarr flow ?

Can you also provide one file file name you have the error on ?

@CurlyFlow
Copy link
Author

CurlyFlow commented Mar 23, 2024

yes, how else???

yes i checked ported and api key already 19802370912387108283091283123ß9180724678123657841687239812836497120783712 times, atleast.

edit

@CurlyFlow
Copy link
Author

CurlyFlow commented Mar 23, 2024

all of them.

edit

@Marnalas
Copy link

I don't see anything there that would cause the issue. That being said, since this plugin is used by lots of people, and it's obviously working for most of us, the problem is still probably on your side.
At that point I can only tell you to try to get more information using Postman or Radarr's API Swagger https://radarr.video/docs/api/ (if your Radarr instance is externally accessible, which I can't recommend) or wait for the pull request containing my modifications to be approved then try again by using the v2.0.0 of this plugin (even though there is no guarantee that it would fix your problem).

@CurlyFlow
Copy link
Author

Cant the dev add your changes to the code?

@HaveAGitGat
Copy link
Owner

@CurlyFlow still need to check some things but you can try out their changes by adding the js file to your local plugins at:

FlowPlugins/LocalFlowPlugins/tools/notifyRadarrOrSonarr/2.0.0/index.js

Let us know if it works for you

@CurlyFlow
Copy link
Author

CurlyFlow commented Mar 23, 2024

Ok, where do i find that file? (i mean the file from marnalas)

i think we found out what the problem was at some point somewhere (but cant find it) if i remember correct it was that it tells radarr the old name like before transformation, but it only worked if you tell him the new name. (dont ask me)

i somehow manually querryd radarr, and it would work with the new name, but not the old. Why i dont know. But a fix would be, try normal, if not working, try new name?

@Marnalas
Copy link

Marnalas commented Mar 23, 2024

You can find the file here : https://github.com/HaveAGitGat/Tdarr_Plugins/pull/600/files
There are two files, be sure to take the one with .js extension (not .ts).

i somehow manually querryd radarr, and it would work with the new name, but not the old. Why i dont know. But a fix would be, try normal, if not working, try new name?

This might happen if, somehow, Radarr detects the name change before the notify plugin is executed. Trying with the new name is one of the changes I implemented. So if it's the root of your issue, first of all my modifications should work for you and, second, you should see something along those lines in the logs

Didn't find movie with a file named 'originalName' in Radarr.
Found movie movieIdwith a file named 'newName'

@CurlyFlow
Copy link
Author

CurlyFlow commented Mar 24, 2024

Im a bit lost here.

I dont have "FlowPlugins/LocalFlowPlugins/tools/notifyRadarrOrSonarr/2.0.0/index.js"

I have appdata\tdarr\server\Tdarr\Plugins\FlowPlugins\CommunityFlowPlugins\tools\notifyRadarrOrSonarr

There is no 2.0.0 directory, i created that directory and placed the index.js there, but how to use it now? Do i need to select it somwehere?

@HaveAGitGat
Copy link
Owner

Yes my suggestion was to put it in the LocalFlowPlugins folder (you might need to create this) as it’s not coming from the community plugins repo atm but you can put it in either - plugins in CommunityFlowPlugins can be overwritten by any future updates but LocalFlowPlugins is just your own plugins.

Yes once you’ve added it there you need to then select the new plugin version in the webUI and add it to the flow (refresh the page), it will be on the right hand side bar in the default position. The old 1.0.0 version will be at the very bottom of the sidebar if you still need to use it.

@HaveAGitGat
Copy link
Owner

E.g. tab here:

image'

You can confirm the version by clicking on it:

image

Old versions will appear at bottom if you have both 1.0.0 and 2.0.0 in LocalFlowPlugins:
(I just added some for example purposes)
image

image

@CurlyFlow
Copy link
Author

CurlyFlow commented Mar 24, 2024

Something cahgned so i guess its correct...

under version it says 2.0.0

edit

@Marnalas
Copy link

Yup, from the logs it looks like my modifications are there.
Only one attempt has been made with the original file name. The plug-in only makes another attempt with the current file name if it's different from the original one.
So your problem is somewhere else.
Do you have any other mechanism renaming your files besides tdarr?

@CurlyFlow
Copy link
Author

no

@CurlyFlow
Copy link
Author

CurlyFlow commented Mar 24, 2024

I dont understand what is different from my setup to yours

sab -> so/radarr -> tdarr

Do your files also have empty spaces " " or "[" or "]" or "+" or "}"? Maybe its just a problem because of special characters...

Also what are you sending radarr? Maybe we could send an import to that directory? Instead of an rename?

When i looked for the movie, it wasnt the correct one in radarr (so still the old)

Someone maybe want to teams into my pc to check? Or something? I would really like to help to solve that problem...

@CurlyFlow
Copy link
Author

@Marnalas did u see my edit?

@Marnalas
Copy link

Marnalas commented Mar 25, 2024

Ah no, didn't see it.

I follow the trash guides naming schemes https://trash-guides.info/Radarr/Radarr-recommended-naming-scheme/. My file names look like this : Dune (2021) {imdb-tt1160419} [Bluray-1080p][TrueHD Atmos 7.1][FR+EN][h265]-FoX.mkv
The names you use are shorter than mines, and contain less special characters. The special characters I saw causing some issues at times were question marks for example.

There is something I don't understand in what you wrote in your edit. You say that the file name showed in the plugin logs (Alien Outbreak [DE+EN] Remux-1080p) is not the correct one known by Radarr. That implies that something changed the name at some point. Can you give us more details about that ?

In my situation this is what happens :

  1. Radarr grabs the file and names it according to its naming policy
  2. Tdarr detects the new file (my librairies are set up with folder watch)
  3. Tdarr does its thing (transcodes, stream filtering, etc.)
  4. Tdarr replaces the original file
  5. Tdarr notifies Radarr
  6. Tdarr renames the file according to Radarr naming policy (it's a flow plugin I wrote: Flow plugin apply radarr sonarr naming policy Tdarr_Plugins#589)
  7. Tdarr notifies Radarr of the name change

No renaming happens between steps 2 and 6. From what you're describing, it looks like you have some other stuff happening that changes the name outside of Tdarr (so Tdarr doesn't know the new name). I know you already said that it's not the case but I don't get how Tdarr could have "an old name" without the name being changed by something at some point.

@CurlyFlow
Copy link
Author

CurlyFlow commented Mar 26, 2024

Good question. I dont know how that could have happend.

I only use sonarr and radarr for naming... and like i said sonarr is working fine since beginning.

Do you also have radarr 5.3.6.8612?

Im doing an update all and then i try to tdarr it again..

maybe it has something to do with tdarr creating 0 byte files?
#956

With every file it tries 2-3 times to copy a fu... file over...

AHH one thing is maybe different, do you also change the file extention in your flow? Mine gets all reset to mp4?

@Marnalas
Copy link

Yeah I force the container to mkv and also transcode video+audio (which impacts the files names). I have two Radarr instances, each linked to its own Tdarr library. Both of them are updated to the last version automatically, right now they are v5.3.6.8612.

What you just wrote raises a lot of questions. But handling that here will be complicated. I think a discord conversation/screen share will be needed. The easiest way to organise that would be for you to join the Tdarr discord : https://discord.com/invite/q8AcZWQ. Contact me in the help-chat channel, by tagging "Enro Marnalas".

@Marnalas
Copy link

For anybody reading this.

@CurlyFlow shared his screen and we investigated. I can say for sure that it's not a Tdarr/Tdarr plugin issue. The problem comes from the Radarr API "parse" endpoint used to get the movieId. We queried it directly with curl and, I have no idea why, it just refused to find the movies even when the file name was correct. We checked everything we could think of (cultural context issues with some characters decoding, etc.) but even with a file name reduced to "eins.mp4" the parse endpoint still refused to work as intended.

We hang up on the conclusion that maybe it's related to CurlyFlow's installation being quite old and having migrated through many versions, maybe it's the fact that he has lots of content, maybe it's a combination of everything, etc. Short version: we don't know.

CurlyFlow is gonna try to do a fresh install with a few movies and check if it works.
On my side I just think that the "parse" endpoint is a pretty inefficient way to query for the movieId. It uses the file name which, for a lot of people who follow the Plex/Jellyfin/Emby naming recommendations, is quite long and contains lots of special characters that are not friendly as an HTTP query parameter. I'm gonna look into proposing a modified version of the notify flow plugin using the "movieLookup" endpoints instead.

@supersnellehenk
Copy link

supersnellehenk commented Mar 26, 2024

@Marnalas FYI, I switched from the movieLookup endpoint to the parse endpoint (in combination with encodeURIComponent which would fix your special characters) to have Radarr be in charge of trying to find the file. Especially with larger installs the movieLookup response could be quite large.

@Marnalas
Copy link

Marnalas commented Mar 27, 2024

@supersnellehenk Thank you for your message. I'll try to play with the moovieLookup endpoints in postman and try to determine how to use it best to not have this large response problem. I do agree with you that Radarr should be in charge of finding the movie.
Also, thank you for your work on this plugin. I used it for a while before I modified it and it's been an important part of my flow. It also gave me the idea for this one : HaveAGitGat/Tdarr_Plugins#589

More details on what I intend to do :
The main moovieLookup endpoint I'm thinking about is the one accepting an imdbId parameter. This endpoint shouldn't return multiple results (so the response shouldn't be any larger than it is for the parse endpoint). My intention is to try to get the imdb id from the file name or the file path using a regex then try to get the movieId with that.
I'll keep the parse endpoint as a fallback method if no imdb code has been found or if it failed to find the movieID. At least we know that it works for a majority of people (myself included).

@Marnalas
Copy link

Marnalas commented Mar 31, 2024

Ok, just got confirmation from @CurlyFlow that the latest modifications I made in the PR HaveAGitGat/Tdarr_Plugins#600 solved his issue (see his logs below). The notify plugin is now able to find the movieId throught the lookup?term=imdb:imdbId endpoint (for both Radarr and Sonarr).

2024-03-31T22:08:22.807Z tC8xSEHHu:Node[MyInternalNode]:Worker[neat-newt]:Using cached scan results
2024-03-31T22:08:22.807Z tC8xSEHHu:Node[MyInternalNode]:Worker[neat-newt]:Loaded plugin inputs: {
2024-03-31T22:08:22.807Z "arr": "radarr",
2024-03-31T22:08:22.807Z "arr_api_key": "X",
2024-03-31T22:08:22.807Z "arr_host": "X"
2024-03-31T22:08:22.807Z }
2024-03-31T22:08:22.807Z tC8xSEHHu:Node[MyInternalNode]:Worker[neat-newt]:Going to force scan
2024-03-31T22:08:22.807Z tC8xSEHHu:Node[MyInternalNode]:Worker[neat-newt]:Refreshing radarr...
2024-03-31T22:08:22.807Z tC8xSEHHu:Node[MyInternalNode]:Worker[neat-newt]:Movie 'XXX' found for imdb 'XXX'
2024-03-31T22:08:22.807Z tC8xSEHHu:Node[MyInternalNode]:Worker[neat-newt]:✔ Movie 'XXX' refreshed in radarr.
2024-03-31T22:08:22.807Z tC8xSEHHu:Node[MyInternalNode]:Worker[neat-newt]:Plugin run complete
2024-03-31T22:08:22.808Z tC8xSEHHu:Node[MyInternalNode]:Worker[neat-newt]:{"_id":"/mnt/user/Archiv/Filme/XXX.mp4","outputNumber":1,"variables":{"flowFailed":false}}
2024-03-31T22:08:22.808Z tC8xSEHHu:Node[MyInternalNode]:Worker[neat-newt]:No next plugin
2024-03-31T22:08:22.808Z tC8xSEHHu:Node[MyInternalNode]:Worker[neat-newt]:Requesting Tdarr Server to scan file

I still have no idea why the parse endpoint doesn't work for @CurlyFlow while it works for most of us. That being said, I also had some problems on my side for some specific files, so I think that these modifications can be to the benefits of everyone using this plugin.

@CurlyFlow
Copy link
Author

CurlyFlow commented Apr 1, 2024

Yes, its working fine!
I dont know how it works, but is it possible to hide this issue (because there is many personal information here) after it has been added to tdarr?

@Marnalas
Copy link

Marnalas commented Apr 1, 2024

Yes, its working fine! I dont know how it works, but is it possible to hide this issue (because there is many personal information here) after it has been added to tdarr?

You should edit your messages and remove any personal information. I'll do it my messages.

@CurlyFlow
Copy link
Author

Thanks marnalas for fixing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants