🚨 lint
This commit is contained in:
+13
-6
@@ -1,4 +1,8 @@
|
||||
"""Data models for lrcfetch."""
|
||||
"""
|
||||
Author: Uyanide pywang0608@foxmail.com
|
||||
Date: 2026-03-25 04:09:36
|
||||
Description: Data models
|
||||
"""
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from enum import Enum
|
||||
@@ -7,6 +11,7 @@ from typing import Optional
|
||||
|
||||
class CacheStatus(str, Enum):
|
||||
"""Status of a cached lyric entry."""
|
||||
|
||||
SUCCESS_SYNCED = "SUCCESS_SYNCED"
|
||||
SUCCESS_UNSYNCED = "SUCCESS_UNSYNCED"
|
||||
NOT_FOUND = "NOT_FOUND"
|
||||
@@ -15,14 +20,15 @@ class CacheStatus(str, Enum):
|
||||
|
||||
class TrackMeta(BaseModel):
|
||||
"""Metadata describing a track obtained from MPRIS or manual input."""
|
||||
|
||||
model_config = ConfigDict(strict=True)
|
||||
|
||||
trackid: Optional[str] = None # Spotify track ID (without "spotify:track:" prefix)
|
||||
length: Optional[int] = None # Duration in milliseconds
|
||||
trackid: Optional[str] = None # Spotify track ID (without "spotify:track:" prefix)
|
||||
length: Optional[int] = None # Duration in milliseconds
|
||||
album: Optional[str] = None
|
||||
artist: Optional[str] = None
|
||||
title: Optional[str] = None
|
||||
url: Optional[str] = None # Playback URL (file:// for local files)
|
||||
url: Optional[str] = None # Playback URL (file:// for local files)
|
||||
|
||||
@property
|
||||
def is_local(self) -> bool:
|
||||
@@ -46,9 +52,10 @@ class TrackMeta(BaseModel):
|
||||
|
||||
class LyricResult(BaseModel):
|
||||
"""Result of a lyric fetch attempt, also used as cache record."""
|
||||
|
||||
model_config = ConfigDict(strict=True)
|
||||
|
||||
status: CacheStatus
|
||||
lyrics: Optional[str] = None
|
||||
source: Optional[str] = None # Which fetcher produced this result
|
||||
ttl: Optional[int] = None # Hint for cache TTL (seconds)
|
||||
source: Optional[str] = None # Which fetcher produced this result
|
||||
ttl: Optional[int] = None # Hint for cache TTL (seconds)
|
||||
|
||||
Reference in New Issue
Block a user