fix: workaround around merged parts

This commit is contained in:
tretrauit 2023-06-20 22:11:10 +07:00
parent efc7ff2be9
commit f549166e2e
2 changed files with 7 additions and 1 deletions

View File

@ -15,7 +15,10 @@ class Latest:
self.raw = raw
def get_name(self):
return self.path.split("/")[-1]
name = self.path.split("/")[-1]
if name == "":
name = self.segments[0]["path"].split("/")[-1][:-4]
return name
@staticmethod
def from_dict(data):

View File

@ -453,12 +453,15 @@ class Installer:
archive_name = segment["path"].split("/")[-1]
if i == 0:
base_archive = archive_name = Path(archive_name).stem # Remove .001
if self.temp_path.joinpath(archive_name + ".downloaded").exists():
continue
await self._download_file(segment["path"], archive_name)
if i != 0:
with open(self.temp_path.joinpath(base_archive), 'ab') as f:
with open(self.temp_path.joinpath(archive_name), 'rb') as f2:
f.write(f2.read())
self.temp_path.joinpath(archive_name).unlink()
self.temp_path.joinpath(archive_name + ".downloaded").touch()
async def download_full_voiceover(self, language: str, pre_download=False):