CC-2607: Ability to adjust stream bitrate, type, etc from UI interface
- created table cc_stream_setting and it's initial entries - pypo installation will generate liquidsoap.cfg on install time based on information on cc_stream_setting table
This commit is contained in:
parent
1c81d0d238
commit
13285fdd63
16 changed files with 1952 additions and 3 deletions
|
@ -45,7 +45,6 @@ remove_watched_dir = 'remove-watched-dir/format/json/api_key/%%api_key%%/path/%%
|
|||
# URL to tell Airtime we want to add watched directory
|
||||
set_storage_dir = 'set-storage-dir/format/json/api_key/%%api_key%%/path/%%path%%'
|
||||
|
||||
|
||||
#############################
|
||||
## Config for Recorder
|
||||
#############################
|
||||
|
@ -87,6 +86,8 @@ update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/med
|
|||
# ???
|
||||
generate_range_url = 'generate_range_dp.php'
|
||||
|
||||
# URL to tell Airtime we want to get stream setting
|
||||
get_stream_setting = 'get-stream-setting/format/json/api_key/%%api_key%%/'
|
||||
|
||||
##############
|
||||
# OBP config #
|
||||
|
|
|
@ -21,7 +21,7 @@ from urlparse import urlparse
|
|||
import base64
|
||||
from configobj import ConfigObj
|
||||
|
||||
AIRTIME_VERSION = "1.9.0-devel"
|
||||
AIRTIME_VERSION = "1.9.0"
|
||||
|
||||
def api_client_factory(config):
|
||||
logger = logging.getLogger()
|
||||
|
@ -526,6 +526,21 @@ class AirTimeApiClient(ApiClientInterface):
|
|||
logger.error("Exception: %s", e)
|
||||
|
||||
return response
|
||||
|
||||
def get_stream_setting(self):
|
||||
#logger = logging.getLogger()
|
||||
try:
|
||||
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["get_stream_setting"])
|
||||
|
||||
url = url.replace("%%api_key%%", self.config["api_key"])
|
||||
req = urllib2.Request(url)
|
||||
response = urllib2.urlopen(req).read()
|
||||
response = json.loads(response)
|
||||
except Exception, e:
|
||||
response = None
|
||||
#logger.error("Exception: %s", e)
|
||||
|
||||
return response
|
||||
|
||||
################################################################################
|
||||
# OpenBroadcast API Client
|
||||
|
|
|
@ -9,6 +9,8 @@ import shutil
|
|||
import platform
|
||||
from configobj import ConfigObj
|
||||
from subprocess import Popen
|
||||
sys.path.append('/usr/lib/airtime/api_clients/')
|
||||
import api_client
|
||||
|
||||
if os.geteuid() != 0:
|
||||
print "Please run this as root."
|
||||
|
@ -111,6 +113,27 @@ try:
|
|||
|
||||
p = Popen("update-rc.d airtime-playout defaults >/dev/null 2>&1", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
|
||||
#we should access the DB and generate liquidsoap.cfg under etc/airtime/
|
||||
api_client = api_client.api_client_factory(config)
|
||||
ss = api_client.get_stream_setting()
|
||||
data = ss['msg']
|
||||
fh = open('/etc/airtime/liquidsoap.cfg', 'w')
|
||||
for d in data:
|
||||
buffer = d[u'keyname'] + " = "
|
||||
if(d[u'type'] == 'string'):
|
||||
temp = d[u'value']
|
||||
if(temp == ""):
|
||||
temp = "dummy_string"
|
||||
buffer += "\"" + temp + "\""
|
||||
else:
|
||||
temp = d[u'value']
|
||||
if(temp == ""):
|
||||
temp = "0"
|
||||
buffer += temp
|
||||
buffer += "\n"
|
||||
fh.write(buffer)
|
||||
fh.close()
|
||||
|
||||
print "Waiting for processes to start..."
|
||||
p = Popen("/etc/init.d/airtime-playout start", shell=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue