feat: return epub path
errors from wget and pandoc are thrown up
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "epub2go"
|
||||
version = "2.0"
|
||||
version = "2.1"
|
||||
description = "EPUB converter using wget, pandoc and python glue"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.12"
|
||||
@@ -22,4 +22,4 @@ include-package-data = true
|
||||
requires = ["setuptools>=64", "setuptools_scm>=8"]
|
||||
|
||||
[tool.setuptools_scm]
|
||||
# can be empty if no extra settings are needed, presence enables setuptools-scm
|
||||
# can be empty if no extra settings are needed, presence enables setuptools-scm
|
||||
|
||||
@@ -96,7 +96,7 @@ class GBConvert():
|
||||
f.write(str(soup))
|
||||
logger.debug('Removed %d tags from page %s during parsing', count, file_path)
|
||||
|
||||
def create_epub(self, author, title, chapters, dir_output)-> int:
|
||||
def create_epub(self, author, title, chapters, dir_output):
|
||||
#TODO --epub-cover-image
|
||||
#TODO toc if it isnt described by <h> tags, e.g. https://www.projekt-gutenberg.org/adlersfe/maskenba/
|
||||
filename = f'{title} - {author}.epub'
|
||||
@@ -109,7 +109,8 @@ class GBConvert():
|
||||
--metadata author="{author}" \
|
||||
--epub-title-page=false \
|
||||
{" ".join(chapters)} '''
|
||||
return subprocess.run(shlex.split(command), cwd=dir_output).returncode
|
||||
subprocess.run(shlex.split(command), cwd=dir_output, check=True)
|
||||
return os.path.abspath(os.path.join(dir_output,filename))
|
||||
|
||||
def save_page(self, url):
|
||||
logger.debug('Saving page at %s', url)
|
||||
@@ -121,7 +122,7 @@ class GBConvert():
|
||||
--tries=5 \
|
||||
--quiet \
|
||||
{url}'''
|
||||
return subprocess.run(shlex.split(command), cwd=self.dir_download).returncode
|
||||
subprocess.run(shlex.split(command), cwd=self.dir_download, check=True)
|
||||
|
||||
# get a list of all books for interactive selection or scraping
|
||||
def get_all_books() -> List[Book]:
|
||||
|
||||
Reference in New Issue
Block a user