-
Notifications
You must be signed in to change notification settings - Fork 1
/
model.py
113 lines (97 loc) · 3.99 KB
/
model.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import datetime
class show:
'''
a record class for radio shows as they appear in the programming logs.
'''
def __init__(self, name, start, end, engineer, producer, announcer):
'''
parameters:
name - string - name of the radio show as appears in the program guide
start - integer between 0 and 23: the hour the show starts
end - integer: hours
engineer - string
producer/announcer - string. use commas to separate multiple people.
'''
self.name = name
self.start = start
self.end = end
self.engineer = engineer
self.producer = producer
self.announcer = announcer
# note: using a datetime for self.start doesn't make sense to
# me, because self.start represents a periodic starting time,
# not a datetime point.
def getXmlSafeName(self):
return "&".join(self.name.split("&"))
class signon:
'''
represents a normal transmission signon event, as
found in the programming schedule.
'''
def __init__(self, time):
'''
time -- anything with an hour and minute attr,
where hour is an int between 0 and 23, and minute
is between 0 and 59
'''
self.time = time
class signoff:
'represents a normal transmission signoff event.'
def __init__(self, time):
self.time = time
###### sample shows
# baseline
show1 = show('Music for Human Beings',
datetime.datetime(2009,10,25,19, 0), datetime.timedelta(0, 3600),
'Dr. Jalis As-Sakran',
'Lester Woods',
'Peace Child Peter')
# no engineer, announcer or producer
show2 = show("Oregon Girl",
datetime.datetime(2009,10,25,20, 0), datetime.timedelta(0, 7200),
'',
'',
'')
# long engineer name
show3 = show('Jazz Train',
datetime.datetime(2009,10,25,22, 0), datetime.timedelta(0, 3600),
'Dr. Jalis "Doctor" As-Sakran Jr.',
'Lester Woods, Pat Greenleaf',
'Peace Child Peter, Prof Levine')
# long producer and announcer name
show4 = show("Terrashow",
datetime.datetime(2009,10,25,23, 0), datetime.timedelta(0, 7200),
'Peace Child Peter',
'Adam Bockelie, Ka Man Chan, Tracey Hayse, Elizabeth Jones, Yusung Lim, Emily Moberg',
'Tracey Hayse, Adam Bockelie, Elizabeth Jones, Ka Man Chan, Yusung Lim, Emily Moberg')
# long show name
show5 = show("Generoso's Bovine Ska and Polka and Rocksteady Show",
datetime.datetime(2009,10,25,1, 0), datetime.timedelta(0, 7200),
'Gene',
'Gene',
'Gene')
# long show, engineer, producer and announcer name
show6 = show("DJ Awesome and The Wonder Friends and The Jazz Volcano",
datetime.datetime(2009,10,25,5, 0), datetime.timedelta(0, 3600),
'Ali "Sweet Victory" Mohammad ',
'Adam Bockelie, Ka Man Chan, Tracey Hayse, Elizabeth Jones, Yusung Lim, Emily Moberg',
'Ka Man Chan, Adam Bockelie, Tracey Hayse, Emily Moberg, Elizabeth Jones, Yusung Lim')
# show that goes half an hour
show7 = show("Sex Pistols: A Comedy Tour",
datetime.datetime(2009,10,25,6, 0), datetime.timedelta(0, 1800),
'Dan Wheeler III',
'Eleanor Rigby',
'The Biscuits')
# show that goes half an hour and starts in the middle of the hour
show8 = show("Detective Banana: I Bruise Easily",
datetime.datetime(2009,10,25,6,30), datetime.timedelta(0, 1800),
'Andrew Correa',
'George Lucas',
'Heavenly Creams')
from datetime import time
signoff1 = signoff(time(6, 0))
signon1 = signon(time(7, 0))
signoff2 = signoff(time(3, 0))
signon2 = signon(time(4,0))
# a list of day events. sprinkle in signon and signoff events
day = [signoff1, signon1, show1, show2, show3, show4, show5, signoff2, signon2, show6, show7, show8]