I log listen time from my player, (second_frame is integer_range). How i can sumamry listen time, so in this case ranges are (2945 - 2970, 2957 - 2962, 2962 - 2977), it should response 32 second (first region + 25, second +0 because is withing first, and third + 7 because it's intersect with first). Ps. ranges can intersect, be within , double log, so i want to summary only distinct listen time.
[{
"previous_second": 2955,
"second": 2970,
"duration": 5177,
"second_frame": {
"lt": 2970,
"gte": 2945
}
}, {
"previous_second": 2957,
"second": 2962,
"duration": 5177,
"second_frame": {
"lt": 2962,
"gte": 2957
}
}, {
"previous_second": 2962,
"second": 2977,
"duration": 5177,
"second_frame": {
"lt": 2977,
"gte": 2962
}
}]