Skip to content

Cue sheets and Telegram audio details (API and web) - #172

Merged
mateof merged 3 commits into
developfrom
feat/cue-sheets-audio-info
Dec 4, 2026
Merged

mateof merged 3 commits into
developfrom
feat/cue-sheets-audio-info

Conversation

@mateof

@mateof mateof commented Dec 4, 2026

Copy link
Copy Markdown
Owner

Cue sheets

An album ripped to a single FLAC or MP3 file, with a .cue next to it, can be played track by track.

API

  • Endpoints: GET /api/v1/channels/{id}/files/{fileId}/cue (also with collectionId) and GET /api/v1/local/cue?path= read the sheet.
    • Encodings: UTF-8, UTF-16 with a BOM, or Windows-1252.
    • Lines read: FILE, TRACK, TITLE, PERFORMER, INDEX 00/01, REM DATE and REM GENRE. Data tracks are skipped.
  • Matching each FILE line to an audio file in the same folder, tried in this order:
    1. the exact name, ignoring case;
    2. the same name with another audio extension (a .wav named in the sheet, converted to FLAC later);
    3. the audio file named like the sheet;
    4. the only audio file in the folder.
  • Each track carries:
    • the matched file, as a normal ApiFileDto with its URLs;
    • its start and end in seconds. end is null for the last track of a file.
  • missingFiles lists what could not be found.

Web

  • Opening an album: a .cue opens as an album in channels, shared collections and local files. A "CUE" badge marks the sheet and its audio file.
  • Album dialog:
    • the track list;
    • play all, or play from a track;
    • play next, or add to the queue.
  • Player: each track is a clip of the file.
    • Position, duration, seeking and the lock screen work in track time.
    • The next track of the same file continues without reloading.
    • Repeat-one and the "pause at end of track" timer respect the clip.

Telegram audio details

Telegram keeps the title, performer, duration and cover of every audio document.

  • API: POST /api/v1/channels/{id}/files/audio-info reads these details for up to 500 entries at a time, in batches from the messages and without downloading the files. They are then kept in memory.
  • Web: the channel file list and its search ask for them in the background.
    • Rows show "Performer – Title · m:ss" and the cover.
    • Tracks queued from there start with these details.

Capabilities

files.cue and files.audioInfo. The Android app (mateof/tfm-android-app#4) and TFMPlayer use them.

Tests

  • dotnet test: 810 passing, 26 of them new for the cue parser and matching.
  • ClientApp:
    • npm test: 313 passing, 31 new for clips, the cue model and audio-info;
    • lint and typecheck: clean (the 2 lint warnings were already there);
    • build: within its size budget.
  • Not run against a real Telegram session.

Known limits

  • APE and WavPack albums are not recognised as audio, and browsers can't play them anyway. Supporting them would need a seekable transcoded URL.
  • Server playlists cannot store a part of a file, so cue tracks cannot be added to playlists.
  • The global search page does not ask for audio details yet. The search inside a channel does.
  • Merge conflict with Shared player data (favourites, history, resume) and audio transcoding on /api/v1 #171: both PRs add entries to the capabilities list and its test, so whichever merges second will conflict there.

- GET /api/v1/channels/{id}/files/{fileId}/cue and GET /api/v1/local/cue
  read a cue sheet (UTF-8, UTF-16 or Windows-1252) and match each FILE
  line with the audio file next to it: exact name, same name with another
  audio extension (album.wav converted to FLAC), the audio file named like
  the sheet, or the only audio file in the folder. Each track carries its
  file with the usual URLs, and its start and end in seconds.
- POST /api/v1/channels/{id}/files/audio-info returns the duration, title,
  performer and cover that Telegram keeps for audio documents, read in
  batches from the messages without downloading the files, and kept in
  memory.
- Capabilities files.cue and files.audioInfo.
- Cue sheets: opening a .cue (channels, shared collections, local files)
  shows its tracks with play all, play from a track, play next and add to
  queue; tracks whose audio file is missing are disabled and listed.
  Each track is queued as a clip of its file (start/end).
- Player: clip support. The elements work in file time while the store,
  the UI and the media session show track time; a clip stops or advances
  at its end, consecutive clips of one file keep the source playing, and
  another clip of the playing file seeks instead of reloading.
- Telegram audio details: channel listings and searches ask audio-info
  for their audio files in the background (batches of 500, capability
  files.audioInfo, cached per channel/collection + file). Rows show
  "Performer - Title" and the duration, audio files get the Telegram
  cover as thumbnail, and queued tracks start with those details.
- File manager: describeEntry prop (subtitle, facts and a badge per row);
  a CUE badge marks cue sheets and the audio file they describe.
- api-client: files.cue, files.audioInfo and local.cue.
develop gained its own AudioController and AudioDtos (audio transcoding),
so the cue and audio-info endpoints move to AudioDetailsController and
AudioDetailsDtos. The capability list keeps player.sync, audio.transcode,
files.cue and files.audioInfo.
@mateof
mateof merged commit 88d2bde into develop Dec 4, 2026
2 checks passed
@mateof
mateof deleted the feat/cue-sheets-audio-info branch December 4, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant