mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-26 01:23:58 +00:00
Implement CoverArtImage.__hash__
This make CoverArtImage objects hashable
This commit is contained in:
@@ -70,6 +70,9 @@ class DataHash:
|
||||
def __eq__(self, other):
|
||||
return self._hash == other._hash
|
||||
|
||||
def hash(self):
|
||||
return self._hash
|
||||
|
||||
def delete_file(self):
|
||||
if self._filename:
|
||||
try:
|
||||
@@ -211,6 +214,11 @@ class CoverArtImage:
|
||||
else:
|
||||
return False
|
||||
|
||||
def __hash__(self):
|
||||
if self.datahash is None:
|
||||
return 0
|
||||
return hash(self.datahash.hash())
|
||||
|
||||
def set_data(self, data):
|
||||
"""Store image data in a file, if data already exists in such file
|
||||
it will be re-used and no file write occurs
|
||||
|
||||
Reference in New Issue
Block a user