Skip to content

Conversation

@Marnalas
Copy link
Contributor

@Marnalas Marnalas commented Apr 8, 2025

Hi,

I had the need for a flow plugin, based on the same logic as setFlowVariable, that would read info from Sonarr or Radarr then make it available to other plugins. See #741 for more details.
This is my shot at undertaking that work.

Usage preconditions:

  • Radarr v4.x and Sonarr v4.x
  • Filenames with: IMDB IDs / TVDB IDs / TMDB IDs
    /!\ For files not using the IDs above, the less reliable parse method is used (match with filename).

It is used this way:
image
image

The execution will look something like that:
image

@Marnalas
Copy link
Contributor Author

Marnalas commented Apr 8, 2025

@smailpouri

For the new versions of the plugins notifyRadarrOrSonarr (v3.0.0) or applyRadarrOrSonarrNamingPolicy (v2.0.0), the file info retrieval (the part that used only the imdb id) have been put in common via a separate setFlowVariablesFromRadarrOrSonarr plugin.
I have updated this plugin to also use the tvdb or tmdb ids if available.

If you want to try it you can :

  1. Change the plugins repo to https://github.com/Marnalas/Tdarr_Plugins/archive/master.zip
Image
  1. Reboot Tdarr and the nodes for the repository change to apply

  2. Use the plugins in a test flow :
    Make sure that this plugin is called early in your flow (before the notifyRadarrOrSonarr and applyRadarrOrSonarrNamingPolicy plugins)
    image
    And then use the V3.0.0 of the notifyRadarrOrSonarr plugin

image If you were using a previous version, you need to delete it in your flow and drag and drop the plugin anew to use the most recent version.

The logs should look like this :
image
image

@matavach
Copy link

This is awesome, and I used it for a plugin that I'm creating to work with Bazarr.

I did add need to add a line into the sonarr returns

    if (config.name === 'sonarr') {
      return {
        ...baseInfo,
        seasonNumber: data.parsedEpisodeInfo?.seasonNumber ?? 1,
        episodeNumber: data.parsedEpisodeInfo?.episodeNumbers?.[0] ?? 1,
        episodeId: data.episodes?.at(0).id ?? 1
      };
    }

so that I could set the episode ID variable as well (which is needed for Bazarr
args.variables.user.ArrEpisodeId = String(fileInfo.episodeId ?? 0);

Could you add that to your PR?

@Marnalas
Copy link
Contributor Author

@matavach Done ! You gave the code for when the filename is used for the search (thanks!). I also added this feature for when imdb or tvdb ids are used.

I tried the modification with every case possible :

  1. lookup on tvdbid
  2. lookup on imdbid
  3. parse on filename

Looks to work fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants