|
|
@ -107,6 +107,7 @@ def remove_empty_kwargs(**kwargs): |
|
|
|
good_kwargs[key] = value |
|
|
|
return good_kwargs |
|
|
|
|
|
|
|
|
|
|
|
def searchThumbnail(options): |
|
|
|
video_directory = dirname(options.get('--file')) + "/" |
|
|
|
# First, check for thumbnail based on videoname |
|
|
@ -124,6 +125,7 @@ def searchThumbnail(options): |
|
|
|
options['--thumbnail'] = video_directory + video_file + ".jpeg" |
|
|
|
return options |
|
|
|
|
|
|
|
|
|
|
|
# return the nfo as a RawConfigParser object |
|
|
|
def loadNFO(options): |
|
|
|
video_directory = dirname(options.get('--file')) + "/" |
|
|
@ -168,10 +170,12 @@ def loadNFO(options): |
|
|
|
logging.info("No suitable NFO found, skipping.") |
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
def parseNFO(options): |
|
|
|
nfo = loadNFO(options) |
|
|
|
if nfo: |
|
|
|
# We need to check all options and replace it with the nfo value if not defined (None or False) |
|
|
|
# We need to check all options and replace it with the nfo value if not |
|
|
|
# defined (None or False) |
|
|
|
for key, value in options.iteritems(): |
|
|
|
key = key.replace("-", "") |
|
|
|
try: |
|
|
@ -188,9 +192,11 @@ def parseNFO(options): |
|
|
|
exit(1) |
|
|
|
return options |
|
|
|
|
|
|
|
|
|
|
|
def upcaseFirstLetter(s): |
|
|
|
return s[0].upper() + s[1:] |
|
|
|
|
|
|
|
|
|
|
|
def cleanString(toclean): |
|
|
|
toclean = toclean.decode('utf-8') |
|
|
|
toclean = unidecode.unidecode(toclean) |
|
|
@ -198,10 +204,11 @@ def cleanString(toclean): |
|
|
|
|
|
|
|
return cleaned |
|
|
|
|
|
|
|
|
|
|
|
def decodeArgumentStrings(options, encoding): |
|
|
|
# Python crash when decoding from UTF-8 to UTF-8, so we prevent this |
|
|
|
if "utf-8" == encoding.lower(): |
|
|
|
return; |
|
|
|
return |
|
|
|
|
|
|
|
if options["--name"] is not None: |
|
|
|
options["--name"] = options["--name"].decode(encoding) |
|
|
@ -211,3 +218,4 @@ def decodeArgumentStrings(options, encoding): |
|
|
|
|
|
|
|
if options["--tags"] is not None: |
|
|
|
options["--tags"] = options["--tags"].decode(encoding) |
|
|
|
|