Changeset 24
- Timestamp:
- 08/12/10 09:23:43 (3 years ago)
- Location:
- trunk
- Files:
-
- 7 modified
-
JsonAPI.txt (modified) (1 diff)
-
radiomate/config.py (modified) (1 diff)
-
radiomate/jsonif.py (modified) (6 diffs)
-
radiomate/jukebox.py (modified) (1 diff)
-
radiomate/jukeslots/base.py (modified) (2 diffs)
-
radiomate/jukeslots/simplelive.py (modified) (2 diffs)
-
tests/jsontest.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/JsonAPI.txt
r18 r24 608 608 609 609 { 610 "response": ("ok" | "notallowed" | "dontexists" | "alreadyexists" | "servererror" | "error" | "requesterror" ),611 "responsen": (0 | 101 | 201 | 202 | 301 | 401 | 501 ),610 "response": ("ok" | "notallowed" | "dontexists" | "alreadyexists" | "servererror" | "error" | "requesterror", "notimplemented"), 611 "responsen": (0 | 101 | 201 | 202 | 301 | 401 | 501 | 601), 612 612 "requested": <the requested action>, 613 613 "warning": <warning message(s) or null>, -
trunk/radiomate/config.py
r23 r24 37 37 TAKEOVERMOUNTURL = "http://%s:%d/takeover.mp3" % (ICECASTSERVER, ICECASTPORT) 38 38 39 # The port used for incoming live streams39 # The mount and port used for incoming live streams 40 40 LIVESTREAMPORT = 8005 41 LIVESTREAMMOUNT = "live.mp3" 41 42 42 43 # The port used internally on the loopback address to communicate between jukeslot istances. -
trunk/radiomate/jsonif.py
r18 r24 24 24 from mate import * 25 25 from dao import * 26 from jukeslots.all import * 26 27 27 28 … … 33 34 RESPONSE_REQERROR = 401 34 35 RESPONSE_ERROR = 501 36 RESPONSE_NOTIMPLEMENTED = 601 35 37 36 38 ERRORDICT = { … … 41 43 RESPONSE_SERVERERROR: "servererror", 42 44 RESPONSE_REQERROR: "requesterror", 43 RESPONSE_ERROR: "error" 45 RESPONSE_ERROR: "error", 46 RESPONSE_NOTIMPLEMENTED: "notimplemented" 44 47 } 45 48 … … 867 870 except Exception, e: 868 871 return JsonResponse(RESPONSE_REQERROR, str(e), rd) 872 873 try: 874 # check the slot type 875 jukeslotclass = JUKESLOTTYPEDICT[t.slottype] 876 tj = jukeslotclass(timeslot=t, mainpassword="") 877 tj.liquidsoapcode() 878 except: 879 return JsonResponse(RESPONSE_REQERROR, "Slot type not supported or wrong slot parameters") 869 880 870 881 try: … … 919 930 t = timeslotdao.getById(id) 920 931 t.dictupdate(req['timeslot']) 932 933 try: 934 # check the slot type 935 jukeslotclass = JUKESLOTTYPEDICT[t.slottype] 936 tj = jukeslotclass(timeslot=t, mainpassword="") 937 tj.liquidsoapcode() 938 except: 939 return JsonResponse(RESPONSE_REQERROR, "Slot type not supported or wrong slot parameters") 940 921 941 newid = timeslotdao.update(t) 922 942 if newid != id: … … 985 1005 986 1006 def createtestslot(self, requser, req): 987 pass1007 return JsonResponse(RESPONSE_NOTIMPLEMENTED, "Not yet implemented") 988 1008 989 1009 def listnetcasts(self, requser, req): 990 pass1010 return JsonResponse(RESPONSE_NOTIMPLEMENTED, "Not yet implemented") 991 1011 992 1012 -
trunk/radiomate/jukebox.py
r23 r24 88 88 89 89 # spawn a new process 90 self.currentjukeslot = jukeslotclass( self.currenttimeslot, mainpassword=self.getPassword())90 self.currentjukeslot = jukeslotclass(timeslot=self.currenttimeslot, mainpassword=self.getPassword()) 91 91 92 92 self.currentjukeslot.deathtime = time.time() + self.currentjukeslot.duration*60 -
trunk/radiomate/jukeslots/base.py
r23 r24 51 51 stdin=PIPE, stdout=None, stderr=STDOUT) 52 52 53 time.sleep(1)54 53 self.logger = logging.getLogger("radiomate.jukebox") 55 54 logging.basicConfig(filename=config.LOGFILENAME, level=config.LOGGINGLEVEL) … … 86 85 raise JukeSlotException("liquidsoap instance not running (exitcode %d)" % r) 87 86 87 time.sleep(1) 88 88 self.stdin.write(liq) 89 89 self.stdin.close() -
trunk/radiomate/jukeslots/simplelive.py
r23 r24 39 39 transfunction = fun(a,b) -> sequence([fade.final(a, type="sin"), blank(duration=1.), fade.initial(b, type="sin")]) 40 40 41 livestream = input.harbor(password="%s", " live.mp3")41 livestream = input.harbor(password="%s", "%s") 42 42 43 43 fallbackplaylist = playlist(mode="normal", '%s') … … 60 60 description="%s", 61 61 radio) 62 """ % (config.LIVESTREAMPORT, self.slotparams['livepassword'], self.getFallBackPlayListName(), \ 63 self.title, config.INTERNALJUKEPORT, self.mainpassword, self.title) 62 """ % (config.LIVESTREAMPORT, self.slotparams['livepassword'], config.LIVESTREAMMOUNT,\ 63 self.getFallBackPlayListName(), self.title, config.INTERNALJUKEPORT,\ 64 self.mainpassword, self.title) 64 65 return liq 65 66 -
trunk/tests/jsontest.py
r23 r24 657 657 "description": "Some Test Tracks Transmission", 658 658 "fallbackplaylist": %d, 659 "slottype": " dummy",659 "slottype": "simplelive", 660 660 "beginningtime": { 661 661 "year": 2010, … … 667 667 "duration": 60, 668 668 "slotparams": { 669 "par1": 1, 670 "par2": 2 669 "livepassword": "buuuu" 671 670 }, 672 671 "comment": "Bad Music Show",