mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 21:33:13 -07:00
Merge pull request #1583 from clinton-hall/fix-1
remove .encode which creates byte vs string comparison issues.
This commit is contained in:
commit
bdec673bb9
3 changed files with 36 additions and 36 deletions
|
@ -60,14 +60,14 @@ def process_torrent(input_directory, input_name, input_category, input_hash, inp
|
||||||
input_category = 'UNCAT'
|
input_category = 'UNCAT'
|
||||||
|
|
||||||
usercat = input_category
|
usercat = input_category
|
||||||
try:
|
#try:
|
||||||
input_name = input_name.encode(core.SYS_ENCODING)
|
# input_name = input_name.encode(core.SYS_ENCODING)
|
||||||
except UnicodeError:
|
#except UnicodeError:
|
||||||
pass
|
# pass
|
||||||
try:
|
#try:
|
||||||
input_directory = input_directory.encode(core.SYS_ENCODING)
|
# input_directory = input_directory.encode(core.SYS_ENCODING)
|
||||||
except UnicodeError:
|
#except UnicodeError:
|
||||||
pass
|
# pass
|
||||||
|
|
||||||
logger.debug('Determined Directory: {0} | Name: {1} | Category: {2}'.format
|
logger.debug('Determined Directory: {0} | Name: {1} | Category: {2}'.format
|
||||||
(input_directory, input_name, input_category))
|
(input_directory, input_name, input_category))
|
||||||
|
@ -125,10 +125,10 @@ def process_torrent(input_directory, input_name, input_category, input_hash, inp
|
||||||
else:
|
else:
|
||||||
output_destination = os.path.normpath(
|
output_destination = os.path.normpath(
|
||||||
core.os.path.join(core.OUTPUT_DIRECTORY, input_category))
|
core.os.path.join(core.OUTPUT_DIRECTORY, input_category))
|
||||||
try:
|
#try:
|
||||||
output_destination = output_destination.encode(core.SYS_ENCODING)
|
# output_destination = output_destination.encode(core.SYS_ENCODING)
|
||||||
except UnicodeError:
|
#except UnicodeError:
|
||||||
pass
|
# pass
|
||||||
|
|
||||||
if output_destination in input_directory:
|
if output_destination in input_directory:
|
||||||
output_destination = input_directory
|
output_destination = input_directory
|
||||||
|
@ -170,10 +170,10 @@ def process_torrent(input_directory, input_name, input_category, input_hash, inp
|
||||||
core.os.path.join(output_destination, os.path.basename(file_path)), full_file_name)
|
core.os.path.join(output_destination, os.path.basename(file_path)), full_file_name)
|
||||||
logger.debug('Setting outputDestination to {0} to preserve folder structure'.format
|
logger.debug('Setting outputDestination to {0} to preserve folder structure'.format
|
||||||
(os.path.dirname(target_file)))
|
(os.path.dirname(target_file)))
|
||||||
try:
|
#try:
|
||||||
target_file = target_file.encode(core.SYS_ENCODING)
|
# target_file = target_file.encode(core.SYS_ENCODING)
|
||||||
except UnicodeError:
|
#except UnicodeError:
|
||||||
pass
|
# pass
|
||||||
if root == 1:
|
if root == 1:
|
||||||
if not found_file:
|
if not found_file:
|
||||||
logger.debug('Looking for {0} in: {1}'.format(input_name, inputFile))
|
logger.debug('Looking for {0} in: {1}'.format(input_name, inputFile))
|
||||||
|
@ -350,15 +350,15 @@ def main(args):
|
||||||
if client_agent.lower() not in core.TORRENT_CLIENTS:
|
if client_agent.lower() not in core.TORRENT_CLIENTS:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
try:
|
#try:
|
||||||
dir_name = dir_name.encode(core.SYS_ENCODING)
|
# dir_name = dir_name.encode(core.SYS_ENCODING)
|
||||||
except UnicodeError:
|
#except UnicodeError:
|
||||||
pass
|
# pass
|
||||||
input_name = os.path.basename(dir_name)
|
input_name = os.path.basename(dir_name)
|
||||||
try:
|
#try:
|
||||||
input_name = input_name.encode(core.SYS_ENCODING)
|
# input_name = input_name.encode(core.SYS_ENCODING)
|
||||||
except UnicodeError:
|
#except UnicodeError:
|
||||||
pass
|
# pass
|
||||||
|
|
||||||
results = process_torrent(dir_name, input_name, subsection, input_hash or None, input_id or None,
|
results = process_torrent(dir_name, input_name, subsection, input_hash or None, input_id or None,
|
||||||
client_agent)
|
client_agent)
|
||||||
|
|
|
@ -90,14 +90,14 @@ def find_imdbid(dir_name, input_name, omdb_api_key):
|
||||||
def category_search(input_directory, input_name, input_category, root, categories):
|
def category_search(input_directory, input_name, input_category, root, categories):
|
||||||
tordir = False
|
tordir = False
|
||||||
|
|
||||||
try:
|
#try:
|
||||||
input_name = input_name.encode(core.SYS_ENCODING)
|
# input_name = input_name.encode(core.SYS_ENCODING)
|
||||||
except Exception:
|
#except Exception:
|
||||||
pass
|
# pass
|
||||||
try:
|
#try:
|
||||||
input_directory = input_directory.encode(core.SYS_ENCODING)
|
# input_directory = input_directory.encode(core.SYS_ENCODING)
|
||||||
except Exception:
|
#except Exception:
|
||||||
pass
|
# pass
|
||||||
|
|
||||||
if input_directory is None: # =Nothing to process here.
|
if input_directory is None: # =Nothing to process here.
|
||||||
return input_directory, input_name, input_category, root
|
return input_directory, input_name, input_category, root
|
||||||
|
|
|
@ -20,10 +20,10 @@ def sanitize_name(name):
|
||||||
|
|
||||||
# remove leading/trailing periods and spaces
|
# remove leading/trailing periods and spaces
|
||||||
name = name.strip(' .')
|
name = name.strip(' .')
|
||||||
try:
|
#try:
|
||||||
name = name.encode(core.SYS_ENCODING)
|
# name = name.encode(core.SYS_ENCODING)
|
||||||
except Exception:
|
#except Exception:
|
||||||
pass
|
# pass
|
||||||
|
|
||||||
return name
|
return name
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue