1 Commits
v2.0 ... v2.1

Author SHA1 Message Date
eneller
4267700763 feat: return epub path
errors from wget and pandoc are thrown up
2025-03-16 20:30:42 +01:00
2 changed files with 6 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
[project] [project]
name = "epub2go" name = "epub2go"
version = "2.0" version = "2.1"
description = "EPUB converter using wget, pandoc and python glue" description = "EPUB converter using wget, pandoc and python glue"
readme = "README.md" readme = "README.md"
requires-python = ">=3.12" requires-python = ">=3.12"
@@ -22,4 +22,4 @@ include-package-data = true
requires = ["setuptools>=64", "setuptools_scm>=8"] requires = ["setuptools>=64", "setuptools_scm>=8"]
[tool.setuptools_scm] [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

View File

@@ -96,7 +96,7 @@ class GBConvert():
f.write(str(soup)) f.write(str(soup))
logger.debug('Removed %d tags from page %s during parsing', count, file_path) 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 --epub-cover-image
#TODO toc if it isnt described by <h> tags, e.g. https://www.projekt-gutenberg.org/adlersfe/maskenba/ #TODO toc if it isnt described by <h> tags, e.g. https://www.projekt-gutenberg.org/adlersfe/maskenba/
filename = f'{title} - {author}.epub' filename = f'{title} - {author}.epub'
@@ -109,7 +109,8 @@ class GBConvert():
--metadata author="{author}" \ --metadata author="{author}" \
--epub-title-page=false \ --epub-title-page=false \
{" ".join(chapters)} ''' {" ".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): def save_page(self, url):
logger.debug('Saving page at %s', url) logger.debug('Saving page at %s', url)
@@ -121,7 +122,7 @@ class GBConvert():
--tries=5 \ --tries=5 \
--quiet \ --quiet \
{url}''' {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 # get a list of all books for interactive selection or scraping
def get_all_books() -> List[Book]: def get_all_books() -> List[Book]: