Refactor
This commit is contained in:
parent
1e988c6e3c
commit
4fa7b60ddc
2 changed files with 68 additions and 12 deletions
|
@ -1,18 +1,13 @@
|
|||
from dataclasses import dataclass
|
||||
from .structures import PathClassification, FileClassification
|
||||
from pathlib import Path
|
||||
|
||||
@dataclass
|
||||
class FileIdentity:
|
||||
pass
|
||||
|
||||
@dataclass
|
||||
class PathIdentities:
|
||||
pass
|
||||
def classify_files(path: str) -> PathClassification:
|
||||
return PathClassification(Path(path))
|
||||
|
||||
def identify_files(path: str) -> PathIdentities:
|
||||
return PathIdentities
|
||||
|
||||
if __name__ == "__main__":
|
||||
results = identify_files("/home/max/Media Library/testing/The Mentalist (2008)")
|
||||
results = classify_files("/home/max/Media Library/testing/The Mentalist (2008)")
|
||||
|
||||
print(results)
|
||||
print("Done.")
|
61
src/structures.py
Normal file
61
src/structures.py
Normal file
|
@ -0,0 +1,61 @@
|
|||
from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
class FileCategory(Enum):
|
||||
UNCLASSIFIED = "unclassified"
|
||||
"""File has not been classified yet."""
|
||||
|
||||
UNKNOWN = "unknown"
|
||||
"""File could not be classified successfully."""
|
||||
|
||||
MAIN_FEATURE = "main_feature"
|
||||
"""Main Feature of a movie."""
|
||||
|
||||
EPISODE = "episode"
|
||||
"""Episode of a show."""
|
||||
|
||||
TRAILER = "trailer"
|
||||
"""Trailer."""
|
||||
|
||||
EXTRA = "extra"
|
||||
"""Extra content like deleted scenes or behind the scenes."""
|
||||
|
||||
WARNINGS = "warnings"
|
||||
"""Copyright warnings."""
|
||||
|
||||
POSTER = "poster"
|
||||
"""Poster, background, thumb and other meta image formats often used in Jellyfin and Plex."""
|
||||
|
||||
|
||||
class PathCategory(Enum):
|
||||
UNCLASSIFIED = "unclassified"
|
||||
"""Not yet classified."""
|
||||
|
||||
UNKNOWN = "unknown"
|
||||
"""Could not be classified."""
|
||||
|
||||
MOVIE = "movie"
|
||||
"""Movie with main feature."""
|
||||
|
||||
SHOW = "show"
|
||||
"""Show with episodes."""
|
||||
|
||||
|
||||
@dataclass
|
||||
class FileClassification:
|
||||
original_path: Path
|
||||
"""Original Path to file, before any processing."""
|
||||
|
||||
category: FileCategory = FileCategory.UNCLASSIFIED
|
||||
"""Category of file content."""
|
||||
|
||||
|
||||
@dataclass
|
||||
class PathClassification:
|
||||
path: Path
|
||||
"""Parent directory of analysed content."""
|
||||
|
||||
category: PathCategory = PathCategory.UNCLASSIFIED
|
||||
"""Category of path media."""
|
Loading…
Reference in a new issue