CC-3224: "On-the-fly" stream rebroadcasting

- web interface
- auth script for liquidsoap
- DB changes
This commit is contained in:
James 2012-02-21 17:58:05 -05:00
parent 701ed82f40
commit 48bb19d758
26 changed files with 650 additions and 101 deletions

View file

@ -101,3 +101,26 @@ get_stream_setting = 'get-stream-setting/format/json/api_key/%%api_key%%/'
#URL to update liquidsoap status
update_liquidsoap_status = 'update-liquidsoap-status/format/json/api_key/%%api_key%%/msg/%%msg%%/stream_id/%%stream_id%%/boot_time/%%boot_time%%'
#URL to checkl live stream auth
check_live_stream_auth = 'check-live-stream-auth/format/json/api_key/%%api_key%%/username/%%username%%/password/%%password%%'
##############
# OBP config #
##############
# URL to get the version number of the server API
#version_url = 'api/pypo/status/json'
# Schedule export path.
# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm
# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm
# Update whether an item has been played.
#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%'
# Update whether an item is currently playing.
#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%'
# ???
#generate_range_url = 'api/pypo/generate_range_dp/'

View file

@ -21,6 +21,7 @@ from urlparse import urlparse
import base64
from configobj import ConfigObj
import string
import hashlib
AIRTIME_VERSION = "2.1.0"
@ -363,6 +364,28 @@ class AirTimeApiClient(ApiClientInterface):
time.sleep(retries_wait)
return response
def check_live_stream_auth(self, username, password):
#logger = logging.getLogger()
response = ''
try:
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["check_live_stream_auth"])
url = url.replace("%%api_key%%", self.config["api_key"])
url = url.replace("%%username%%", username)
url = url.replace("%%password%%", hashlib.md5(password).hexdigest())
req = urllib2.Request(url)
response = urllib2.urlopen(req).read()
response = json.loads(response)
except Exception, e:
import traceback
top = traceback.format_exc()
print "Exception: %s", e
print "traceback: %s", top
response = None
return response
def setup_media_monitor(self):
logger = self.logger