Skip to content

Commit

Permalink
- NzbindexBeta removed, its out of beta
Browse files Browse the repository at this point in the history
- Fixed NzbKing (good for old nzblnks)
- Switched to PyInstaller
  • Loading branch information
nzblnk committed Apr 22, 2019
1 parent 39dcf83 commit 64f90a4
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 32 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.idea/
dist/
build/
*.iml
*.nzb
*.cfg
*.spec
*.pyc
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 NZBLNK
Copyright (c) 2019 NZBLNK

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 1 addition & 7 deletions make_windows.cmd
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
@echo off

py -3 -c "import sys;exit(2 if sys.maxsize > 2**32 else 1)"
if errorlevel 2 goto SIXTYFOUR

set DIR=%CD%
cd %~dp0
set PYTHONPATH=./src
py -3 setup.py py2exe
pyinstaller -F --distpath ./dist --workpath ./build --icon ./resource/nzb-monkey-icons.ico --noupx --clean ./src/nzbmonkey.py
cd %DIR%
goto EOF

:SIXTYFOUR
echo.
echo Please run with a 32-bit python.
:EOF
timeout 5
4 changes: 2 additions & 2 deletions requirements-build.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ pyperclip
requests
configobj
colorama
cryptography==1.8.2
py2exe
cryptography
pyinstaller
2 changes: 1 addition & 1 deletion src/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 NZBLNK
Copyright (c) 2019 NZBLNK

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
41 changes: 23 additions & 18 deletions src/nzbmonkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
from os.path import basename, splitext, isfile, join, expandvars
from pathlib import Path
from time import sleep, time, localtime, strftime
from unicodedata import normalize
from urllib.parse import urlparse, parse_qs, quote

from unicodedata import normalize

from nzblnkconfig import check_missing_modules

try:
Expand Down Expand Up @@ -683,7 +684,7 @@ def search_nzb_url(self):
print(Col.WARN + ' Connection Error' + Col.OFF, flush=True)
return False, None

m = re.search(self.regex, res.text)
m = re.search(self.regex, res.text, re.DOTALL)
if m is None:
print(Col.WARN + ' NOT FOUND' + Col.OFF, flush=True)
return False, None
Expand All @@ -701,7 +702,13 @@ def download_nzb(self):
if not res:
return False, None
try:
res = requests.get(self.nzb_url, timeout=REQUESTS_TIMEOUT, verify=False)
urlparam = self.nzb_url.split('\t')
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
if len(urlparam) > 1:
res = requests.post(urlparam[0], data=urlparam[1], headers=headers, timeout=REQUESTS_TIMEOUT,
verify=False)
else:
res = requests.get(self.nzb_url, timeout=REQUESTS_TIMEOUT, verify=False)
except requests.exceptions.Timeout:
print(Col.WARN + ' Timeout' + Col.OFF, flush=True)
return False, None
Expand Down Expand Up @@ -755,26 +762,25 @@ def search_nzb(header, password, search_engines, best_nzb, max_missing_files, ma
},
'nzbking':
{
# Message to @Tensai:
#
# We love your work on the "NZB Donkey", but please be so fair and put credits in your
# tool. Means: please tell your users at least in the about screen on which tool yours
# is based on. Oh and as we speak about credits: a additional link from your tool to the
# NZBLNK website (https://nzblnk.info) would be great. Thanks and go on with your great
# work.
'name': 'NZBKing',
'searchUrl': 'http://www.nzbking.com/search/?q={0}',
'regex': r'href="/details:(?P<id>.*?)\/"',
'downloadUrl': 'http://www.nzbking.com/nzb:{id}',
'searchUrl': 'https://www.nzbking.com/search/?q={0}',
'regex': r'"csrfmiddlewaretoken" value="(?P<csrf>.*?)".*href="/details:(?P<id>.*?)/"',
'downloadUrl': 'https://www.nzbking.com/nzb/\tcsrfmiddlewaretoken={csrf}&nzb={id}',
'skip_segment_debug': True
},
'nzbindex':
{
'name': 'NZBIndex',
'searchUrl': 'http://nzbindex.com/search/?q={0}&sort=agedesc&hidespam=1',
'regex': r'label for="box(?P<id>\d{8,})".*?class="highlight"',
'downloadUrl': 'http://nzbindex.com/download/{id}/',
'skip_segment_debug': False
},
'nzbindex_beta':
{
'name': 'NZBIndex Beta',
'searchUrl': 'http://beta.nzbindex.com/search/rss?q={0}&hidespam=1&sort=agedesc&complete=1',
'regex': r'<link>http:\/\/beta\.nzbindex\.com\/download\/(?P<id>\d{8,})\/?<\/link>',
'downloadUrl': 'http://beta.nzbindex.com/download/{id}.nzb?r[]={id}',
'searchUrl': 'https://nzbindex.com/search/rss?q={0}&hidespam=1&sort=agedesc&complete=1',
'regex': r'<link>https:\/\/nzbindex\.com\/download\/(?P<id>\d{8,})\/?<\/link>',
'downloadUrl': 'https://nzbindex.com/download/{id}.nzb?r[]={id}',
'skip_segment_debug': False
},
'newzleech':
Expand Down Expand Up @@ -1499,7 +1505,6 @@ def main():
cfg['Searchengines'].as_int('binsearch_alternative'),
'nzbking': cfg['Searchengines'].as_int('nzbking'),
'nzbindex': cfg['Searchengines'].as_int('nzbindex'),
'nzbindex_beta': cfg['Searchengines'].as_int('nzbindex_beta'),
'newzleech': cfg['Searchengines'].as_int('newzleech')},
cfg['NZBCheck'].as_bool('best_nzb'),
cfg['NZBCheck'].get('max_missing_files', 2),
Expand Down
2 changes: 0 additions & 2 deletions src/nzbmonkeyspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ def getSpec():
binsearch_alternative = integer(default = 1)
# Enable NZBIndex
nzbindex = integer(default = 1)
# Enable NZBIndex Beta
nzbindex_beta = integer(default = 1)
# Enable NZBKing
nzbking = integer(default = 1)
# Enable Newzleech
Expand Down
6 changes: 5 additions & 1 deletion src/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"""
History
v0.2.5
- NzbindexBeta removed, its out of beta
- Fixed NzbKing (good for old nzblnks)
v0.2.4
- NzbindexBeta indexer regex fix
Expand Down Expand Up @@ -75,5 +79,5 @@
"""

__version__ = '0.2.4'
__version__ = '0.2.5'
__requires__ = ['pyperclip', 'requests', 'configobj', 'colorama', 'cryptography']

0 comments on commit 64f90a4

Please sign in to comment.