[Request] Pause based on priority

Share your scripts or request scripts with specific features.
Forum rules
Please keep the forum clean - one topic per script. Questions not related to a specific script should be posted in Support forum.
Post Reply
lexguy2007
Posts: 4
Joined: 23 Sep 2015, 22:46

[Request] Pause based on priority

Post by lexguy2007 » 04 Jan 2019, 02:55

I am looking for a script that will pause downloads added by Sonarr and Radarr for low priority as set in each of those respective programs yet will allow high priority downloads to run. Anyone have or know of a script like that and can assist me it getting it set up?

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: [Request] Pause based on priority

Post by hugbug » 04 Jan 2019, 21:37

This should be achievable via a scan-script. In the script you can check priority of the item and then instruct nzbget to pause the item.

If you need to pause only items coming from certain programs you need a way to detect where the files come from. For that you could use special categories (which you use only in that programs).

For details on scan-scripts see https://nzbget.net/scan-scripts. If you have troubles with your script then post your script and we'll improve it together.

Here two examples of scan-scripts: https://forum.nzbget.net/viewtopic.php?f=8&t=2999 and https://forum.nzbget.net/viewtopic.php?f=8&t=2178

lexguy2007
Posts: 4
Joined: 23 Sep 2015, 22:46

Re: [Request] Pause based on priority

Post by lexguy2007 » 04 Jan 2019, 23:10

Thanks you for the reply. I love NZBGet btw. lol Anyway, I found something several page into the forum someone asking about a script to do exactly what I am needing. The thread it about 4+ years old so I am wondering if that script is compatible with current versions....?


https://forum.nzbget.net/viewtopic.php?f=8&t=1169

#!/usr/bin/env python
#
# Scan script for NZBGet
#
# Copyright (C) 2014 Andrey Prygunkov <hugbug@users.sourceforge.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#


##############################################################################
### NZBGET SCAN SCRIPT ###

# Pause downloads added with very low priority.
#
# NOTE: This script requires Python to be installed on your system.

### NZBGET SCAN SCRIPT ###
##############################################################################

import os

# Standard priorities
VERY_HIGH_PRIORITY=100
HIGH_PRIORITY=50
NORMAL_PRIORITY=0
LOW_PRIORITY=-50
VERY_LOW_PRIORITY=-100

# Check if the script is called from nzbget 11.0 or later
if not 'NZBOP_SCRIPTDIR' in os.environ:
print('This script is supposed to be called from nzbget (11.0 or later).')
sys.exit(R)

priority = int(os.environ['NZBNP_PRIORITY'])

if priority == VERY_LOW_PRIORITY:
print('[WARNING] %s: Pausing %s' % (os.path.basename(__file__), os.path.splitext(os.environ['NZBNP_NZBNAME'])[0]))
print('[NZB] PAUSED=1')

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: [Request] Pause based on priority

Post by hugbug » 04 Jan 2019, 23:27

Oh, nice. It should work.

lexguy2007
Posts: 4
Joined: 23 Sep 2015, 22:46

Re: [Request] Pause based on priority

Post by lexguy2007 » 05 Jan 2019, 01:04

I am having trouble getting it to work though. My need is to have Sonarr set the priority for older shows at Very Low and for the script to therefor PAUSE the download. If it is a newly aired show, I have Sonarr set up to make the priority Normal and therefor I want the download to run.

I added the script in the Extensions and it is first in ScriptOrder and it is set up for the TV2 Category to which Sonarr sends the downloads. Have I overlooked something?

lexguy2007
Posts: 4
Joined: 23 Sep 2015, 22:46

Re: [Request] Pause based on priority

Post by lexguy2007 » 05 Jan 2019, 03:10

Ha! Got it working. Not sure how but it is.... Thanks your your help.

Post Reply

Who is online

Users browsing this forum: No registered users and 27 guests