feat: allow getting directory without download
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "epub2go"
|
name = "epub2go"
|
||||||
version = "2.1"
|
version = "2.2"
|
||||||
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"
|
||||||
|
|||||||
@@ -31,6 +31,13 @@ class GBConvert():
|
|||||||
self.blocklist = blocklist.read().splitlines()
|
self.blocklist = blocklist.read().splitlines()
|
||||||
self.dir_download = downloaddir
|
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,
|
def download(self,
|
||||||
url:str,
|
url:str,
|
||||||
author:str = None,
|
author:str = None,
|
||||||
@@ -39,8 +46,7 @@ class GBConvert():
|
|||||||
cleanpages: bool = True,
|
cleanpages: bool = True,
|
||||||
):
|
):
|
||||||
tocpage = os.path.dirname(url) # ToC website url
|
tocpage = os.path.dirname(url) # ToC website url
|
||||||
url = urlparse(tocpage)
|
dir_output = self.getDir()
|
||||||
dir_output = os.path.join(self.dir_download, url.netloc + url.path )# directories created by wget recreating the URL
|
|
||||||
logger.debug('Downloading to %s, expecting files in in %s', self.dir_download, dir_output)
|
logger.debug('Downloading to %s, expecting files in in %s', self.dir_download, dir_output)
|
||||||
author = author
|
author = author
|
||||||
title = title
|
title = title
|
||||||
|
|||||||
Reference in New Issue
Block a user