Fix crash when writing BPM/cue data to MTP devices#38
Conversation
FileUtils.install deletes the destination file internally before copying. On MTP devices, deleting a file can cause the parent directory to be auto-removed if it becomes empty, and install's own internal mkdir_p does not reliably recreate it. Mirror the pattern used in FileConverter: explicitly delete the file, call mkpath to guarantee the parent directory exists, then install. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
What's left to investigateThe current approach still has an untested path: for the copied + BPM case, 1. Free up disk space and re-runThe most important next step. With the disk at 100%, even the local 2. Verify
|
de3212e to
48c073d
Compare
All attempts to delete or overwrite existing files on the TP-7 via MTP fail (ENOENT, EIO, ENOTDIR). The only reliable operation is installing a fresh file to a non-existent destination. Restructure the pipeline so BPM (ACID chunk) and cue point injection happen on a local temp file before it is installed to the device, ensuring the MTP path is written exactly once per file. - Add a post-transcode block to Audio#transcode, yielded with the local temp path after ffmpeg but before FileUtils.install - Thread the block through FileConverter#convert (before_transcode becomes a keyword param, freeing the block slot for post_transcode) - For the converted path: inject BPM and cue points into the local temp via inject_acid_bpm / inject_cue_points private helpers - For the copied + BPM path: write BPM directly from the source library file to the MTP target path via AcidChunk.write_bpm, avoiding any local temp copy (important when disk space is tight) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
48c073d to
50e68a5
Compare
Summary