Skip to content

Commit

Permalink
Added automated download specification
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabisonfire committed Jun 7, 2021
1 parent fda7a38 commit 3a457a6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ Raincoat is a CLI tool to search torrents using [Jackett](https://github.com/Jac
- Change the sorting criteria. Valid choices are: 'seeders', 'leechers', 'ratio', 'size' and 'description'. Default/not specified is 'seeders'.
- -i, --indexer
- Change the indexer used for your search, in cases where you want to only search one site. Default is "all".
- -d, --download
- Grab the first result and send to the client immediately.
- -d, --download x
- Grab the first x resultd and send to the client immediately. Defaults to 1.
- -K, --insecure
- Don't verify certificates
- --local
Expand Down
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
=== 1.1 ===
- Added the option to specify the number of entries to dowload automatically

=== 1.0 ===
- Fixed a minor typo preventing from using indexer parameter in the command line.

Expand Down
10 changes: 7 additions & 3 deletions raincoat/raincoat.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
parser.add_argument("-c", "--config", help="Specify a different config file path.")
parser.add_argument("-s", "--sort", help="Change sorting criteria.", action="store", dest="sort", choices=['seeders', 'leechers', 'ratio', 'size', 'description'])
parser.add_argument("-i", "--indexer", help="The Jackett indexer to use for your search.")
parser.add_argument("-d", "--download", help="Download and send the top result to the client and exit.", action="store_true")
parser.add_argument("-d", "--download", help="Download and send the top 'x' results (defaults to 1) to the client and exit.", nargs='?', const=1, type=int)
parser.add_argument("-K", "--insecure", help="Enables to use self-signed certificates.", action="store_true")
parser.add_argument("--local", help="Override torrent provider with local download.", action="store_true")
parser.add_argument("--verbose", help="Very verbose output to logs.", action="store_true")
Expand Down Expand Up @@ -89,7 +89,7 @@ def set_overrides():
shared.VERBOSE_MODE = True

if args.download:
shared.DOWNLOAD = True
shared.DOWNLOAD = args.download

if args.insecure:
requests.packages.urllib3.disable_warnings(category=InsecureRequestWarning)
Expand All @@ -98,7 +98,11 @@ def set_overrides():
def prompt_torrent():
if shared.DOWNLOAD:
if len(shared.TORRENTS) > 0:
download(shared.TORRENTS[0].id)
# Prevent out of bound results
if shared.DOWNLOAD > len(shared.TORRENTS):
shared.DOWNLOAD = len(shared.TORRENTS)
for i in range(shared.DOWNLOAD):
download(shared.TORRENTS[i].id)
exit()
else:
print("Search did not yield any results.")
Expand Down
4 changes: 2 additions & 2 deletions raincoat/shared.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Globals
def init():
global VERSION
VERSION = "1.0"
VERSION = "1.1"
global APP_NAME
APP_NAME = "Raincoat"
global TORRENTS
Expand Down Expand Up @@ -35,7 +35,7 @@ def init():
global VERBOSE_MODE
VERBOSE_MODE = False
global DOWNLOAD
DOWNLOAD = False
DOWNLOAD = 0
global VERIFY
VERIFY = True

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def run(self):

setuptools.setup(
name="raincoat-jackett",
version="1.0",
version="1.1",
author="Gabisonfire",
author_email="gabisonfire@github.com",
description="Raincoat is a tool to search torrents using Jackett and send them to your client.",
Expand Down

0 comments on commit 3a457a6

Please sign in to comment.