fix written_bytes never being 0
This commit is contained in:
parent
c496278a5b
commit
b09e1f8825
1 changed files with 2 additions and 4 deletions
|
@ -164,12 +164,10 @@ class ManagedStream:
|
||||||
return guess_media_type(os.path.basename(self.descriptor.suggested_file_name))[0]
|
return guess_media_type(os.path.basename(self.descriptor.suggested_file_name))[0]
|
||||||
|
|
||||||
def as_dict(self) -> typing.Dict:
|
def as_dict(self) -> typing.Dict:
|
||||||
if self.written_bytes:
|
if not self.written_bytes and self.output_file_exists:
|
||||||
written_bytes = self.written_bytes
|
|
||||||
elif self.output_file_exists:
|
|
||||||
written_bytes = os.stat(self.full_path).st_size
|
written_bytes = os.stat(self.full_path).st_size
|
||||||
else:
|
else:
|
||||||
written_bytes = None
|
written_bytes = self.written_bytes
|
||||||
return {
|
return {
|
||||||
'completed': self.finished,
|
'completed': self.finished,
|
||||||
'file_name': self.file_name,
|
'file_name': self.file_name,
|
||||||
|
|
Loading…
Reference in a new issue