gsemet / dopplerr

Subtitle Download Service
MIT License
16 stars 2 forks source link

Feature: option to search with renamed files #20

Open Groofster opened 6 years ago

Groofster commented 6 years ago

Could you please add the option to search with renamed files ? All the information you need is present in the JSON property 'ralativePath'. The full path can be created with: path + "/" + relativePath

Creating: /path/to/series/season/renamed-filename.ext

gsemet commented 6 years ago

Hello. Can you elaborate your use case. Which json property are you talking about ? Dopplerr react to the "On Download" event of sonarr, taking the filename (in SceneName of the notification json)

Groofster commented 6 years ago

Hi,

as far as I can tell the event "On Download" fires after the move/rename by Sonarr. Now Dopplerr is not working with the option of renaming the download because Dopplerr is working with the "SceneName" which is the name before renaming.

Making Dopplerr be able to respect renaming a file by Sonarr might be accomplished by using different properties from the posted JSON information. A tcpdump showed me the JSON properties which are posted and I think Dopplerr can be "easily" (sorry, I'm not fluent in python) extended to work with the rename option.

All the information you need is present in the JSON property 'ralativePath'. The full path can be created with: path + "/" + relativePath

gsemet commented 6 years ago

Hello. I have started working on a regular file scanner that performs on background, regularly, to find out all missed files. It will land eventually :) For the moment I only react to the OnDownload event (see an example in https://github.com/Stibbons/dopplerr/blob/master/dopplerr/tests/vectors/sonarr_on_download.json). We can clearly imagine to react to on rename event as well

Groofster commented 6 years ago

The following json is what gets posted on a download/upgrade when renaming is enabled in Sonarr:

{ "episodes":[ { "id":3315, "episode Number":25, "seasonNumber":1, "title":"Finale", "airDate":"2013-03-17", "airDateUtc":"2013-03-17T08:30:00Z", "quality":"SDTV", "qualityVersion":1, "releaseGroup":"fqm", "sceneName":"MasterChef.Australia.The.Professionals.S01E25.Finale.PDTV.x264-FQM" } ], "episodeFile":{ "id":1847, "relativePath":"Season 1/MasterChef The Professionals Australia - S01E25 - Finale.mp4", "path":"/Series/.downloaded/MasterChef.Australia.The.Professionals.S01E25.Finale.PDTV.x264-FQM/masterchef.australia.the.professionals.s01e25.pdtv.x264-fqm.mp4", "quality":"SDTV", "qualityVersion":1, "releaseGroup":"fqm", "sceneName":"MasterChef.Australia.The.Professionals.S01E25.Finale.PDTV.x264-FQM" }, "isUpgrade":false, "eventType":"Download", "series":{ "id":71, "title":"MasterChef The Professionals Australia", "path":"/Series/MasterChef The Professionals Australia", "tvdbId":265252 } }

relativePath is the name of the file after renaming it and is located in the directory path.

So a search could be done with the original filename and info, but the file will be located in: path/relativePath

It seems all the information needed is present in the json to make dopplerr work very nicely with the renaming option enabled in Sonarr.