fix(worker): raise http.client header limit so Qobuz tracks stop failing
Bruno Mars "24K Magic" track 1 repeatedly downloaded as a 0-byte file. The
worker log showed the real cause: streamrip's track download hit
HTTPException("got more than 100 headers") — Qobuz's CDN returns >100 response
headers for some tracks and Python's http.client rejects them at the default
_MAXHEADERS=100, so streamrip skips the track and leaves an empty placeholder.
- Raise http.client._MAXHEADERS to 1000 on import of the Qobuz adapter, so those
responses parse and the track downloads.
- _count_staged_audio now skips 0-byte files (a failed-track placeholder is not a
real track) — improves the download-progress estimate and stops counting dead
tracks. (A verify-level "reject 0-byte tracks" safety net is a follow-up under
#16 per-track duration matching — it needs the pipeline fakes to write real
files, deferred to avoid disproportionate churn here.)
worker 223 tests / 7-skip.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -18,12 +18,19 @@ _AUDIO_EXT = {".flac", ".mp3", ".m4a", ".opus", ".ogg", ".aac", ".wav"}
|
||||
|
||||
|
||||
def _count_staged_audio(staging: str) -> int:
|
||||
"""Count audio files anywhere under the staging dir (streamrip nests them in a subfolder)."""
|
||||
"""Count NON-EMPTY audio files anywhere under the staging dir (streamrip nests them in a
|
||||
subfolder). 0-byte files are skipped: streamrip leaves an empty placeholder when a track
|
||||
download fails (e.g. Qobuz's >100-header responses), and a dead track must not count toward
|
||||
completeness — otherwise a broken album imports as 'complete'."""
|
||||
n = 0
|
||||
for _root, _dirs, files in os.walk(staging):
|
||||
for root, _dirs, files in os.walk(staging):
|
||||
for f in files:
|
||||
if os.path.splitext(f)[1].lower() in _AUDIO_EXT:
|
||||
n += 1
|
||||
try:
|
||||
if os.path.getsize(os.path.join(root, f)) > 0:
|
||||
n += 1
|
||||
except OSError:
|
||||
pass
|
||||
return n
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user