Updates for rename_folder

This commit is contained in:
Andrew Resch 2008-10-17 18:22:18 +00:00
parent a555fecc18
commit 41bedda10a
2 changed files with 4 additions and 2 deletions

View File

@ -806,9 +806,10 @@ class Torrent:
def rename_folder(self, folder, new_folder):
"""Renames a folder within a torrent. This basically does a file rename
on all of the folders children."""
log.debug("attempting to rename folder: %s to %s", folder, new_folder)
for f in self.get_files():
if f["path"].startswith(folder):
# Keep a list of filerenames we're waiting on
self.waiting_on_folder_rename.append(f["index"])
self.handle.rename_file(f["index"], f["path"].replace(folder, new_folder, 1))

View File

@ -170,7 +170,8 @@ class BaseClient(object):
"set_torrent_stop_ratio", "set_torrent_stop_at_ratio",
"set_torrent_remove_at_ratio", "set_torrent_move_on_completed",
"set_torrent_move_on_completed_path", "add_torrent_magnets",
"create_torrent", "upload_plugin", "rescan_plugins", "rename_files"]
"create_torrent", "upload_plugin", "rescan_plugins", "rename_files",
"rename_folder"]
def __init__(self):
self.core = _core