ff
This commit is contained in:
@@ -7,6 +7,7 @@ from typing import Any, Dict, List, Optional, Tuple
|
||||
|
||||
from ProviderCore.base import Provider, SearchResult
|
||||
from SYS.logger import log
|
||||
from SYS.utils import format_bytes
|
||||
|
||||
|
||||
def _get_podcastindex_credentials(config: Dict[str, Any]) -> Tuple[str, str]:
|
||||
@@ -79,23 +80,8 @@ class PodcastIndex(Provider):
|
||||
|
||||
@staticmethod
|
||||
def _format_bytes(value: Any) -> str:
|
||||
try:
|
||||
n = int(value)
|
||||
except Exception:
|
||||
return ""
|
||||
if n <= 0:
|
||||
return ""
|
||||
units = ["B", "KB", "MB", "GB", "TB"]
|
||||
size = float(n)
|
||||
unit = units[0]
|
||||
for u in units:
|
||||
unit = u
|
||||
if size < 1024.0 or u == units[-1]:
|
||||
break
|
||||
size /= 1024.0
|
||||
if unit == "B":
|
||||
return f"{int(size)}{unit}"
|
||||
return f"{size:.1f}{unit}"
|
||||
"""Format bytes using centralized utility."""
|
||||
return format_bytes(value)
|
||||
|
||||
@staticmethod
|
||||
def _format_date_from_epoch(value: Any) -> str:
|
||||
|
||||
Reference in New Issue
Block a user