Custom Post-processing / API python examples

The WIKI for custom processing or API calls doesn’t have much information on the Python syntaxes. Also, on the forum most topics are about curl or bash.

So I thought, let’s share the scripts I made as a reference. It contains the following functions that might help you get a grasp of the basic python syntax for the following functions:

Custom Post-processing Scripts (https://github.com/Sonarr/Sonarr/wiki/Custom-Post-Processing-Scripts)

  1. Extract subtitles with FFMPEG --> https://pastebin.com/FUUrcWf2
  • Convert the Sonarr environment variables to a python variable

API (https://github.com/Sonarr/Sonarr/wiki/API)

  1. Trigger a rescanSeries on a second Sonarr instance --> https://pastebin.com/Yi7Bz2ji
  • Convert the Sonarr environment variables to a python variable
  • Perform a JSON get and parse it to a python variable
  • Perform a JSON post to trigger an command

Hope this helps in reducing the tinkering time if you want to play around with it.

1 Like