-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjingle_action.py
41 lines (32 loc) · 1.51 KB
/
jingle_action.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
class JingleAction:
def __init__(self, argument, start_time, duration, is_streamed, program):
self.__argument = argument
self.start_time = start_time
self.duration = duration
self.__is_streamed = is_streamed
self.program = program
self.__call_answer_info = None
self.__call_handler = self.program.radio_station.call_handler
def start(self):
self.__request_call()
def pause(self):
self.__pause_media()
def stop(self):
self.__stop_jingle()
def notify_call_answered(self, answer_info):
self.__call_answer_info = answer_info
self.__play_jingle()
def __request_call(self):
raw_result = self.__call_handler.call(self, self.program.radio_station.station.transmitter_phone.number, 'play',
self.__argument, self.duration)
result = raw_result.split(" ")
print "Result of call is " + str(result)
def __play_jingle(self): # play the media in the array
if self.__is_streamed:
result = self.__call_handler.play(self.__call_answer_info['Channel-Call-UUID'], self.__argument)
print 'result of jingle play is ' + result
def __pause_jingle(self): # pause the media in the array
pass
def __stop_jingle(self): # stop the media being played by the player
result = self.__call_handler.stop_play(self.__call_answer_info['Channel-Call-UUID'], self.__argument)
print 'result of jingle stop is ' + result