*перезапись тэгов на месте: файл сохраняет inode (Audiobookshelf опознаёт файлы по inode, замена через mv путала его библиотеку)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
K1ndWha1eandClaude Opus 5.5 committed 2026-10-09 00:10:40 +03:00
1 parent 1e686ba304
commit a6b4f0fbcf
2 files changed
+73 -24

No files matched your search

+20
View File
@@ -131,3 +131,23 @@ fn test_write_keeps_mode() {
assert after.mode & 0o777 == before.mode & 0o777
assert after.uid == before.uid
}
// Файл остаётся тем же: Audiobookshelf опознаёт файлы по inode
fn test_write_keeps_inode() {
path := tmp_copy('test_id3v23.mp3')
defer {
os.rm(path) or {}
}
before := os.stat(path) or { panic(err) }
metadata.write_book_tags(path, metadata.BookTags{
title: 'Тот же файл'
comment: 'длинное описание '.repeat(500)
}) or { panic(err) }
after := os.stat(path) or { panic(err) }
$if !windows {
assert after.inode == before.inode
}
assert !os.exists(path + '.tagtmp')
t := metadata.read_book_tags(path) or { panic(err) }
assert t.tags.title == 'Тот же файл'
}