added total size

This commit is contained in:
Hellow2
2023-04-05 11:54:02 +02:00
parent 8e19c68e36
commit 90b0d0ae20
4 changed files with 28 additions and 2 deletions

View File

@@ -50,6 +50,17 @@ class Target(DatabaseObject):
@property
def exists(self) -> bool:
return self.file_path.is_file()
@property
def size(self) -> int:
"""
returns the size the downloaded autio takes up in bytes
returns 0 if the file doesn't exsit
"""
if not self.exists:
return 0
return self.file_path.stat().st_size
def create_path(self):
self._path.mkdir(parents=True, exist_ok=True)