Optional file downloaded checking by separate function

This commit is contained in:
shortcutme 2018-03-29 02:59:11 +02:00
parent c1397bbaf7
commit af7c7da735
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
1 changed files with 8 additions and 0 deletions

View File

@ -304,6 +304,14 @@ class ContentManager(object):
else:
return False
def isDownloaded(self, inner_path, hash_id=None):
if not hash_id:
file_info = self.getFileInfo(inner_path)
if not file_info or "sha512" not in file_info:
return False
hash_id = self.hashfield.getHashId(file_info["sha512"])
return hash_id in self.hashfield
# Find the file info line from self.contents
# Return: { "sha512": "c29d73d...21f518", "size": 41 , "content_inner_path": "content.json"}
def getFileInfo(self, inner_path, new_file=False):