def from_csv(columns: Dict[str, int], data: List[str]) -> 'View': start_time = utc_timestamp_to_datetime(timestamp=data[columns['Start Time']]) h, m, s = data[columns['Duration']].split(':') duration_seconds = int(h) * 3600 + int(m) * 60 + int(s) return View( profile=data[columns['Profile Name']], title=data[columns['Title']], device=data[columns['Device Type']], supplemental_video_type=data[columns['Supplemental Video Type']] or None, start_time=start_time, duration_seconds=duration_seconds, )
def from_json(data: Dict[str, Any]) -> 'Chat': return Chat( body=data["body"], date=utc_timestamp_to_datetime(timestamp=data["timestamp"]), )
def __init__(self, name: str, timestamp: str) -> None: self.name = name self.date = utc_timestamp_to_datetime(timestamp=timestamp)
def from_json(data: Dict[str, Any]) -> 'Stream': return Stream(end_time=utc_timestamp_to_datetime(data['endTime']), artist_name=data['artistName'], track_name=data['trackName'], duration_milliseconds=data['msPlayed'])