feat: allow getting directory without download

This commit is contained in:
eneller
2025-03-23 23:53:54 +01:00
parent c49a1be369
commit 660af7fab0
3 changed files with 10 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
[project]
name = "epub2go"
version = "2.1"
version = "2.2"
description = "EPUB converter using wget, pandoc and python glue"
readme = "README.md"
requires-python = ">=3.12"

View File

@@ -31,6 +31,13 @@ class GBConvert():
self.blocklist = blocklist.read().splitlines()
self.dir_download = downloaddir
def getDir(self, url):
tocpage = os.path.dirname(url) # ToC website url
parsed_url = urlparse(tocpage)
# directories created by wget recreating the URL
dir_output = os.path.join(self.dir_download, parsed_url.netloc + parsed_url.path )
return dir_output
def download(self,
url:str,
author:str = None,
@@ -39,8 +46,7 @@ class GBConvert():
cleanpages: bool = True,
):
tocpage = os.path.dirname(url) # ToC website url
url = urlparse(tocpage)
dir_output = os.path.join(self.dir_download, url.netloc + url.path )# directories created by wget recreating the URL
dir_output = self.getDir()
logger.debug('Downloading to %s, expecting files in in %s', self.dir_download, dir_output)
author = author
title = title

2
uv.lock generated
View File

@@ -81,7 +81,7 @@ wheels = [
[[package]]
name = "epub2go"
version = "1.2"
version = "2.2"
source = { editable = "." }
dependencies = [
{ name = "beautifulsoup4" },