mirror of
https://github.com/flibusta-apps/books_downloader.git
synced 2025-12-06 15:05:37 +01:00
Fix FileNotFound when unzip
This commit is contained in:
@@ -153,9 +153,12 @@ class FLDownloader(BaseDownloader):
|
|||||||
|
|
||||||
await temp_file.flush()
|
await temp_file.flush()
|
||||||
|
|
||||||
|
try:
|
||||||
return await asyncio.get_event_loop().run_in_executor(
|
return await asyncio.get_event_loop().run_in_executor(
|
||||||
process_pool_executor, unzip, temp_file.name, "fb2"
|
process_pool_executor, unzip, temp_file.name, "fb2"
|
||||||
)
|
)
|
||||||
|
except FileNotFoundError:
|
||||||
|
return None
|
||||||
|
|
||||||
async def _download_with_converting(
|
async def _download_with_converting(
|
||||||
self,
|
self,
|
||||||
@@ -185,6 +188,9 @@ class FLDownloader(BaseDownloader):
|
|||||||
await response.aclose()
|
await response.aclose()
|
||||||
await client.aclose()
|
await client.aclose()
|
||||||
|
|
||||||
|
if filename_to_convert is None:
|
||||||
|
raise ValueError
|
||||||
|
|
||||||
form = {"format": self.file_type}
|
form = {"format": self.file_type}
|
||||||
files = {"file": open(filename_to_convert, "rb")}
|
files = {"file": open(filename_to_convert, "rb")}
|
||||||
|
|
||||||
@@ -241,6 +247,9 @@ class FLDownloader(BaseDownloader):
|
|||||||
await response.aclose()
|
await response.aclose()
|
||||||
await client.aclose()
|
await client.aclose()
|
||||||
|
|
||||||
|
if temp_filename is None:
|
||||||
|
return None
|
||||||
|
|
||||||
if self.need_zip:
|
if self.need_zip:
|
||||||
content_filename = await asyncio.get_event_loop().run_in_executor(
|
content_filename = await asyncio.get_event_loop().run_in_executor(
|
||||||
process_pool_executor, zip, await self.get_filename(), temp_filename
|
process_pool_executor, zip, await self.get_filename(), temp_filename
|
||||||
|
|||||||
Reference in New Issue
Block a user