From aefefb657421d66ea66347f14ca0409a0c55ec54 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Wed, 9 Nov 2022 16:55:53 +0100 Subject: Fixing entities exploration. --- src/argaze/TobiiGlassesPro2/TobiiEntities.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/argaze/TobiiGlassesPro2/TobiiEntities.py b/src/argaze/TobiiGlassesPro2/TobiiEntities.py index 81c227f..4516b2e 100644 --- a/src/argaze/TobiiGlassesPro2/TobiiEntities.py +++ b/src/argaze/TobiiGlassesPro2/TobiiEntities.py @@ -117,8 +117,6 @@ class TobiiRecording: self.__id = os.path.basename(recording_path) self.__path = recording_path - self.__path = os.path.dirname(os.path.dirname(os.path.abspath(self.__path))) - with open(os.path.join(self.__path, TOBII_RECORD_FILENAME)) as f: try: item = json.load(f) @@ -131,11 +129,7 @@ class TobiiRecording: self.__length = int(item["rec_length"]) self.__et_samples = int(item["rec_et_samples"]) self.__et_samples_valid = int(item["rec_et_valid_samples"]) - - self.__segments = int(item["rec_segments"]) - - self.__project = TobiiProject(self.__path) - self.__participant = TobiiParticipant(self.__path) + self.__participant_id = item["rec_participant"] @property def path(self) -> str: @@ -182,15 +176,18 @@ class TobiiRecording: def project(self) -> "TobiiProject": """Get project to which it belongs.""" - return self.__project + project_path = os.path.dirname(os.path.dirname(os.path.abspath(self.__path))) + + return TobiiProject(project_path) @property def participant(self) -> "TobiiParticipant": """Get participant to which it belongs.""" - return self.__participant + project_path = os.path.dirname(os.path.dirname(os.path.abspath(self.__path))) + + return TobiiParticipant(project_path + '/participants/' + self.__participant_id) - @property def segments(self) -> list["TobiiSegment"]: """Get all recorded segments.""" @@ -283,7 +280,6 @@ class TobiiProject: return self.__creation_date - @property def participants(self) -> list["TobiiParticipant"]: """Get all participants.""" @@ -324,7 +320,6 @@ class TobiiDrive: return self.__path - @property def projects(self) -> list["TobiiProject"]: """Get all projects.""" -- cgit v1.1