mirror of
https://github.com/shadoll/moma.git
synced 2026-08-28 11:33:25 +00:00
feat: Add OpenScreen for directory input and validation
feat: Introduce poster rendering views with multiple engines feat: Implement ASCII art poster renderer using PIL feat: Create base class for poster renderers feat: Add RichPixels renderer for high-quality terminal image display feat: Implement Viu terminal image viewer renderer feat: Add ProposedFilenameView for generating standardized filenames feat: Create RenameConfirmScreen for renaming files with confirmation feat: Implement SettingsScreen for configuring application settings feat: Add custom PosterWidget for rendering poster images
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
class SizeFormatter:
|
||||
"""Class for formatting file sizes"""
|
||||
|
||||
@staticmethod
|
||||
def format_size(bytes_size: int) -> str:
|
||||
"""Format bytes to human readable with unit"""
|
||||
for unit in ['B', 'KB', 'MB', 'GB', 'TB']:
|
||||
if bytes_size < 1024:
|
||||
return f"{bytes_size:.1f} {unit}"
|
||||
bytes_size /= 1024
|
||||
return f"{bytes_size:.1f} TB"
|
||||
|
||||
@staticmethod
|
||||
def format_size_full(bytes_size: int) -> str:
|
||||
"""Format size with both human readable and bytes"""
|
||||
size_formatted = SizeFormatter.format_size(bytes_size)
|
||||
return f"{size_formatted} ({bytes_size:,} bytes)"
|
||||
|
||||
@staticmethod
|
||||
def format_size_short(bytes_size: int) -> str:
|
||||
"""Format size with only human readable"""
|
||||
return SizeFormatter.format_size(bytes_size)
|
||||
Reference in New Issue
Block a user