Folder move added

This commit is contained in:
kodi
2026-03-11 16:21:00 +01:00
parent d1f018a130
commit 3e4761f5a7
18 changed files with 816 additions and 21 deletions
+33
View File
@@ -35,6 +35,14 @@ class TaskRunner:
)
thread.start()
def enqueue_move_directory(self, task_id: str, source: str, destination: str) -> None:
thread = threading.Thread(
target=self._run_move_directory,
args=(task_id, source, destination),
daemon=True,
)
thread.start()
def _run_copy_file(self, task_id: str, source: str, destination: str, total_bytes: int) -> None:
self._repository.mark_running(
task_id=task_id,
@@ -123,3 +131,28 @@ class TaskRunner:
done_bytes=progress["done"],
total_bytes=total_bytes,
)
def _run_move_directory(self, task_id: str, source: str, destination: str) -> None:
self._repository.mark_running(
task_id=task_id,
done_items=0,
total_items=1,
current_item=source,
)
try:
self._filesystem.move_directory(source=source, destination=destination)
self._repository.mark_completed(
task_id=task_id,
done_items=1,
total_items=1,
)
except OSError as exc:
self._repository.mark_failed(
task_id=task_id,
error_code="io_error",
error_message=str(exc),
failed_item=source,
done_items=0,
total_items=1,
)