Downloaded Folder Not deleted when importing transcoded file

I am having the same issue and I don’t know if this is a bug or misconfiguration. Currently I am using a cron job to delete any directory older than 1 day. Otherwise they’ll be left there forever.

I can’t find the log file path in my QNap. The wiki doesn’t have it. I really want to get in the bottom of this issue.

Can you please provide me with the path if you know it.

Edit: Never mind. It’s a hidden folder under /share/MD0_DATA/homes/admin/.config/NzbDrone/logs/

FYI, you can get the location from the AppData folder on System: Status and can also getvthebliv files right from the UI (System: Logs: Files).

I noticed. I thought they were different logs but once I found the folder I realized the were the same thing. I am about to download something and send the log file

That’s from today. I downloaded a Vice episode. http://pastebin.com/raw.php?i=nA9PxTnC

I transcode my video files post-processing so the new download is going to take a while.

We need debug logs (not enabled by default, please).

Sorry about the wait. Here it is https://www.dropbox.com/s/gqivii66qbjjcsn/sonarr-log.txt?dl=0
Sun Apr 26 2015 23:26:55 Revenge S04E21 720p HDTV X264-DIMENSION
Sun Apr 26 2015 23:43:26 Veep S04E03 720p HDTV x264-KILLERS

Looking at the logs it looks like everything was deleted properly:

15-4-26 23:43:07.3|Debug|DownloadedEpisodesImportService|Deleting folder after importing valid files\ and no errors after that. I see these are all importing from a transcoded folder, if that where a script drops them?

What folder isn’t being deleted?

When the file finish downloading NZBGet transcodes the file from mkv to mp4. It does the transcoding in a separate folder call “transcoded”. It’s not a predefined name. I called it transcoded since it makes sense. I also chose the option to delete the original file from the downloaded folder once the transcoding is completed. But the downloaded folder remains.

What needs to happen is Sonarr has to delete both. The downloaded folder and also the transcoded folder. Currently, if transcoding off, it deletes the downloaded folder. With it on, it only deletes the transcoded folder.

Download dir: …/Download/nzbget/dts/episodes/Revenge S04E21 720p HDTV X264-DIMENSION
Transcoder temp dir: …/Download/nzbget/dts/transcoded/

Sonarr doesn’t know about the download folder once you set up the transcoding because nzbget only reports the transcoded folder. Your script will need to handle deleting the downloaded folder.

That’s odd. CP is configured the same way and the movie folder gets deleted.

Sonarr knows what the download folder is since it is set in Drone Factory under Settings > Download Client. Perhaps you can use find to search for a folder in that directory matching the file name and if successful, delete it. Just thinking out loud here.

Maybe we should include clinton.hall to the convo.

@ptr727 Sorry for taking over your post. I thought our issues were related.

Thanks for moving the discussion to a new post. I hope you can come up with a solution to the problem.

From Sonarr’s perspective this is all intended, it deletes the folder after it imports from the location it was told to, but wouldn’t delete the other path because it wasn’t told to import from there.

Unless @taloth has another opinion this should be handled in nzbToMedia.

Yeah, CDH deletes the import dir during import if called via nzbToMedia, not the download dir.
It would prolly still try to remove the download dir, if Remove is enabled, but it won’t do it during import and afaik only if it’s empty or something. Since CDHv2 it’s a bit fuzzy.

And yes, I would assume nzbToMedia deletes the original file if the import is successful.

It doesn’t. With or without Remove enabled.
I already submitted a request on their github but after I noticed CP cleaning up the leftovers without any issues I thought perhaps there were something you gents can do about it. They are both configured identically.

@Taloth @markus101 Two open incidents about the same issue. Apparently it is a Sonarr issue.

I’ll centralize the discussion here but posted on github to let clinton know we’ll look into it.

@breezytm
Do you have Completed Download Handling enabled?

1 Like

Will do. Here’s a screenshot of the download client page. P.S I recalled it used to clean up properly prior to enable transcoding in NZBGet.

I can use this thread instead of mine. Let me know if any additional information is needed from me.

I have completed Download Handling enabled as well.

@breezytm, Okay… but Remove is disabled.

I’ll explain the process for both vanilla Sonarr+NzbGet and with nzbToMedia.

Sonarr+NzbGet

  • Sonarr grabs new nzb and sends it to NzbGet together with a unique ID.
  • NzbGet starts downloading, Sonarr can track this but also identify it using the unique ID.
  • NzbGet finishes, which Sonarr notices through the API.
  • Sonarr signals the import module to import the download directory/file of that specific download.
  • Import module imports the files, checks dir for remaining videos (excluding samples) and deletes the dir if clear.
  • Sonarr sends event throughout the application signalling the download with that unique ID is imported successfully.
  • ~1 minute later Sonarr sees the download again on the NzbGet api, realizes it is already imported and leaves it alone.
  • If ‘Remove’ is enabled in the screenshot above, then Sonarr will also tell NzbGet to remove the item from the visible history and delete any files remaining (which there aren’t)

Sonarr+NzbGet+nzbToMedia

  • Sonarr grabs new nzb and sends it to NzbGet together with a unique ID.
  • NzbGet starts downloading, Sonarr can track this but also identify it using the unique ID.
  • NzbGet finishes downloading, triggers nzbToMedia. (at this point Sonarr still considers it downloading, coz it waits for the pp-script to finish)
  • nzbToMedia does the transcoding to another directory.
  • nzbToMedia calls the Sonarr api and provides both the transcoded directory and unique ID.
  • Sonarr signals the import module to import the download directory/file of that specific trascoded directory.
  • Import module imports the files, checks dir for remaining videos (excluding samples) and deletes the dir if clear.
  • Sonarr sends event throughout the application signalling the download with that unique ID is imported successfully.
  • nzbToMedia receives ‘ok’ response from it’s api call, deletes the transcoding dir (which Sonarr already did), and returns ‘ok’ to NzbGet to say the pp-script finished successfully.
  • ~1 minute later Sonarr sees the download again, realizes it is already imported and leaves it alone.
  • If ‘Remove’ is enabled in the screenshot above, then Sonarr will also tell NzbGet to remove the item from the visible history and delete any files remaining (which there is, because the import process was only told about the transcoding dir)

Deleting both directories on import could be problematic to implement. I can discuss it with @markus101 but enabling ‘Remove’ should deal with it.