diff --git a/models/programme.py b/models/programme.py index 5a383c4..c977c98 100644 --- a/models/programme.py +++ b/models/programme.py @@ -9,12 +9,24 @@ def __init__(self, channel: Channel, start: datetime, stop: datetime): self.channel: Channel = channel self.start: datetime = start self.stop: datetime = stop + self.data: Dict = {} + self.is_prominent = False - @classmethod - def from_dict(cls, input_dict: Dict) -> 'Programme': - date_format = "%Y%m%d%H%M%S %z" - return cls( + @staticmethod + def from_dict(input_dict: Dict) -> 'Programme': + date_format: str = "%Y%m%d%H%M%S %z" + return Programme( ChannelManager.get_or_create(input_dict['channel']), datetime.strptime(input_dict['start'], date_format), datetime.strptime(input_dict['stop'], date_format) ) + + def __repr__(self): + return f'{self.channel.name}: {self.start} -> {self.stop}' + + def __set__(self, instance, value): + if instance not in ['channel', 'start', 'stop']: + self.data[instance] = value + + def __get__(self, instance, owner): + pass diff --git a/requirements.txt b/requirements.txt index 46a48dd..41959c7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,7 @@ +click==7.1.2 Flask==1.1.2 +gunicorn==20.0.4 +itsdangerous==1.1.0 +Jinja2==2.11.2 +MarkupSafe==1.1.1 +Werkzeug==1.0.1