Skip to content

Report corrupted TAFs and allow redownloading them from the cloud - #565

Open
weatherhog wants to merge 2 commits into
toniebox-reverse-engineering:developfrom
weatherhog:feat/redownload-taf
Open

weatherhog wants to merge 2 commits into
toniebox-reverse-engineering:developfrom
weatherhog:feat/redownload-taf

Conversation

@weatherhog

@weatherhog weatherhog commented Oct 26, 2026 •

Copy link
Copy Markdown

Server side of #338. The first commit is the library fix from #564, so that one should be merged first.

The tag info now has corrupt: the header is fine, but SHA1 or length of the audio is not. getTagInfo?validate=true runs the full check for one tag on demand.

Tags that play their own cloud content get a redownloadUrl, the content download with force=true. It skips the local file and fetches from the cloud. If nothing gets cached, the previous source is restored. Tags with any other source get a 409, as the download clears the source. With cloud.cacheContent off there is nothing to replace the file with, so that is a 409 as well.

Two things I left as they are, because the normal download path does the same today: it is a GET like downloadTriggerUrl, and the source is empty while the download runs.

The web part is toniebox-reverse-engineering/teddycloud_web#354. tests/py/test_taf_redownload.py covers the server side. In my Docker setup test_settings_reload_while_cloud_requests_run fails, on develop as well (13 instead of 20 requests).

moveTAF2Lib compared the existing library file only by its header SHA1. A
TAF that is corrupted inside the audio (issue toniebox-reverse-engineering#346: a zero-filled region)
has the same header as a fresh download, so the fresh copy was deleted and
the corrupted one kept. The library file is now fully validated and
replaced when it fails.

With core.full_taf_validation a corrupted TAF source was also typed as a
stream source, which re-encoded it with ffmpeg and set the tag to live and
nocloud. The source type now only depends on the TAF header.

Part of toniebox-reverse-engineering#338
The tag info now carries "corrupt" when the header of a TAF is fine but the
SHA1 hash or length of the audio is not (found by the full validation or the
track position check). getTagInfo?validate=true runs the full validation for
one tag on demand.

A tag that plays its own cloud content (a TAF in the content dir, or the
library file it was cached to) gets a "redownloadUrl": the content download
with force=true, which skips the local file and fetches from the cloud. If
nothing gets cached, the previous source is restored. Tags with any other
source are refused with 409, as the download clears the source.

Part of toniebox-reverse-engineering#338
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.

2 participants