continuing refactor
This commit is contained in:
@@ -74,8 +74,32 @@ def ping_url(url: str, timeout: float = 3.0) -> tuple[bool, str]:
|
||||
|
||||
|
||||
def provider_display_name(key: str) -> str:
|
||||
label = (key or "").strip()
|
||||
return label[:1].upper() + label[1:] if label else "Plugin"
|
||||
label = (key or "").strip().lower()
|
||||
if not label:
|
||||
return "Plugin"
|
||||
|
||||
# Preserve expected brand casing for common providers.
|
||||
display_overrides = {
|
||||
"youtube": "YouTube",
|
||||
"openlibrary": "OpenLibrary",
|
||||
"podcastindex": "PodcastIndex",
|
||||
}
|
||||
if label in display_overrides:
|
||||
return display_overrides[label]
|
||||
return label[:1].upper() + label[1:]
|
||||
|
||||
|
||||
def default_provider_ping_targets(key: str) -> list[str]:
|
||||
"""Return default health-check URLs for known providers."""
|
||||
label = (key or "").strip().lower()
|
||||
defaults = {
|
||||
"bandcamp": ["https://bandcamp.com"],
|
||||
"youtube": ["https://www.youtube.com"],
|
||||
"openlibrary": ["https://openlibrary.org"],
|
||||
"podcastindex": ["https://podcastindex.org"],
|
||||
"loc": ["https://www.loc.gov"],
|
||||
}
|
||||
return list(defaults.get(label, []))
|
||||
|
||||
|
||||
def ping_first(urls: list[str]) -> tuple[bool, str]:
|
||||
|
||||
Reference in New Issue
Block a user