Skip to content

Commit

Permalink
Detect dry run errors without exit-codes
Browse files Browse the repository at this point in the history
FileBot 4.9.2 returns a 1 on --action test calls because no files are
processed. This update is a work around for that.
  • Loading branch information
Laharah committed Oct 12, 2020
1 parent 7585a14 commit 5b2f6af
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
17 changes: 15 additions & 2 deletions filebottool/pyfilebot.py
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -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"
Expand Down

0 comments on commit 5b2f6af

Please sign in to comment.