source/controlplaneapi/infrastructure/lambda/MreDataExport/shared/es_EventDataExporter.py [186:264]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    def _get_thumbnail_loc(self, segment):

        if 'OptimizedThumbnailLocation' in segment:
            if len(segment['OptimizedThumbnailLocation'].keys()) > 0:
                return segment['OptimizedThumbnailLocation']
        return segment['OriginalThumbnailLocation']

    def _get_clip_locations(self, segment):
        clips_locs = []
        clip_loc = segment['OriginalClipLocation']

        if 'OptimizedClipLocation' in segment:
            if len(segment['OptimizedClipLocation'].keys()) > 0:
                clip_loc = segment['OptimizedClipLocation']

        
        for cliploc_audio_track, loc in clip_loc.items():
            clips_locs.append({
                cliploc_audio_track : loc
            })
        
        return clips_locs
    
    def _get_segment_start_time(self, segment):
        start_time = segment['Start']

        new_start_times = []
        if 'OptoStart' in segment:
            if len(segment['OptoStart'].keys()) > 0:
                for audio_track, startTime in segment['OptoStart'].items():
                    # Add the MRE specific Start time in Secs to the Event's Actual StartTime (in UTC)
                    tmp_new_start_time = datetime.strptime(self.__event_actual_start_time,"%Y-%m-%dT%H:%M:%SZ") + timedelta(seconds=startTime)
                    new_start_time = datetime.strftime(tmp_new_start_time, "%Y-%m-%dT%H:%M:%SZ")
                    new_start_times.append({
                        audio_track: new_start_time
                    })

        if len(new_start_times) > 0:
            return new_start_times
        
        # When No OptoStart found, we have a single Start time and not per AudioTrack
        tmp_new_start_time = datetime.strptime(self.__event_actual_start_time,"%Y-%m-%dT%H:%M:%SZ") + timedelta(seconds=start_time)
        new_start_time = datetime.strftime(tmp_new_start_time, "%Y-%m-%dT%H:%M:%SZ")
        return new_start_time

    def _get_segment_end_time(self, segment):
        end_time = segment['End']

        new_end_times = []
        if 'OptoEnd' in segment:
            if len(segment['OptoEnd'].keys()) > 0:
                for audio_track, endTime in segment['OptoEnd'].items():
                    # Add the MRE specific End time in Secs to the Event's Actual EndTime (in UTC)
                    tmp_new_end_time = datetime.strptime(self.__event_actual_start_time,"%Y-%m-%dT%H:%M:%SZ") + timedelta(seconds=endTime)
                    new_end_time = datetime.strftime(tmp_new_end_time, "%Y-%m-%dT%H:%M:%SZ")
                    new_end_times.append({
                        audio_track: new_end_time
                    })

        if len(new_end_times) > 0:
            return new_end_times
        
        # When No OptoStart found, we have a single End time and not per AudioTrack
        tmp_new_end_time = datetime.strptime(self.__event_actual_start_time,"%Y-%m-%dT%H:%M:%SZ") + timedelta(seconds=end_time)
        new_end_time = datetime.strftime(tmp_new_end_time, "%Y-%m-%dT%H:%M:%SZ")
        return new_end_time


    def _get_event_type(self, feature_name):
        feature_event_type_map = {
            "MatchPoint": "aws:mre:tennis:MatchPoint",
            "Ace": "aws:mre:tennis:Ace",
            "DoubleFaults": "aws:mre:tennis:DoubleFaults",
            "GamePoint": "aws:mre:tennis:GamePoint",
            "SetPoint": "aws:mre:tennis:SetPoint",
            "BreakPoint": "aws:mre:tennis:BreakPoint"
        }

        return feature_event_type_map[feature_name]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



source/controlplaneapi/infrastructure/lambda/MreDataExport/shared/es_ReplayDataExporter.py [270:348]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    def _get_thumbnail_loc(self, segment):

        if 'OptimizedThumbnailLocation' in segment:
            if len(segment['OptimizedThumbnailLocation'].keys()) > 0:
                return segment['OptimizedThumbnailLocation']
        return segment['OriginalThumbnailLocation']

    def _get_clip_locations(self, segment):
        clips_locs = []
        clip_loc = segment['OriginalClipLocation']

        if 'OptimizedClipLocation' in segment:
            if len(segment['OptimizedClipLocation'].keys()) > 0:
                clip_loc = segment['OptimizedClipLocation']

        
        for cliploc_audio_track, loc in clip_loc.items():
            clips_locs.append({
                cliploc_audio_track : loc
            })
        
        return clips_locs
    
    def _get_segment_start_time(self, segment):
        start_time = segment['Start']

        new_start_times = []
        if 'OptoStart' in segment:
            if len(segment['OptoStart'].keys()) > 0:
                for audio_track, startTime in segment['OptoStart'].items():
                    # Add the MRE specific Start time in Secs to the Event's Actual StartTime (in UTC)
                    tmp_new_start_time = datetime.strptime(self.__event_actual_start_time,"%Y-%m-%dT%H:%M:%SZ") + timedelta(seconds=startTime)
                    new_start_time = datetime.strftime(tmp_new_start_time, "%Y-%m-%dT%H:%M:%SZ")
                    new_start_times.append({
                        audio_track: new_start_time
                    })

        if len(new_start_times) > 0:
            return new_start_times
        
        # When No OptoStart found, we have a single Start time and not per AudioTrack
        tmp_new_start_time = datetime.strptime(self.__event_actual_start_time,"%Y-%m-%dT%H:%M:%SZ") + timedelta(seconds=start_time)
        new_start_time = datetime.strftime(tmp_new_start_time, "%Y-%m-%dT%H:%M:%SZ")
        return new_start_time

    def _get_segment_end_time(self, segment):
        end_time = segment['End']

        new_end_times = []
        if 'OptoEnd' in segment:
            if len(segment['OptoEnd'].keys()) > 0:
                for audio_track, endTime in segment['OptoEnd'].items():
                    # Add the MRE specific End time in Secs to the Event's Actual EndTime (in UTC)
                    tmp_new_end_time = datetime.strptime(self.__event_actual_start_time,"%Y-%m-%dT%H:%M:%SZ") + timedelta(seconds=endTime)
                    new_end_time = datetime.strftime(tmp_new_end_time, "%Y-%m-%dT%H:%M:%SZ")
                    new_end_times.append({
                        audio_track: new_end_time
                    })

        if len(new_end_times) > 0:
            return new_end_times
        
        # When No OptoStart found, we have a single End time and not per AudioTrack
        tmp_new_end_time = datetime.strptime(self.__event_actual_start_time,"%Y-%m-%dT%H:%M:%SZ") + timedelta(seconds=end_time)
        new_end_time = datetime.strftime(tmp_new_end_time, "%Y-%m-%dT%H:%M:%SZ")
        return new_end_time


    def _get_event_type(self, feature_name):
        feature_event_type_map = {
            "MatchPoint": "aws:mre:tennis:MatchPoint",
            "Ace": "aws:mre:tennis:Ace",
            "DoubleFaults": "aws:mre:tennis:DoubleFaults",
            "GamePoint": "aws:mre:tennis:GamePoint",
            "SetPoint": "aws:mre:tennis:SetPoint",
            "BreakPoint": "aws:mre:tennis:BreakPoint"
        }

        return feature_event_type_map[feature_name]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



