From 74585aeee4a45e0b0eb4adab6b241ed0aad302c6 Mon Sep 17 00:00:00 2001 From: laharah Date: Tue, 23 Feb 2016 13:14:12 -0800 Subject: [PATCH] prevent waiting on folder renames on single file torrents --- filebottool/core.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/filebottool/core.py b/filebottool/core.py index 1eb3352..8897a8d 100755 --- a/filebottool/core.py +++ b/filebottool/core.py @@ -276,10 +276,11 @@ def _redirect_torrent_paths(self, torrent_id, (new_save_path, new_top_lvl, self.listening_dictionary[torrent_id]["move_storage"] = new_save_path torrent.move_storage(new_save_path) if new_top_lvl: - current_top_lvl = torrent.get_files()[0]["path"].split("/")[0] + "/" - self.listening_dictionary[torrent_id]["folder_rename"] = ( - current_top_lvl, new_top_lvl + "/") - torrent.rename_folder(current_top_lvl, new_top_lvl) + if len(torrent.get_files()) > 1: + current_top_lvl = torrent.get_files()[0]["path"].split("/")[0] + "/" + self.listening_dictionary[torrent_id]["folder_rename"] = ( + current_top_lvl, new_top_lvl + "/") + torrent.rename_folder(current_top_lvl, new_top_lvl) if new_file_paths: for index, path in new_file_paths: self.listening_dictionary[torrent_id][index] = True