Selective cleanup (deletion) of files (based on cat and ext), v1.05 (2009/07/19)

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

Selective cleanup (deletion) of files (based on cat and ext), v1.05 (2009/07/19)

Post by TeraLove »

The attached Python script clean's up (deletes) files with specific extensions, e.g. .sfv, .nzb, but only for downloads belonging to a particular category.

Remarks:
  • The cleanup is performed only in the provided directory; subdirectories inside it, if any, are not affected.
  • Extensions are case-insensitive.
As is obvious, remove ".txt" from the name of the attached file. This script has been updated since its original version was released. Accordingly, some or all of the posts below may no longer be applicable. 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.
Last edited by TeraLove on July 27th, 2009, 8:13 pm, edited 1 time in total.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Selective cleanup (deletion) of files (based on newsgroup and extension)

Post by shypike »

The "Create Category Folders" feature has been removed. People can use user-defined categories.
The script always receives the job folder location as a parameter.
The only less predictable feature is the TV Season support, but even there you can assume you can weed out files based on the job folder.
User avatar
TeraLove
Newbie
Newbie
Posts: 18
Joined: June 1st, 2008, 9:07 pm

Re: Selective cleanup (deletion) of files (based on newsgroup and extension)

Post by TeraLove »

shypike wrote: The "Create Category Folders" feature has been removed. People can use user-defined categories.
The script always receives the job folder location as a parameter.
The only less predictable feature is the TV Season support, but even there you can assume you can weed out files based on the job folder.
Okay. I've now updated the script to simply check if the newsgroup name is contained anywhere in the folder name, instead of parsing the folder name and looking for the newsgroup name in a specific place.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Selective cleanup (deletion) of files (based on newsgroup and extension)

Post by shypike »

Why do you insist on using newsgroup names?
The reason we dropped this feature is that there is little relation between the content of a post and the newsgroup it is posted in.
Have you ever looked at groups like  alt.binaries.x or  alt.binaries.boneless ?
User avatar
TeraLove
Newbie
Newbie
Posts: 18
Joined: June 1st, 2008, 9:07 pm

Re: Selective cleanup (deletion) of files (based on newsgroup and extension)

Post by TeraLove »

shypike wrote: Why do you insist on using newsgroup names?
The reason we dropped this feature is that there is little relation between the content of a post and the newsgroup it is posted in.
Have you ever looked at groups like  alt.binaries.x or  alt.binaries.boneless ?
In your previous post, you said that the "Create Category Folders" feature has been removed. In this one, you're saying that the newsgroup names feature has been dropped. Those are two different features you made a reference to.

You're right about those two newsgroups, but for me, alt.binaries.hdtv.x264 is by and large the only newsgroup which contains bluray x264 files, and so I don't have that problem. Also, the latest stable version of the program, 0.3.4, does have the newsgroup names feature. I don't use the beta versions, and I therefore do not have the user-defined categories feature which you mentioned available to me. Accordingly, I will consider updating the script once a new stable version is out.
Last edited by TeraLove on June 3rd, 2008, 12:31 pm, edited 1 time in total.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Selective cleanup (deletion) of files (based on newsgroup and extension)

Post by shypike »

The reason both features were removed is that they overlap and compete.
It was also hard to come up with a proper user interface.
Newzbin-category based folders are really obsolete, because exactly the same can be accomplished using the user-defined categories.

The group-based folders are a different beast, largely incompatible with user-defined categories.
It could be restored, at the risk of added complexity in the user interface.
We simply assumed that nobody was interested in group-based folders anymore.

One thing I thought of was to use the groups as triggers for the category. The Categories page now contains a column that holds Newzbin category names. I can imagine that you fill in group names there. So group alt.binaries.hdtv.x264 may map to a category called (e.g.) "Movies HD". It would be possible to map multiple groups to one category.
User avatar
TeraLove
Newbie
Newbie
Posts: 18
Joined: June 1st, 2008, 9:07 pm

Re: Selective cleanup (deletion) of files (based on newsgroup and extension)

Post by TeraLove »

shypike wrote: The reason both features were removed is that they overlap and compete.
It was also hard to come up with a proper user interface.
Newzbin-category based folders are really obsolete, because exactly the same can be accomplished using the user-defined categories.

The group-based folders are a different beast, largely incompatible with user-defined categories.
It could be restored, at the risk of added complexity in the user interface.
We simply assumed that nobody was interested in group-based folders anymore.

One thing I thought of was to use the groups as triggers for the category. The Categories page now contains a column that holds Newzbin category names. I can imagine that you fill in group names there. So group alt.binaries.hdtv.x264 may map to a category called (e.g.) "Movies HD". It would be possible to map multiple groups to one category.
I think group-based folders is a simple and useful feature which should be available for those who want to use it. Users could be allowed to use it or use user-defined categories, but not both.

As things are now, I imagine it is an extra step for the user to add a category. As such, having a group name as a trigger for the category would help in preventing this manual extra step. All this, however, runs the risk of being considered as bloat and too-difficult-to-work-with by some. I guess you would need to think real hard about what kind of organization strategies works best.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Selective cleanup (deletion) of files (based on newsgroup and extension)

Post by shypike »

There will be two changes in the next release:

- The group name will be passed as the 6th parameter to the user script
- Group names will be accepted as selection values for user-defined categories.

The first will allow you to use the group name for your script.
The second will allow people to combine the flexibility of the category system and the extra information the group name gives.
User avatar
TeraLove
Newbie
Newbie
Posts: 18
Joined: June 1st, 2008, 9:07 pm

Re: Selective cleanup (deletion) of files (based on newsgroup and extension)

Post by TeraLove »

shypike wrote: - The group name will be passed as the 6th parameter to the user script
- Group names will be accepted as selection values for user-defined categories.
What will happen if the job contains files from more than one newsgroup? Also, how is this concern currently handled in version 0.3.4?
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Selective cleanup (deletion) of files (based on path-term and extension)

Post by shypike »

The first encountered group is used, the rest is ignored.
Post Reply