Smart cleanup (deletion) of SFV files, v1.04 (2009/07/30)

Come up with a useful post-processing script? Share it here!
Post Reply
User avatar
TeraLove
Newbie
Newbie
Posts: 18
Joined: June 1st, 2008, 9:07 pm

Smart cleanup (deletion) of SFV files, v1.04 (2009/07/30)

Post by TeraLove »

The attached Python script clean's up (deletes) SFV files in the job directory, but only if they do not contain a reference to any existing non-NFO file in the job directory. Such files are often leftover after unpacking, and are useless.

Remarks:
  • The cleanup is performed only in the provided directory; subdirectories inside it, if any, are not affected.
  • References to NFO files in an SFV file are ignored.
  • SFV files ending with a number, e.g. "foo.sfv.1", "foo.sfv.2", etc. are processed as well.
If you have a comment for me wrt this script, please consider sending it to me as a PM rather than posting a message here. Just maybe, the functionality of this script can be incorporated as a default option in a future version of SABnzbd+! An alternative but possibly cruder way of handling this might be at the unpack level, such that any SFVs that are present before the unpacking get deleted, but those that were unpacked themselves can stay.
Last edited by TeraLove on July 30th, 2009, 2:27 am, edited 1 time in total.
User avatar
switch
Moderator
Moderator
Posts: 1380
Joined: January 17th, 2008, 3:55 pm
Location: UK

Re: Smart cleanup (deletion) of SFV files

Post by switch »

What is wrong with just adding .sfv to the cleanup list of sabnzbd in config>general?
User avatar
TeraLove
Newbie
Newbie
Posts: 18
Joined: June 1st, 2008, 9:07 pm

Re: Smart cleanup (deletion) of SFV files

Post by TeraLove »

switch wrote: What is wrong with just adding .sfv to the cleanup list of sabnzbd in config>general?
There may at times be an SFV file that contains checksums of extracted files. I don't want a useful file like this to be deleted, which I believe will happen if I add .sfv to the cleanup list.

An alternative but possibly cruder way of handling this might be at the unpack level, such that any SFVs that are present before the unpacking get deleted, but those that were unpacked themselves can stay.
Last edited by TeraLove on July 23rd, 2009, 12:18 pm, edited 1 time in total.
jubei
Release Testers
Release Testers
Posts: 53
Joined: January 28th, 2009, 11:49 am

Re: Smart cleanup (deletion) of SFV files

Post by jubei »

I had a problem with it deleting an SFV file and the PAR2 failing bc of it....
User avatar
TeraLove
Newbie
Newbie
Posts: 18
Joined: June 1st, 2008, 9:07 pm

Re: Smart cleanup (deletion) of SFV files

Post by TeraLove »

jubei wrote: I had a problem with it deleting an SFV file and the PAR2 failing bc of it....
It can delete the SFV files only after SABnzbd+ has finished with everything else, including par2-based repair and unpacking. This is applicable to R, U, and D modes. What was your Mode for this download set to? Was it set to None? It is inconceivable to me why someone would set the mode to None. Currently, the mode of a download is not passed by the application to the postprocessing script.
Last edited by TeraLove on July 30th, 2009, 2:25 am, edited 1 time in total.
Post Reply