From df77a70185216159c28f29cd835346e594f6f3b5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Javier=20Fern=C3=A1ndez-Sanguino?= Date: Wed, 10 May 2017 22:03:03 +0000 Subject: [PATCH] Create cover pages using a script for those books that do not have it - as is the case for all the Spanish Lone Wolf books. When regenerating the book the auto-generated cover image is used if none other is available. git-svn-id: https://projectaon.org/data/trunk@2631 f6f3e2d7-ff33-0410-aaf5-b4bee2cdac11 --- common/epub/Makefile.common | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/common/epub/Makefile.common b/common/epub/Makefile.common index 0ab0e7a..3f41a6c 100644 --- a/common/epub/Makefile.common +++ b/common/epub/Makefile.common @@ -11,7 +11,9 @@ RELSCRIPT := $(AONROOTDIR)/common/scripts # Relative location of the xsl files RELXSLDIR := $(AONROOTDIR)/common/xsl EPUBSCRIPT := $(RELSCRIPT)/gbtoepub.pl +COVERSCRIPT := $(RELSCRIPT)/create-epub-cover.pl COVERIMAGE := $(AONROOTDIR)/$(BLANG)/jpeg/$(SERIES)/$(BASENAME)/skins/ebook/cover.jpg +ALTCOVERIMAGE := $(AONROOTDIR)/$(BLANG)/epub/$(SERIES)/$(BASENAME)/OEBPS/cover.jpg # -------------------------------- BEGIN FONT SELECTION ----------------------------------------------------------- # Location of the font files, this is adjustable here in order to make it possible to run @@ -94,12 +96,25 @@ XSLFILES=$(RELXSLDIR)/epub-opf-metadata.xsl $(RELXSLDIR)/epub-xhtml.xsl \ epub: $(EPUB) $(AONROOTDIR)/$(BLANG)/epub/$(SERIES)/$(BASENAME)/$(EPUB): $(XMLFILE) $(EPUBSCRIPT) $(XSLFILES) cd $(AONROOTDIR) && perl $(EPUBSCRIPT) --language=$(BLANG) --font-files=$(FONTDIR) $(BASENAME) +# Create cover page if not existing + @if [ ! -e $(COVERIMAGE) ] ; then \ + cd $(AONROOTDIR) && perl $(COVERSCRIPT) --language=$(BLANG) --font-files=$(FONTDIR) $(BASENAME) ; \ + fi -$(EPUB): $(AONROOTDIR)/$(BLANG)/epub/$(SERIES)/$(BASENAME)/$(EPUB) +$(EPUB): $(AONROOTDIR)/$(BLANG)/epub/$(SERIES)/$(BASENAME)/$(EPUB) @[ -x `which ebook-convert` ] || { echo "ERROR: Cannot find 'ebook-convert', please install Calibre" >&2; exit 1; } cp -p $(AONROOTDIR)/$(BLANG)/epub/$(SERIES)/$(BASENAME)/$(EPUB) . # Regenerate to include the covers properly within the Ebook and fix the EPUB - ebook-convert $(EPUB) regen_$(EPUB) --cover $(COVERIMAGE) + @if [ -e $(ALTCOVERIMAGE) ] && [ ! -e $(COVERIMAGE) ] ; then \ + ebook-convert $(EPUB) regen_$(EPUB) --cover $(ALTCOVERIMAGE) ; \ + fi + @if [ ! -e $(COVERIMAGE) ] ; then \ + ebook-convert $(EPUB) regen_$(EPUB) --cover $(COVERIMAGE) ; \ + fi + @if [ ! -e $(ALTCOVERIMAGE) ] && [ ! -e $(COVERIMAGE) ] ; then \ + ebook-convert $(EPUB) regen_$(EPUB) ; \ + fi + mv regen_$(EPUB) $(EPUB) -rm -f cover.jpg $(BASENAME).opf -- 2.34.1