Maintainerr icon indicating copy to clipboard operation
Maintainerr copied to clipboard

Radarr - File Size rule executor always returns null

Open utrack opened this issue 1 year ago • 9 comments

Describe the bug Every rule with Radarr's size returns null as a size

To Reproduce Steps to reproduce the behavior:

  1. Add the rule with Radarr's file size > 100mb
  2. Test the rule via Collections>(collection)>Test Media
  3. firstValue in a rule is null

Expected behavior firstValue of the operation should = file size in MB.

Screenshots image image

Device (please complete the following information):

  • OS: Arch Linux, docker-compose
  • Version: Maintainerr 2.0.4, Radarr 5.7.0.8882

Additional context JSON of the rule executor:

    - id: 1
      result: false
      operator: AND
      ruleResults:
        - operator: OR
          action: bigger
          firstValueName: Radarr - File - size in MB
          firstValue: null
          secondValueName: number
          secondValue: 100
          result: false
    - id: 2
      result: true
      operator: AND
      ruleResults:
        - operator: OR
          action: not_equals
          firstValueName: Radarr - File - file path
          firstValue: /mnt/media-library/plex/Movies/2001 A Space Odyssey (1968)/2001 A
            Space Odyssey (1968) {imdb-tt0062622} {languages-
            {edition-Remastered} [4K Remaster][Bluray-1080p][EAC3
            5.1][x264]-hallowed.mkv
          secondValueName: text
          secondValue: asd
          result: true

utrack avatar Jul 07 '24 13:07 utrack

Hey, thanks for your report! It appears your Radarr instance is not returning the expected 'sizeOnDisk' property needed by Maintainerr.

Is there anything of use in the Maintainerr log while testing this?

Could you return the response from a manual Radarr lookup through the API for this particular movie? You should be able to do it with the 'movie lookup' endpoint, and with the term 'tmdb:62' (62 being 2001 A Space Odyssey's TMDB ID)

https://radarr.video/docs/api/#/MovieLookup/get_api_v3_movie_lookup

jorenn92 avatar Jul 16 '24 13:07 jorenn92

I am having this issue as well. I want to create rules using the file size as criteria for building collections. I created a very simple rule (file size greater than 1 MB) but have been unable to get the rule to work:

mediaType: MOVIES
rules:
  - "0":
      - firstValue: Radarr.fileSize
        action: BIGGER
        customValue:
          type: number
          value: 1

I tested within Maintainer for the movie "The Third Man" which is ~2 GB and got the following return. I tailed the log file while doing the test but no logs were produced when I clicked the test button.

- plexId: 55857
  result: false
  sectionResults:
    - id: 0
      result: false
      ruleResults:
        - operator: OR
          action: bigger
          firstValueName: Radarr - File - size in MB
          firstValue: null
          secondValueName: number
          secondValue: 1
          result: false

I then tested against the Radarr API and have attached the output, test.json, to this post.

Hoping this is enough information to lead to a solution/suggestion.

Platform: Debian 12 VM running on Proxmox 8.2.4 Containers: Docker v27.1.1 Maintainerr: v2.0.4 Radarr: v5.8.3.8933 test.json

jgonzo-gh avatar Aug 10 '24 19:08 jgonzo-gh

The Radarr response is missing the expected 'sizeOnDisk' parameter, hence the null value. I wonder if this recently changed on Radarr's side, since that property used to always be there.

I pushed a fallback to moviefile.size in https://github.com/jorenn92/Maintainerr/pull/1205.

jorenn92 avatar Aug 12 '24 07:08 jorenn92

Many thanks. When will the fix be released so my docker compose will pick up a fixed image?

jgonzo-gh avatar Aug 13 '24 04:08 jgonzo-gh

Many thanks. When will the fix be released so my docker compose will pick up a fixed image?

There is no timeframe yet. There haven't been that many changes since the last one. However, I might push a small release with a few bug fixes in the following weeks,

jorenn92 avatar Aug 13 '24 11:08 jorenn92

The Radarr response is missing the expected 'sizeOnDisk' parameter, hence the null value. I wonder if this recently changed on Radarr's side, since that property used to always be there.

Hello!

Yes, it was moved on Jan 16, 2024 under statistics when I worked on displaying release groups in the UI. Looks like I broke BC on this one but it was the same value as movieFile?.Size ?? 0. 🥲

I noticed this method that uses /movie/lookup and this might be an issue. https://github.com/jorenn92/Maintainerr/blob/a13d64cd6260ee705905b515e240d14fee23b940/server/src/modules/api/servarr-api/helpers/radarr.helper.ts#L38-L44

/api/v3/movie/lookup?term=tmdb:123 is good for getting the metadata to add a new movie to the library, but for fetching data from users' library I would recommend using /api/v3/movie?tmdbId=92959 to prevent any requests from being sent to Radarr's metadata.

The property movieFile under movie resources is somewhat planned to be eventually removed in future versions when multiple file support would be added.

mynameisbogdan avatar Aug 13 '24 14:08 mynameisbogdan

/api/v3/movie/lookup?term=tmdb:123 is good for getting the metadata to add a new movie to the library, but for fetching data from users' library I would recommend using /api/v3/movie?tmdbId=92959 to prevent any requests from being sent to Radarr's metadata.

Hey, thanks for the clarification and suggestion! I wasn't aware that lookup wasn't intended to be used for this purpose. I ran a quick test comparing the two endpoints, and it seems that '/movie?tmdbId=' is a bit more reliable. For some reason, lookup didn't show a movie as available, while the other endpoint did. I've made the necessary changes in this pull request.

The property movieFile under movie resources is somewhat planned to be eventually removed in future versions when multiple file support would be added.

Thanks for the heads up. I'll need to watch out for that change. When multi-file support is added, the filesize (and potentially others as well) rule will have to be rewritten.

jorenn92 avatar Aug 14 '24 08:08 jorenn92

Yea, there was spent more time on /movie to add stats and other necessary data to display in the UI.

Regarding your change, on this line you need to add a new method that uses the old lookup method if you want to add a new movie, since the endpoint I recommended is only returning movies already in your library.

https://github.com/jorenn92/Maintainerr/blob/1a84b8cf505bb6216af8a85ab907b3c912bdd267/server/src/modules/api/servarr-api/helpers/radarr.helper.ts#L53-L57

Hope that clears out things.

mynameisbogdan avatar Aug 14 '24 11:08 mynameisbogdan

Regarding your change, on this line you need to add a new method that uses the old lookup method if you want to add a new movie, since the endpoint I recommended is only returning movies already in your library.

I see, thank you! The addMovie method is leftover code, it's not in use anymore, Maintainerr isn't intended to add anything to *arr apps, I've removed the code in https://github.com/jorenn92/Maintainerr/pull/1215 to avoid future confusion.

jorenn92 avatar Aug 14 '24 14:08 jorenn92

Closing the issue, the fix was released in release 2.1.0.

jorenn92 avatar Sep 09 '24 07:09 jorenn92