Page 1 of 1
Delete files with specific text in already added job in queue?
Posted: May 4th, 2025, 4:49 am
by iUseNetter
I have written a python script which works fine if I execute it in a SSH console window on my Synology NAS with
Code: Select all
python3 DeleteSampleFilesFromJob.sh
This script uses the API calls to retrieve the queue details, looking for filenames with "sample" or "nfo" and eventually execute
delete_nzf.
(Just imagine: It's the same as if I were to click on the ‘Edit NZB details - Password’ icon and manually select all entries with ‘sample’ or ‘nfo’ in their name and then click on the ‘Remove all selected entries’ icon at the bottom of the details window)
But I can't get SABnzbd to run this script automatically when a new NZB is added via drag & drop.
Where exactly do I have to set/use such a script so that it is always executed after all listed files in a NZB have been added to the queue (in a job)?
Re: Delete files with specific text in already added job in queue?
Posted: May 4th, 2025, 4:51 am
by sander
Re: Delete files with specific text in already added job in queue?
Posted: May 4th, 2025, 4:51 am
by iUseNetter
I would not ask, if it would be that easy
The script itself works from command-line.
Where do I have to set it in SABnzbd to be executed after adding a new Job?
And as you know for Pre-queue scripts:
You can choose to let SABnzbd run a script just before an NZB enters the queue.
My script should be executed
AFTER the Job is added to the queue.
Re: Delete files with specific text in already added job in queue?
Posted: May 4th, 2025, 5:41 am
by sander
Sab has no handle for that
Suggestions:
Cron job
Sleep 50
Re: Delete files with specific text in already added job in queue?
Posted: May 4th, 2025, 6:53 am
by safihre
But why not use the Config Switches option to delete samples?
Might kee nfo files but those are tiny tiny.
Re: Delete files with specific text in already added job in queue?
Posted: May 4th, 2025, 7:53 am
by iUseNetter
safihre wrote: ↑May 4th, 2025, 6:53 am
But why not use the Config Switches option to delete samples?
Might kee nfo files but those are tiny tiny.
I want to prevent the unnecessary mkv sample files (and also the nfo files) from being downloaded and not that they are only deleted after the download.
The nfo files are tiny, you are right.
But the mkv movie sample are (for me) just unnecessary garbage.
Re: Delete files with specific text in already added job in queue?
Posted: May 4th, 2025, 8:01 am
by safihre
We used to remove them already in the queue, but the resulted in problems where the samples were part of the par2 set. So removing them would then force those jobs through repair or even fail if not enough blocks were available.
Re: Delete files with specific text in already added job in queue?
Posted: May 4th, 2025, 9:51 am
by iUseNetter
Thank you for your explanation, @safihre
I see no difference between manually deleting the sample and nfo files in the mentioned “Edit NZB details - Password” window and automatic deletion by a script.
Example:
But if we don't have the technical possibility to automatically execute API calls to a job in the Queue (after the job is added to it), then that's how it is.
Re: Delete files with specific text in already added job in queue?
Posted: May 5th, 2025, 4:15 am
by safihre
Indeed, there's only a pre queue script and not one after the job was added to the queue.
You might have to just set some cronjob to do it, unfortunately.