diff --git a/filebottool/gtkui/rename_dialog_gtk3.py b/filebottool/gtkui/rename_dialog_gtk3.py index 2c658fe..3bb0a14 100644 --- a/filebottool/gtkui/rename_dialog_gtk3.py +++ b/filebottool/gtkui/rename_dialog_gtk3.py @@ -101,7 +101,7 @@ def __init__(self, dialog_settings, server_plugin_version): if self.server_filebot_version: self.builder.get_object("filebot_version").set_text( - self.server_filebot_version.decode("utf8") + self.server_filebot_version ) else: diff --git a/filebottool/gtkui/user_messenger_gtk3.py b/filebottool/gtkui/user_messenger_gtk3.py index 99f018a..1692f00 100644 --- a/filebottool/gtkui/user_messenger_gtk3.py +++ b/filebottool/gtkui/user_messenger_gtk3.py @@ -41,7 +41,7 @@ def dialog_response_cb(dialog, response_id): if not self.modal: self.set_modal(True) self.connect('response', dialog_response_cb) - self.show() + self.show_all() class ResponseDialog(Gtk.Dialog): @@ -84,7 +84,7 @@ def show_new_files(self, files): files = [' => '.join(f) if isinstance(f, tuple) else f for f in files] files = pprint.pformat(files) text_view = Gtk.TextView() - text_view.get_buffer().set_text(files.decode('utf8')) + text_view.get_buffer().set_text(files) text_view.set_editable(False) text_view.set_cursor_visible(False) text_view.show() @@ -172,7 +172,7 @@ def _show_details(_): def display_text(self, title, text, parent=None, modal=False): dialog = InfoDialog(title, None, parent, modal) text_view = Gtk.TextView() - text_view.get_buffer().set_text(text.decode('utf8')) + text_view.get_buffer().set_text(text) text_view.set_editable(False) text_view.set_cursor_visible(False) sw = Gtk.ScrolledWindow() diff --git a/filebottool/pyfilebot.py b/filebottool/pyfilebot.py index af21769..902d587 100644 --- a/filebottool/pyfilebot.py +++ b/filebottool/pyfilebot.py @@ -201,7 +201,7 @@ def rename( exit_code, data, filebot_error = _execute(filebot_arguments, workaround) if exit_code != 0: - if u"License Error: UNREGISTERED" in filebot_error.decode("utf8", "ignore"): + if u"License Error: UNREGISTERED" in filebot_error: raise FilebotLicenseError( "Filebot is unregistered, cannot rename.\n" "FILEBOT OUTPUT DUMP:\n{0}".format(data) @@ -221,7 +221,7 @@ def rename( if parse_error or (rename_action == "test" and results[0] == 0): raise FilebotRuntimeError( "FILEBOT OUTPUT DUMP:\n{0}\nstderr:\n{1}".format( - data.decode("utf8"), filebot_error + data, filebot_error ) ) return results @@ -241,13 +241,6 @@ def parse_filebot(data): a tuple in format (num processed files, list of movement tuples, skipped/failed files) """ - try: - data = data.decode("utf8") - except UnicodeDecodeError: - warnings.warn( - "DECODING ERROR WARNING: UNVALID UNICODE DETECTED!", UnicodeWarning - ) - data = data.decode("utf8", errors="ignore") data = data.splitlines() skipped_files = [] @@ -377,13 +370,6 @@ def get_history(targets): def parse_history(data): """ Helper function to parse history script return values """ - try: - data = data.decode("utf8") - except UnicodeDecodeError: - warnings.warn( - "DECODING ERROR WARNING: UNVALID UNICODE DETECTED!", UnicodeWarning - ) - data = data.decode("utf8", errors="ignore") data = data.splitlines()[:-1] return [ tuple(reversed(l.split("\t"))) @@ -431,7 +417,7 @@ def license(license_path): if exit_code != 0 or error: raise FilebotLicenseError(error) - return data.decode("utf8", "ignore") + return data def _order_is_valid(order_string): @@ -441,7 +427,7 @@ def _order_is_valid(order_string): Args: order_string: valid orders:(None | 'airdate' | 'dvd' | 'absolute') - .decode('utf8') + Returns: True or False based on success """ @@ -729,6 +715,14 @@ def _execute(process_arguments, workaround=False): data = stdout os.remove(file_temp.name) + try: + data = data.decode('utf8', errors="ignore") + except AttributeError: + pass + try: + error = error.decode('utf8', errors="ignore") + except AttributeError: + pass return exit_code, data, error diff --git a/setup.py b/setup.py index 9e92f06..68205eb 100755 --- a/setup.py +++ b/setup.py @@ -42,7 +42,7 @@ __plugin_name__ = "FileBotTool" __author__ = "laharah" __author_email__ = "laharah+fbt@gmail.com" -__version__ = "2.0.0" +__version__ = "2.0.1" __url__ = "https://github.com/Laharah/deluge-FileBotTool" __license__ = "GPLv3" __description__ = "Integrates FileBot functionality to Deluge"