Extended FileClassification

This commit is contained in:
Maximilian Giller 2025-09-08 08:59:26 +02:00
parent cf9474a1fe
commit cc123b8910

View file

@ -1,6 +1,7 @@
from dataclasses import dataclass from dataclasses import dataclass
from enum import Enum from enum import Enum
from pathlib import Path from pathlib import Path
from os import path
class FileCategory(Enum): class FileCategory(Enum):
@ -48,9 +49,31 @@ class FileClassification:
original_path: Path original_path: Path
"""Original Path to file, before any processing.""" """Original Path to file, before any processing."""
parent_path: "PathClassification"
"""Parent path classification that the file is a part of."""
category: FileCategory = FileCategory.UNCLASSIFIED category: FileCategory = FileCategory.UNCLASSIFIED
"""Category of file content.""" """Category of file content."""
new_file_name: str | None = None
"""New file name if not None."""
season_no: int | None = None
"""Season number in case if category is EPISODE."""
episode_no: int | None = None
"""Episode number in case if category is EPISODE."""
@property
def new_path(self) -> Path:
"""New Path."""
return Path(
path.join(
self.parent_path.path,
f"{self.new_file_name}{self.original_path.suffix}",
)
)
@dataclass @dataclass
class PathClassification: class PathClassification: