From 7fb6d9e2b8f999a91343cfccd43dbb54e3173361 Mon Sep 17 00:00:00 2001 From: LostQuasar Date: Sun, 3 Nov 2024 20:06:07 -0500 Subject: [PATCH 1/2] Remove extension from title --- comic-book.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comic-book.js b/comic-book.js index d3bb575..d9ef40a 100644 --- a/comic-book.js +++ b/comic-book.js @@ -25,7 +25,7 @@ export const makeComicBook = ({ entries, loadBlob, getSize }, file) => { const book = {} book.getCover = () => loadBlob(files[0]) - book.metadata = { title: file.name } + book.metadata = { title: file.name.replace(/\.\w+?$/g,'') } book.sections = files.map(name => ({ id: name, load: () => load(name), From f99a7e2bbbee73a067bf7b4dfbcdf3cee53fe530 Mon Sep 17 00:00:00 2001 From: LostQuasar Date: Sun, 3 Nov 2024 20:06:26 -0500 Subject: [PATCH 2/2] Add file name as title if no metadata --- pdf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pdf.js b/pdf.js index 5abf583..940e1cf 100644 --- a/pdf.js +++ b/pdf.js @@ -123,7 +123,7 @@ export const makePDF = async file => { const { metadata, info } = await pdf.getMetadata() ?? {} // TODO: for better results, parse `metadata.getRaw()` book.metadata = { - title: metadata?.get('dc:title') ?? info?.Title, + title: metadata?.get('dc:title') ?? info?.Title ?? file.name.replace(/\.\w+?$/g,''), author: metadata?.get('dc:creator') ?? info?.Author, contributor: metadata?.get('dc:contributor'), description: metadata?.get('dc:description') ?? info?.Subject,