|
@@ -217,6 +217,18 @@ class Interval(): |
|
|
self.duration = new_duration |
|
|
self.duration = new_duration |
|
|
self.end = self.start + self.duration |
|
|
self.end = self.start + self.duration |
|
|
|
|
|
|
|
|
|
|
|
def overlaps(self, other): |
|
|
|
|
|
"""Check if this interval overlaps (or touches) with another interval |
|
|
|
|
|
|
|
|
|
|
|
This is the case if: |
|
|
|
|
|
- this.start <= other.end <= this.end |
|
|
|
|
|
- this.start <= other.start <= this.end |
|
|
|
|
|
- other.start <= this.end <= other.end |
|
|
|
|
|
- other.start <= this.start <= other.end |
|
|
|
|
|
""" |
|
|
|
|
|
return (self.start <= other.end <= self.end) or (self.start <= other.start <= self.end) or \ |
|
|
|
|
|
(other.start <= self.end <= other.end) or (other.start <= self.start <= other.end) |
|
|
|
|
|
|
|
|
class Feature(): |
|
|
class Feature(): |
|
|
"""A feature extracted from a media file ("has a" Interval) |
|
|
"""A feature extracted from a media file ("has a" Interval) |
|
|
|
|
|
|
|
|