stream: link the now-playing title to its source page
For yt-dlp tracks the locator is the original web page, so pass it as a url annotation, carry it through the stream metadata and history, and turn the track title into a link back to that page (both live and in the history). Subsonic ids are opaque and stay plain text. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
fa1be6df77
commit
c12e522fee
3 changed files with 37 additions and 22 deletions
|
|
@ -26,10 +26,13 @@ def annotate_uri(path: Path, track: Track) -> str:
|
|||
def esc(value: str) -> str:
|
||||
return value.replace("\\", "\\\\").replace('"', '\\"')
|
||||
|
||||
return (
|
||||
f'annotate:title="{esc(track.title)}",artist="{esc(track.artist)}"'
|
||||
f":{path}"
|
||||
)
|
||||
fields = [f'title="{esc(track.title)}"', f'artist="{esc(track.artist)}"']
|
||||
# Web page the track was pulled from, so the player can link back to the
|
||||
# source. Only http(s) locators qualify (yt-dlp tracks); a Subsonic song id
|
||||
# is opaque and points at no public page.
|
||||
if track.locator.startswith(("http://", "https://")):
|
||||
fields.append(f'url="{esc(track.locator)}"')
|
||||
return f'annotate:{",".join(fields)}:{path}'
|
||||
|
||||
|
||||
class IngestServer(ThreadingHTTPServer):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue