fix(mover): rename the folder on relocate so audiobookshelf keeps the item and its cover
Build image / image (push) Successful in 52s
Build image / image (push) Successful in 52s
This commit is contained in:
1 parent
b51d5754e0
commit
5f4b3cb564
5 files changed
+95
No files matched your search
@@ -827,6 +827,8 @@ function renderImportTable() {
|
||||
.filter((r) => r.media_type === item.media_type && r.imported_path)
|
||||
.map((r) => option(r, " ↩︎"))
|
||||
.join("");
|
||||
const override = seriesOverride(item);
|
||||
const req = override && missingReqs.find((r) => r.id === item.request_id);
|
||||
return `<tr class="${item.importState ? "row-" + item.importState : item.conflict ? "row-conflict" : ""}">
|
||||
<td><input type="checkbox" data-check="${i}" ${item.checked ? "checked" : ""}></td>
|
||||
<td class="mono">
|
||||
@@ -844,6 +846,11 @@ function renderImportTable() {
|
||||
${appendOpts ? `<optgroup label="${esc(t("import.appendGroup"))}">${appendOpts}</optgroup>` : ""}
|
||||
</select>
|
||||
<button class="secondary" data-quick="${i}" title="${esc(t("import.quickTitle"))}">🔍</button>
|
||||
${override
|
||||
? `<span class="tag" title="${esc(t("import.folderSeriesTitle", {
|
||||
series: req.series || "–", volume: req.volume ?? "–" }))}">${esc(
|
||||
t("import.folderSeries", override))}</span>`
|
||||
: ""}
|
||||
${item.parts || item.maybe_separate
|
||||
? `<button class="secondary" data-split="${i}" title="${esc(t(item.parts ? "import.unmerge" : "import.splitDir"))}">✂️</button>`
|
||||
: ""}
|
||||
@@ -1513,6 +1520,25 @@ function groupByRequest(chosen) {
|
||||
return [...byRequest.values()];
|
||||
}
|
||||
|
||||
// "Autor - Georgia 01 - Titel": the release counts the series the way the
|
||||
// translation does, the metadata APIs often count the original's volumes
|
||||
function folderSeries(item) {
|
||||
const parent = (item.rel_dir || "").split("/").pop();
|
||||
for (const name of [item.name, parent]) {
|
||||
const { series, volume } = parseDownloadName(name || "");
|
||||
if (series && volume != null) return { series, volume };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// the folder's series when it differs from the chosen request's
|
||||
function seriesOverride(item) {
|
||||
const req = missingReqs.find((r) => r.id === item.request_id);
|
||||
const folder = folderSeries(item);
|
||||
if (!req || !folder) return null;
|
||||
return folder.series === req.series && folder.volume === req.volume ? null : folder;
|
||||
}
|
||||
|
||||
function buildImportGroups(groups) {
|
||||
return groups.map((group) => ({
|
||||
parts: group,
|
||||
@@ -1522,6 +1548,7 @@ function buildImportGroups(groups) {
|
||||
files: group.flatMap((it) => it.files),
|
||||
request_id: group[0].request_id,
|
||||
append: importedReqs.some((r) => r.id === group[0].request_id), // orphans re-import
|
||||
...(seriesOverride(group[0]) || {}),
|
||||
},
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -146,6 +146,8 @@ const STRINGS = {
|
||||
"import.splitDir": "Ordner in einzelne Titel aufteilen",
|
||||
"import.parts": "{parts} Teile · {files} Dateien",
|
||||
"import.maybeSeparate": "{n} Titel?",
|
||||
"import.folderSeries": "→ {series} #{volume}",
|
||||
"import.folderSeriesTitle": "Reihe und Band aus dem Ordnernamen ersetzen beim Import die des Eintrags ({series} #{volume})",
|
||||
"import.maybeSeparateTitle": "Die {n} Dateien tragen verschiedene Titel und sind je groß genug für ein ganzes Buch — mit ✂️ aufteilen",
|
||||
"import.libraryCellTitle": "Ziel-Library dieser Anfrage ändern",
|
||||
"import.conflict": "⚠ Konflikt",
|
||||
@@ -367,6 +369,8 @@ const STRINGS = {
|
||||
"import.splitDir": "Split the folder into single titles",
|
||||
"import.parts": "{parts} parts · {files} files",
|
||||
"import.maybeSeparate": "{n} titles?",
|
||||
"import.folderSeries": "→ {series} #{volume}",
|
||||
"import.folderSeriesTitle": "The series and volume from the folder name replace the request's on import ({series} #{volume})",
|
||||
"import.maybeSeparateTitle": "The {n} files carry different titles and are each big enough for a whole book — split with ✂️",
|
||||
"import.libraryCellTitle": "Change this request's target library",
|
||||
"import.conflict": "⚠ Conflict",
|
||||
|
||||
Reference in new issue
Block a user