- Fix circular dependencies in agent/tools - Migrate from custom JSON to OpenAI tool calls format - Add async streaming (step_stream, complete_stream) - Simplify prompt system and remove token counting - Add 5 new API endpoints (/health, /v1/models, /api/memory/*) - Add 3 new tools (get_torrent_by_index, add_torrent_by_index, set_language) - Fix all 500 tests and add coverage config (80% threshold) - Add comprehensive docs (README, pytest guide) BREAKING: LLM interface changed, memory injection via get_memory()
53 lines
1.4 KiB
Python
53 lines
1.4 KiB
Python
"""List folder use case."""
|
|
|
|
import logging
|
|
|
|
from infrastructure.filesystem import FileManager
|
|
|
|
from .dto import ListFolderResponse
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class ListFolderUseCase:
|
|
"""
|
|
Use case for listing folder contents.
|
|
|
|
This orchestrates the FileManager to list folders.
|
|
"""
|
|
|
|
def __init__(self, file_manager: FileManager):
|
|
"""
|
|
Initialize use case.
|
|
|
|
Args:
|
|
file_manager: FileManager instance
|
|
"""
|
|
self.file_manager = file_manager
|
|
|
|
def execute(self, folder_type: str, path: str = ".") -> ListFolderResponse:
|
|
"""
|
|
List contents of a folder.
|
|
|
|
Args:
|
|
folder_type: Type of folder to list (download, tvshow, movie, torrent)
|
|
path: Relative path within the folder (default: ".")
|
|
|
|
Returns:
|
|
ListFolderResponse with folder contents or error information
|
|
"""
|
|
result = self.file_manager.list_folder(folder_type, path)
|
|
|
|
if result.get("status") == "ok":
|
|
return ListFolderResponse(
|
|
status="ok",
|
|
folder_type=result.get("folder_type"),
|
|
path=result.get("path"),
|
|
entries=result.get("entries"),
|
|
count=result.get("count"),
|
|
)
|
|
else:
|
|
return ListFolderResponse(
|
|
status="error", error=result.get("error"), message=result.get("message")
|
|
)
|