Compare commits

..

No commits in common. "27c47847936ce8ebec3b953a3accb6c7a60d2d02" and "bf83e1cf0bcb7e33699f471faee654063d12ed19" have entirely different histories.

3 changed files with 11 additions and 14 deletions

View file

@ -100,14 +100,12 @@ on conflict(reader_url)
} }
if (book.authors.length > 0) { if (book.authors.length > 0) {
book.title = `[${book.authors book.title = `${book.title}`;
.slice(0, opts.outAuthorsLimit)
.join(", ")}] ${book.title}`.replace(/[/]/g, "%2F");
} }
await fs.mkdir(opts.outDir, { const title = `${book.authors.slice(0, opts.outAuthorsLimit).join("、")}${
recursive: true, book.title
}); }`.replace(/[/]/g, "%2F");
const files = await fs.readdir(path); const files = await fs.readdir(path);
@ -119,19 +117,18 @@ on conflict(reader_url)
} }
for (const [n, f] of Object.entries(files)) { for (const [n, f] of Object.entries(files)) {
await fs.copyFile( await fs.rename(
`${path}/${f}`, `${path}/${f}`,
`${opts.outDir}/${book.title}${ `${opts.outDir}/${title}${
files.length > 1 ? ` - ${pad(n)}` : "" files.length > 1 ? ` - ${pad(n)}` : ""
}.${f.split(".").at(-1)}`, }.${f.split(".").at(-1)}`,
); );
} }
await fs.rmdir(path);
await fs.rm(path, { recursive: true });
return; return;
} }
const out = createWriteStream(`${opts.outDir}/${book.title}.cbz`); const out = createWriteStream(`${opts.outDir}/${title}.cbz`);
const zip = new Zip(function cb(err, data, final) { const zip = new Zip(function cb(err, data, final) {
if (err) { if (err) {

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{ {
"name": "@fogtype/gadl", "name": "@fogtype/gadl",
"version": "1.5.0", "version": "1.4.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@fogtype/gadl", "name": "@fogtype/gadl",
"version": "1.5.0", "version": "1.4.1",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"dependencies": { "dependencies": {
"fflate": "^0.8.1", "fflate": "^0.8.1",

View file

@ -1,6 +1,6 @@
{ {
"name": "@fogtype/gadl", "name": "@fogtype/gadl",
"version": "1.5.0", "version": "1.4.2",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"type": "module", "type": "module",
"bin": "bin/run.js", "bin": "bin/run.js",