Extended FileClassification
This commit is contained in:
parent
cf9474a1fe
commit
cc123b8910
1 changed files with 23 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
from pathlib import Path
|
||||
from os import path
|
||||
|
||||
|
||||
class FileCategory(Enum):
|
||||
|
@ -48,9 +49,31 @@ class FileClassification:
|
|||
original_path: Path
|
||||
"""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 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
|
||||
class PathClassification:
|
||||
|
|
Loading…
Reference in a new issue