Add section images, larger covers and track tags
Section images:
- A section gets an optional image, set from its new "Modifier" dialog
(name and image), which replaces "Renommer". It goes through the same
conversion as track covers and is deleted with its section.
- Track and section uploads share routes/coverUpload.js. The cover
folder is created again if it went missing, instead of failing.
Larger images: 72 px for tracks (was 48), 96 px for section headers,
160 px in the player and the edit dialog (was 96); smaller on phones.
Tags:
- Library tracks take free tags, edited in the "Modifier" dialog, which
suggests the tags already in use. Case is ignored ("Épique" and
"épique" are one tag); at most 15 tags of 30 characters.
- A tag bar above the library filters it, and the "Tout ajouter"
buttons (global and per section) then only queue its tracks
(enqueue-all takes a tag). The search also matches tags.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
793765fb79
commit
bda95ca946
13 changed files with 601 additions and 165 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* @file Vérifie les sections de la bibliothèque : création, renommage, déplacement, et suppression qui
|
||||
* remet ses morceaux sans section.
|
||||
* @file Vérifie les sections de la bibliothèque : création, renommage, déplacement, image, et
|
||||
* suppression qui remet ses morceaux sans section.
|
||||
*/
|
||||
|
||||
import test from "node:test";
|
||||
|
|
@ -15,6 +15,7 @@ const temporaryDirectory = fs.mkdtempSync(path.join(os.tmpdir(), "palico-section
|
|||
process.chdir(temporaryDirectory);
|
||||
const storage = await import("../src/web/storage/storageManager.js");
|
||||
const sections = await import("../src/web/storage/librarySections.js");
|
||||
const { serializeSection } = await import("../src/web/serializers.js");
|
||||
storage.ensureStorageLayout();
|
||||
test.after(() => {
|
||||
process.chdir(originalDirectory);
|
||||
|
|
@ -66,3 +67,25 @@ test("deleting a section keeps its tracks, without a section", () => {
|
|||
assert.equal(storage.findPermanentTrack(inKept).sectionId, kept.id);
|
||||
assert.equal(sections.deleteSection(doomed.id), null);
|
||||
});
|
||||
|
||||
test("a section image is replaced, removed, and deleted with its section", () => {
|
||||
const section = sections.createSection("Avec image");
|
||||
const coverFile = (name) => path.join(storage.COVERS_DIR, name);
|
||||
fs.writeFileSync(coverFile("first.jpg"), "jpeg");
|
||||
fs.writeFileSync(coverFile("second.jpg"), "jpeg");
|
||||
|
||||
sections.setSectionCover(section.id, "first.jpg");
|
||||
assert.equal(serializeSection(sections.findSection(section.id)).coverUrl, "/covers/first.jpg");
|
||||
assert.equal("cover" in serializeSection(sections.findSection(section.id)), false);
|
||||
|
||||
sections.setSectionCover(section.id, "second.jpg");
|
||||
assert.equal(fs.existsSync(coverFile("first.jpg")), false);
|
||||
|
||||
// Section disparue : la nouvelle image est supprimée au lieu de rester orpheline.
|
||||
fs.writeFileSync(coverFile("orphan.jpg"), "jpeg");
|
||||
assert.equal(sections.setSectionCover("unknown", "orphan.jpg"), null);
|
||||
assert.equal(fs.existsSync(coverFile("orphan.jpg")), false);
|
||||
|
||||
sections.deleteSection(section.id);
|
||||
assert.equal(fs.existsSync(coverFile("second.jpg")), false);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue