mirror of
https://github.com/shadoll/moma.git
synced 2026-08-28 11:33:25 +00:00
fix: Remove unused resolution frame class method from formatter order
This commit is contained in:
@@ -1,41 +1,6 @@
|
||||
from renamer.constants import FRAME_CLASSES
|
||||
|
||||
class ResolutionFormatter:
|
||||
"""Class for formatting video resolutions and frame classes"""
|
||||
|
||||
@staticmethod
|
||||
def get_frame_class_from_resolution(resolution: str) -> str:
|
||||
"""Convert resolution string (WIDTHxHEIGHT) to frame class (480p, 720p, etc.)"""
|
||||
if not resolution:
|
||||
return 'Unclassified'
|
||||
|
||||
try:
|
||||
# Extract height from WIDTHxHEIGHT format
|
||||
if 'x' in resolution:
|
||||
height = int(resolution.split('x')[1])
|
||||
else:
|
||||
# Try to extract number directly
|
||||
import re
|
||||
match = re.search(r'(\d{3,4})', resolution)
|
||||
if match:
|
||||
height = int(match.group(1))
|
||||
else:
|
||||
return 'Unclassified'
|
||||
|
||||
# Find the closest frame class based on nominal height
|
||||
closest_class = 'Unclassified'
|
||||
min_diff = float('inf')
|
||||
for frame_class, info in FRAME_CLASSES.items():
|
||||
nominal_height = info['nominal_height']
|
||||
diff = abs(height - nominal_height)
|
||||
if diff < min_diff:
|
||||
min_diff = diff
|
||||
closest_class = frame_class
|
||||
|
||||
return closest_class
|
||||
except (ValueError, IndexError):
|
||||
return 'Unclassified'
|
||||
|
||||
@staticmethod
|
||||
def format_resolution_dimensions(resolution: tuple[int, int]) -> str:
|
||||
"""Format resolution as WIDTHxHEIGHT"""
|
||||
|
||||
Reference in New Issue
Block a user