Skip to content

Commit

Permalink
some examples
Browse files Browse the repository at this point in the history
  • Loading branch information
philsupertramp committed Sep 4, 2020
1 parent a5f50eb commit 1458a3e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
20 changes: 16 additions & 4 deletions models/programme.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1458a3e

Please sign in to comment.