Import lists from CSV or text and match each entry
The list editor gets an Import button. A .csv/.tsv/.txt file or pasted text is parsed on the server: header columns (Title, Year, Artist or Director, Note, Rank), numbered lines and trailing "(1999)" years are understood, and Canon's own export round-trips. Each row is then searched with the list's provider and scored. A row is matched automatically only when one result fits exactly and nothing else fits as well; a year or artist in the file breaks ties, an exact title beats a bracketed version like "(Live)", and "Artist - Title" lines are tried both ways. Custom lists need a year or subtitle to be certain. Everything else is shown for review with a recommended pick, the other results, "Add as written", Skip, and a search-again box. Entries are added in file order after the existing ones, with any notes from the file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
aadacaff95
commit
dadf835be3
10 files changed
+1131
No files matched your search
@@ -3,6 +3,7 @@ import { h, icon, api, readBoot, toast, confirmDialog, chooseDialog, openDialog,
|
||||
import { sortable } from "./sortable.js";
|
||||
import { openListForm } from "./list-form.js";
|
||||
import { previewButton } from "./player.js";
|
||||
import { openImport } from "./import.js";
|
||||
|
||||
const boot = readBoot();
|
||||
const { categories, limits, productions } = boot;
|
||||
@@ -261,6 +262,12 @@ async function runRefreshAll(targets, replaceCustomArt) {
|
||||
|
||||
document.querySelector("[data-action=refresh-all]")?.addEventListener("click", refreshAll);
|
||||
|
||||
document.querySelector("[data-action=import]").addEventListener("click", () => openImport({
|
||||
list, cat,
|
||||
onListChange: (l) => { list = l; renderHeader(); },
|
||||
onDone: () => load(pages()),
|
||||
}));
|
||||
|
||||
// Songs and albums from Deezer, or matched to Deezer when saved, can play.
|
||||
function canPreview(it) {
|
||||
return (cat.key === "song" || cat.key === "album") && (it.provider === "deezer" || !!it.extra?.deezer);
|
||||
|
||||
Reference in new issue
Block a user