feat: Add extraction and formatting for special edition information in filenames

This commit is contained in:
sha
2025-12-26 20:56:22 +00:00
parent b21308c7b8
commit 691d1e7b2d
7 changed files with 101 additions and 8 deletions
+9 -1
View File
@@ -267,7 +267,7 @@ class MediaFormatter:
"label": "Order",
"label_formatters": [TextFormatter.bold],
"value": self.extractor.get("order", "Filename") or "Not extracted",
"display_formatters": [TextFormatter.grey],
"display_formatters": [TextFormatter.yellow],
},
{
"label": "Movie title",
@@ -307,6 +307,14 @@ class MediaFormatter:
or "Not extracted",
"display_formatters": [TextFormatter.grey],
},
{
"label": "Special info",
"label_formatters": [TextFormatter.bold],
"value": self.extractor.get("special_info", "Filename")
or "Not extracted",
"value_formatters": [lambda x: ", ".join(x) if isinstance(x, list) else x, TextFormatter.blue],
"display_formatters": [TextFormatter.grey],
},
{
"label": "Movie DB",
"label_formatters": [TextFormatter.bold],
@@ -15,6 +15,7 @@ class ProposedNameFormatter:
self.__frame_class = extractor.get("frame_class") or None
self.__hdr = f",{extractor.get('hdr')}" if extractor.get("hdr") else ""
self.__audio_langs = extractor.get("audio_langs") or None
self.__special_info = f" [{', '.join(extractor.get('special_info'))}]" if extractor.get("special_info") else ""
self.__extension = extractor.get("extension") or "ext"
def __str__(self) -> str:
@@ -22,7 +23,7 @@ class ProposedNameFormatter:
return self.rename_line()
def rename_line(self) -> str:
return f"{self.__order}{self.__title} {self.__year}{self.__source} [{self.__frame_class}{self.__hdr},{self.__audio_langs}].{self.__extension}"
return f"{self.__order}{self.__title} {self.__year}{self.__special_info}{self.__source} [{self.__frame_class}{self.__hdr},{self.__audio_langs}].{self.__extension}"
def rename_line_formatted(self) -> str:
"""Format the proposed name for display with color"""