Allow for a list of to-be-skipped release names

master
Sven Slootweg 11 years ago
parent e85eeb3bb2
commit 974d28973d

@ -25,6 +25,10 @@ contains all the available IPs on your machine. nzbspider will randomly
pick one for every search query. If not specified, the OS default is pick one for every search query. If not specified, the OS default is
used. used.
Using `--skip` you can specify a newline-delimited file that contains
all release names that should be skipped, no matter what. This works in
both modes.
### Release list ### Release list
This is a text file, specified with the `--list` parameter, that This is a text file, specified with the `--list` parameter, that

@ -10,6 +10,7 @@ parser.add_argument("--list", dest="list", action="store", help="Use a newline-d
parser.add_argument("--target", dest="target", action="store", help="Where to save the NZBs (only needed in list mode)") parser.add_argument("--target", dest="target", action="store", help="Where to save the NZBs (only needed in list mode)")
parser.add_argument("--iplist", dest="iplist", action="store", help="Bind every request to a random IP from a newline-delimited list") parser.add_argument("--iplist", dest="iplist", action="store", help="Bind every request to a random IP from a newline-delimited list")
parser.add_argument("--limit", dest="limit", action="store", help="How many records to select in configuration file mode, at most (default: 250)", default=250) parser.add_argument("--limit", dest="limit", action="store", help="How many records to select in configuration file mode, at most (default: 250)", default=250)
parser.add_argument("--skip", dest="skip", action="store", help="Optionally, a path to a newline-delimited list of release names to always skip")
args = parser.parse_args() args = parser.parse_args()
if args.config is not None: if args.config is not None:
@ -26,6 +27,12 @@ if args.iplist is not None:
else: else:
iplist = [""] iplist = [""]
if args.skip is not None:
skip_file = open(args.skip, "r")
skiplist = skip_file.read().splitlines()
else:
skiplist = [""]
if mode == "config": if mode == "config":
try: try:
conf = json.load(open("config.json", "r")) conf = json.load(open("config.json", "r"))
@ -113,6 +120,11 @@ for release in releases:
notfound += 1 notfound += 1
continue continue
if release_name in skiplist:
# This release should be skipped
skipped += 1
continue
try: try:
os.makedirs(target_dir) os.makedirs(target_dir)
except OSError, e: except OSError, e:

Loading…
Cancel
Save