feat: successfully synced lyrics should never expire
This commit is contained in:
@@ -14,6 +14,8 @@ Lyrics are fetched using a fallback pipeline (first synced result wins):
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
See `lrcfetch --help` for full command reference. Common use cases:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Fetch lyrics for the currently playing track
|
# Fetch lyrics for the currently playing track
|
||||||
lrcfetch fetch
|
lrcfetch fetch
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ from lrcfetch.mpris import get_current_track
|
|||||||
from lrcfetch.core import LrcManager
|
from lrcfetch.core import LrcManager
|
||||||
|
|
||||||
app = typer.Typer(
|
app = typer.Typer(
|
||||||
help="LRCFetch — Fetch lyrics for tracks.",
|
help="LRCFetch — Fetch line-synced lyrics for your music player.",
|
||||||
add_completion=False,
|
add_completion=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ load_dotenv() # .env in cwd (does NOT override existing vars)
|
|||||||
HTTP_TIMEOUT = 10.0
|
HTTP_TIMEOUT = 10.0
|
||||||
|
|
||||||
# ─── Cache TTLs (seconds) ───────────────────────────────────────────
|
# ─── Cache TTLs (seconds) ───────────────────────────────────────────
|
||||||
TTL_SYNCED = 86400 * 30 # 30 days
|
TTL_SYNCED = None # never expires
|
||||||
TTL_UNSYNCED = 86400 # 1 day
|
TTL_UNSYNCED = 86400 # 1 day
|
||||||
TTL_NOT_FOUND = 86400 * 3 # 3 days
|
TTL_NOT_FOUND = 86400 * 3 # 3 days
|
||||||
TTL_NETWORK_ERROR = 3600 # 1 hour
|
TTL_NETWORK_ERROR = 3600 # 1 hour
|
||||||
|
|||||||
+1
-1
@@ -47,7 +47,7 @@ def _normalize_unsynced(lyrics: str) -> str:
|
|||||||
|
|
||||||
|
|
||||||
# Maps CacheStatus to the default TTL used when storing results
|
# Maps CacheStatus to the default TTL used when storing results
|
||||||
_STATUS_TTL: dict[CacheStatus, int] = {
|
_STATUS_TTL: dict[CacheStatus, Optional[int]] = {
|
||||||
CacheStatus.SUCCESS_SYNCED: TTL_SYNCED,
|
CacheStatus.SUCCESS_SYNCED: TTL_SYNCED,
|
||||||
CacheStatus.SUCCESS_UNSYNCED: TTL_UNSYNCED,
|
CacheStatus.SUCCESS_UNSYNCED: TTL_UNSYNCED,
|
||||||
CacheStatus.NOT_FOUND: TTL_NOT_FOUND,
|
CacheStatus.NOT_FOUND: TTL_NOT_FOUND,
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
|
|||||||
[project]
|
[project]
|
||||||
name = "lrcfetch"
|
name = "lrcfetch"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "Fetch lyrics for tracks."
|
description = "Fetch line-synced lyrics for your music player."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.13"
|
requires-python = ">=3.13"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|||||||
Reference in New Issue
Block a user