mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 05:43:16 -07:00
Merge branch 'nightly' into dev
This commit is contained in:
commit
25528f8e7b
7 changed files with 70 additions and 41 deletions
|
@ -1,5 +1,5 @@
|
||||||
[bumpversion]
|
[bumpversion]
|
||||||
current_version = 12.1.03
|
current_version = 12.1.04
|
||||||
commit = True
|
commit = True
|
||||||
tag = False
|
tag = False
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ from core.utils import (
|
||||||
wake_up,
|
wake_up,
|
||||||
)
|
)
|
||||||
|
|
||||||
__version__ = '12.1.03'
|
__version__ = '12.1.04'
|
||||||
|
|
||||||
# Client Agents
|
# Client Agents
|
||||||
NZB_CLIENTS = ['sabnzbd', 'nzbget', 'manual']
|
NZB_CLIENTS = ['sabnzbd', 'nzbget', 'manual']
|
||||||
|
|
|
@ -125,7 +125,7 @@ def process(section, dir_name, input_name=None, status=0, client_agent='manual',
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
res = json.loads(r.content)
|
res = r.json()
|
||||||
scan_id = int(res['id'])
|
scan_id = int(res['id'])
|
||||||
logger.debug('Scan started with id: {0}'.format(scan_id), section)
|
logger.debug('Scan started with id: {0}'.format(scan_id), section)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
@ -95,12 +95,13 @@ def process(section, dir_name, input_name=None, failed=False, client_agent='manu
|
||||||
# Attempt to create the directory if it doesn't exist and ignore any
|
# Attempt to create the directory if it doesn't exist and ignore any
|
||||||
# error stating that it already exists. This fixes a bug where SickRage
|
# error stating that it already exists. This fixes a bug where SickRage
|
||||||
# won't process the directory because it doesn't exist.
|
# won't process the directory because it doesn't exist.
|
||||||
try:
|
if dir_name:
|
||||||
os.makedirs(dir_name) # Attempt to create the directory
|
try:
|
||||||
except OSError as e:
|
os.makedirs(dir_name) # Attempt to create the directory
|
||||||
# Re-raise the error if it wasn't about the directory not existing
|
except OSError as e:
|
||||||
if e.errno != errno.EEXIST:
|
# Re-raise the error if it wasn't about the directory not existing
|
||||||
raise
|
if e.errno != errno.EEXIST:
|
||||||
|
raise
|
||||||
|
|
||||||
if 'process_method' not in fork_params or (client_agent in ['nzbget', 'sabnzbd'] and nzb_extraction_by != 'Destination'):
|
if 'process_method' not in fork_params or (client_agent in ['nzbget', 'sabnzbd'] and nzb_extraction_by != 'Destination'):
|
||||||
if input_name:
|
if input_name:
|
||||||
|
@ -343,7 +344,7 @@ def process(section, dir_name, input_name=None, failed=False, client_agent='manu
|
||||||
time.sleep(60)
|
time.sleep(60)
|
||||||
elif section == 'NzbDrone':
|
elif section == 'NzbDrone':
|
||||||
try:
|
try:
|
||||||
res = json.loads(r.content)
|
res = r.json()
|
||||||
scan_id = int(res['id'])
|
scan_id = int(res['id'])
|
||||||
logger.debug('Scan started with id: {0}'.format(scan_id), section)
|
logger.debug('Scan started with id: {0}'.format(scan_id), section)
|
||||||
started = True
|
started = True
|
||||||
|
|
|
@ -27,40 +27,68 @@ def char_replace(name_in):
|
||||||
encoded = False
|
encoded = False
|
||||||
encoding = None
|
encoding = None
|
||||||
if isinstance(name_in, text_type):
|
if isinstance(name_in, text_type):
|
||||||
return encoded, name_in.encode(core.SYS_ENCODING)
|
return encoded, name_in
|
||||||
if PY2:
|
if PY2:
|
||||||
name = name_in
|
name = name_in
|
||||||
|
for Idx in range(len(name)):
|
||||||
|
# print('Trying to intuit the encoding')
|
||||||
|
# /!\ detection is done 2char by 2char for UTF-8 special character
|
||||||
|
if (len(name) != 1) & (Idx < (len(name) - 1)):
|
||||||
|
# Detect UTF-8
|
||||||
|
if ((name[Idx] == '\xC2') | (name[Idx] == '\xC3')) & (
|
||||||
|
(name[Idx + 1] >= '\xA0') & (name[Idx + 1] <= '\xFF')):
|
||||||
|
encoding = 'utf-8'
|
||||||
|
break
|
||||||
|
# Detect CP850
|
||||||
|
elif (name[Idx] >= '\x80') & (name[Idx] <= '\xA5'):
|
||||||
|
encoding = 'cp850'
|
||||||
|
break
|
||||||
|
# Detect ISO-8859-15
|
||||||
|
elif (name[Idx] >= '\xA6') & (name[Idx] <= '\xFF'):
|
||||||
|
encoding = 'iso-8859-15'
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
# Detect CP850
|
||||||
|
if (name[Idx] >= '\x80') & (name[Idx] <= '\xA5'):
|
||||||
|
encoding = 'cp850'
|
||||||
|
break
|
||||||
|
# Detect ISO-8859-15
|
||||||
|
elif (name[Idx] >= '\xA6') & (name[Idx] <= '\xFF'):
|
||||||
|
encoding = 'iso-8859-15'
|
||||||
|
break
|
||||||
else:
|
else:
|
||||||
name = bytes(name_in)
|
name = bytes(name_in)
|
||||||
for Idx in range(len(name)):
|
for Idx in range(len(name)):
|
||||||
print('Trying to intuit the encoding')
|
# print('Trying to intuit the encoding')
|
||||||
# /!\ detection is done 2char by 2char for UTF-8 special character
|
# /!\ detection is done 2char by 2char for UTF-8 special character
|
||||||
if (len(name) != 1) & (Idx < (len(name) - 1)):
|
if (len(name) != 1) & (Idx < (len(name) - 1)):
|
||||||
# Detect UTF-8
|
# Detect UTF-8
|
||||||
if ((name[Idx] == 0xC2) | (name[Idx] == 0xC3)) & (
|
if ((name[Idx] == 0xC2) | (name[Idx] == 0xC3)) & (
|
||||||
(name[Idx + 1] >= 0xA0) & (name[Idx + 1] <= 0xFF)):
|
(name[Idx + 1] >= 0xA0) & (name[Idx + 1] <= 0xFF)):
|
||||||
encoding = 'utf-8'
|
encoding = 'utf-8'
|
||||||
break
|
break
|
||||||
# Detect CP850
|
# Detect CP850
|
||||||
elif (name[Idx] >= 0x80) & (name[Idx] <= 0xA5):
|
elif (name[Idx] >= 0x80) & (name[Idx] <= 0xA5):
|
||||||
encoding = 'cp850'
|
encoding = 'cp850'
|
||||||
break
|
break
|
||||||
# Detect ISO-8859-15
|
# Detect ISO-8859-15
|
||||||
elif (name[Idx] >= 0xA6) & (name[Idx] <= 0xFF):
|
elif (name[Idx] >= 0xA6) & (name[Idx] <= 0xFF):
|
||||||
encoding = 'iso-8859-15'
|
encoding = 'iso-8859-15'
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
# Detect CP850
|
# Detect CP850
|
||||||
if (name[Idx] >= 0x80) & (name[Idx] <= 0xA5):
|
if (name[Idx] >= 0x80) & (name[Idx] <= 0xA5):
|
||||||
encoding = 'cp850'
|
encoding = 'cp850'
|
||||||
break
|
break
|
||||||
# Detect ISO-8859-15
|
# Detect ISO-8859-15
|
||||||
elif (name[Idx] >= 0xA6) & (name[Idx] <= 0xFF):
|
elif (name[Idx] >= 0xA6) & (name[Idx] <= 0xFF):
|
||||||
encoding = 'iso-8859-15'
|
encoding = 'iso-8859-15'
|
||||||
break
|
break
|
||||||
if encoding and not encoding == core.SYS_ENCODING:
|
if encoding:
|
||||||
encoded = True
|
encoded = True
|
||||||
name = name.decode(encoding).encode(core.SYS_ENCODING)
|
name = name.decode(encoding)
|
||||||
|
elif not PY2:
|
||||||
|
name = name.decode()
|
||||||
return encoded, name
|
return encoded, name
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ def find_imdbid(dir_name, input_name, omdb_api_key):
|
||||||
url = 'http://www.omdbapi.com'
|
url = 'http://www.omdbapi.com'
|
||||||
|
|
||||||
if not omdb_api_key:
|
if not omdb_api_key:
|
||||||
logger.info('Unable to determine imdbID: No api key provided for ombdapi.com.')
|
logger.info('Unable to determine imdbID: No api key provided for omdbapi.com.')
|
||||||
return
|
return
|
||||||
|
|
||||||
logger.debug('Opening URL: {0}'.format(url))
|
logger.debug('Opening URL: {0}'.format(url))
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -23,7 +23,7 @@ def read(*names, **kwargs):
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='nzbToMedia',
|
name='nzbToMedia',
|
||||||
version='12.1.03',
|
version='12.1.04',
|
||||||
license='GPLv3',
|
license='GPLv3',
|
||||||
description='Efficient on demand post processing',
|
description='Efficient on demand post processing',
|
||||||
long_description="""
|
long_description="""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue