diff --git a/filebottool/pyfilebot.py b/filebottool/pyfilebot.py index 9c97499..185aa1c 100644 --- a/filebottool/pyfilebot.py +++ b/filebottool/pyfilebot.py @@ -168,11 +168,22 @@ def rename(targets, if u"License Error: UNREGISTERED" in filebot_error.decode('utf8', 'ignore'): raise FilebotLicenseError("Filebot is unregistered, cannot rename.\n" "FILEBOT OUTPUT DUMP:\n{0}".format(data)) - else: + elif rename_action != 'test': raise FilebotRuntimeError("FILEBOT OUTPUT DUMP:\n{0}\nstderr:\n{1}".format( data, filebot_error)) - return parse_filebot(data) + try: + results = parse_filebot(data) + except: + parse_error = True + else: + parse_error = False + + if parse_error or (rename_action == 'test' and results[0] == 0): + raise FilebotRuntimeError("FILEBOT OUTPUT DUMP:\n{0}\nstderr:\n{1}".format( + data, filebot_error)) + return results + def parse_filebot(data): @@ -209,6 +220,8 @@ def parse_filebot(data): if match: total_processed_files = int(match.group(1)) + + # file moves file_moves = [] for line in data: diff --git a/setup.py b/setup.py index 9ea8a3a..fcc774f 100755 --- a/setup.py +++ b/setup.py @@ -42,7 +42,7 @@ __plugin_name__ = "FileBotTool" __author__ = "laharah" __author_email__ = "laharah+fbt@gmail.com" -__version__ = "1.2.10" +__version__ = "1.2.11" __url__ = "https://github.com/Laharah/deluge-FileBotTool" __license__ = "GPLv3" __description__ = "Integrates FileBot functionality to Deluge"