mirror of
https://github.com/Benexl/FastAnime.git
synced 2025-12-12 15:50:01 -08:00
refactor: converters
This commit is contained in:
@@ -7,7 +7,7 @@ from typing import Dict, Literal, Optional
|
||||
from pydantic import BaseModel, Field, computed_field
|
||||
|
||||
from ....libs.media_api.types import MediaItem, UserMediaListStatus
|
||||
from ...utils import converters
|
||||
from ....core.utils import converters
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
def time_to_seconds(time_str: str) -> int:
|
||||
"""Convert HH:MM:SS to seconds."""
|
||||
try:
|
||||
parts = time_str.split(":")
|
||||
if len(parts) == 3:
|
||||
h, m, s = map(int, parts)
|
||||
return h * 3600 + m * 60 + s
|
||||
except (ValueError, AttributeError):
|
||||
pass
|
||||
return 0
|
||||
@@ -0,0 +1,10 @@
|
||||
def time_to_seconds(time_str: str) -> int:
|
||||
"""Convert HH:MM:SS to seconds."""
|
||||
try:
|
||||
parts = time_str.split(":")
|
||||
if len(parts) == 3:
|
||||
h, m, s = map(int, parts)
|
||||
return h * 3600 + m * 60 + s
|
||||
except (ValueError, AttributeError):
|
||||
pass
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user