BolverBlitz / TranscodingOwl

Autotranscoder for TV Shows using FFMPEG with HW-Accel
MIT License
2 stars 1 forks source link

Add ability to auto launch Transcode via Webhook #1

Open GodOfOwls opened 1 year ago

GodOfOwls commented 1 year ago

Currently both Sonarr and Radarr support sending Webhooks when an episode file has been imported.

It would be a huge benefit to auto launch the transcoding process once an episode or a movie is imported.

The Flow should be something like this:

  1. Transcoder gets started with prefered options on Transcoding PC
  2. Sonarr / Radarr finds and imports an file.
  3. Sonarr / Radarr sends a Post Request to Transcoding PC
  4. Transcoding PC transcodes the file to the desired values

Example Webhook json from Sonarr: { "series": { "id": 345, "title": "Bleach", "path": "J:\\Serien-Sonarr\\Bleach", "tvdbId": 74796, "tvMazeId": 1905, "imdbId": "tt0434665", "type": "anime" }, "episodes": [{ "id": 25844, "episodeNumber": 9, "seasonNumber": 16, "title": "Fullbring, The Detested Power!", "airDate": "2011-12-06", "airDateUtc": "2011-12-06T14:00:00Z" }], "episodeFile": { "id": 31098, "relativePath": "Season 16\\Bleach - S16E09 - Fullbring, The Detested Power! SDTV v2.mkv", "path": "E:\\usenet_done\\Bleach - 351v2 [SGKK] (848x480 h264 AAC) [341475C6]\\Bleach - 351v2 [SGKK] (848x480 h264 AAC) [341475C6].mkv", "quality": "SDTV", "qualityVersion": 2, "sceneName": "Bleach - 351v2 [SGKK] (848x480 h264 AAC) [341475C6]", "size": 199981992 }, "isUpgrade": false, "downloadClient": "Local Sab", "downloadClientType": "SABnzbd", "downloadId": "SABnzbd_nzo_f_vry33d", "eventType": "Download" }

To note is the Fact that "Path" in the json refers to the local path on the sonarr radarr pc. so we will ne3ed to have some kind of drive letter mapping in place. ideally in an .conf file since those values rarely change. The listening port for the wbhooks can also be set in the config. as can the preffered encoder and crf factors

GodOfOwls commented 1 year ago

Also Here is the corresponding webhook from Radarr { "movie": { "id": 65, "title": "Jurassic Park III", "year": 2001, "releaseDate": "2002-01-30", "folderPath": "J:\\Filme-Radarr\\Jurassic Park III (2001)", "tmdbId": 331, "imdbId": "tt0163025", "overview": "In need of funds for research, Dr. Alan Grant accepts a large sum of money to accompany Paul and Amanda Kirby on an aerial tour of the infamous Isla Sorna. It isn't long before all hell breaks loose and the stranded wayfarers must fight for survival as a host of new -- and even more deadly -- dinosaurs try to make snacks of them." }, "remoteMovie": { "tmdbId": 331, "imdbId": "tt0163025", "title": "Jurassic Park III", "year": 2001 }, "movieFile": { "id": 1252, "relativePath": "Jurassic Park III (2001) Remux-2160p Proper.mkv", "path": "E:\\usenet_done\\Jurassic.Park.III.2001.REPACK.UHD.BluRay.Remux.2160p.HEVC.HDR.DTS.X.7.1-BMF\\abd6fe2097cd4c84b51884a8d548786e.mkv", "quality": "Remux-2160p", "qualityVersion": 2, "releaseGroup": "BMF", "sceneName": "Jurassic.Park.III.2001.REPACK.UHD.BluRay.Remux.2160p.HEVC.HDR.DTS.X.7.1-BMF", "indexerFlags": "0", "size": 54653228664, "dateAdded": "2023-08-27T12:12:47.9110893Z", "mediaInfo": { "audioChannels": 7.1, "audioCodec": "DTS-X", "audioLanguages": [ "eng" ], "height": 2160, "width": 3840, "subtitles": [ "eng", "chi", "cze", "dan", "dut", "fin", "fre", "gre", "kor", "nor", "pol", "rum", "swe" ], "videoCodec": "HEVC", "videoDynamicRange": "HDR", "videoDynamicRangeType": "HDR10" } }, "isUpgrade": false, "downloadClient": "local Saab", "downloadClientType": "SABnzbd", "downloadId": "SABnzbd_nzo_6m_a05n8", "customFormatInfo": { "customFormats": [ { "id": 2, "name": "English" } ], "customFormatScore": 3 }, "release": { "releaseTitle": "Jurassic.Park.III.2001.REPACK.UHD.BluRay.Remux.2160p.HEVC.HDR.DTS.X.7.1-BMF", "indexer": "Miatrix", "size": 57415238883 }, "eventType": "Download", "instanceName": "Radarr", "applicationUrl": "" }

BolverBlitz commented 1 year ago

Thanks for your issue and the provided data.

So my idear would be as follows:

Sonarr/Radarr request -> Local application Local application will ask all connected TranscodingOwl servers how many job remain. Local application will send the task to the least used server

For config: I´ll make all config avaible in the local application. 1: Quality, like HDTV runs with encoder quality 10 and REMUX with 28 2: A config where all servers that have connected will store avaible transcoders

The drive letter mapping will be localy per TranscodingOwl instance. I´ll also add new startup flags -server and -main to handle communication.

GodOfOwls commented 1 year ago

Sounds amazing. will the transcoding owl servers be dynamicly logging into the master or will they be hardcoded?

BolverBlitz commented 1 year ago

I would add the flag -server <IP of Main> that tells the application to open a websocket to main and await requests.