Post-rename custom script

I’m having some issues getting Sonarr to show results when running a test post-rename script. It’s python:

I’d like to have it tell me after a file is renamed, what the file is (IE: it downloads, then gives me the new name). However, this doesn’t seem to work for renames, only downloads:

import os
import sys
import logging
logging.basicConfig(filename=‘c:\example.log’,level=logging.DEBUG)
logging.info(os.environ.get(‘sonarr_episodefile_path’))

^ comes back with “none”

Any ideas?

LJ

OnRename is a series event, it doesn’t apply to a specific episode file. If you rename 1 or 100 files the event is the same.

so, would the download section be what I need for a rename of snagged episode?

LJ

I’m basically wanting to rename subtitle files that were snagged with any episodes to the name Sonarr renames the episode to.

Make sense/if at all possible currently?

Thanks Markus!

LJ

On Download is triggered after the file is imported, On Rename is triggered when 1 or more existing episodes is renamed.

I think this would only be possible if its a torrent and the files were copied/hard linked, for non-seeding torrents/nzbs the folder would have been cleaned up by the time this event triggered (though I’m second guessing this now, so you may be in luck).

P.S. Edit your posts…

Ok, thanks. I’ll play with this tonight and see if I can hack it up.

LJ

Markus,

Thanks for the insights!! I got the script moving subtitles now when the download completes. I’ll post my scripts so others can utilize as well after I test a little more.

LJ

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.