Added shared to json and str, updated __repr__

This commit is contained in:
Rhet Turnbull
2019-12-27 07:26:13 -08:00
parent 0429c8f888
commit 5bec99eac9
2 changed files with 4 additions and 5 deletions

View File

@@ -472,8 +472,7 @@ class PhotoInfo:
return self._info["latitude"]
def __repr__(self):
# TODO: update to use __class__ and __name__
return f"osxphotos.PhotoInfo(db={self._db}, uuid='{self._uuid}', info={self._info})"
return f"osxphotos.{self.__class__.__name__}(db={self._db}, uuid='{self._uuid}', info={self._info})"
def __str__(self):
info = {
@@ -495,12 +494,12 @@ class PhotoInfo:
"latitude": self._latitude,
"longitude": self._longitude,
"path_edited": self.path_edited,
"shared": self.shared,
}
return yaml.dump(info, sort_keys=False)
def json(self):
""" return JSON representation """
# TODO: Add additional details here
pic = {
"uuid": self.uuid,
"filename": self.filename,
@@ -520,6 +519,7 @@ class PhotoInfo:
"latitude": self._latitude,
"longitude": self._longitude,
"path_edited": self.path_edited,
"shared": self.shared,
}
return json.dumps(pic)

View File

@@ -1118,5 +1118,4 @@ class PhotosDB:
return photoinfo
def __repr__(self):
# TODO: update to use __class__ and __name__
return f"osxphotos.PhotosDB(dbfile='{self.db_path}')"
return f"osxphotos.{self.__class__.__name__}(dbfile='{self.db_path}')"