[Sync] Image update: do not compile unchanged images
This commit is contained in:
1 parent
63796dfab3
commit
98f9de7d60
2 files changed
+43
-5
No files matched your search
@@ -1,3 +1,12 @@
|
||||
def find(store, item_id: str):
|
||||
q = {'id': item_id}
|
||||
try:
|
||||
return store.find_one(q)
|
||||
except ValueError:
|
||||
pass
|
||||
return None
|
||||
|
||||
|
||||
class Model:
|
||||
def __init__(self, provider, store, file):
|
||||
super().__init__()
|
||||
@@ -19,7 +28,17 @@ class Model:
|
||||
return None
|
||||
|
||||
async def is_changed(self):
|
||||
return False
|
||||
i = find(self.store, self.id)
|
||||
return self._is_changed_hash(i)
|
||||
|
||||
def _is_changed_hash(self, item):
|
||||
if not item:
|
||||
return True
|
||||
|
||||
if 'hash' not in item:
|
||||
return True
|
||||
|
||||
return not (self.hash == item['hash'])
|
||||
|
||||
async def save(self):
|
||||
pass
|
||||
Reference in new issue
Block a user