Example #1
0
def compile_static_language_files():
	global translations

	buildtools.create_baked_directory()

	for locale, translation in translations.iteritems():
			f = codecs.open(os.path.join(os.path.dirname(__file__), "../static/baked/", str(buildtools.get_build_number()), locale + ".js"), "w", encoding="utf-8")
			f.write(u'\u4500')
			f.seek(0)
			f.write("var LOCALE = \"" + locale + "\"; var lang = " + (json.dumps(translation.dict, ensure_ascii=False, encoding="utf-8", separators=(',',':'))) + ";")
			f.close()
Example #2
0
def compile_static_language_files():
	global translations

	buildtools.create_baked_directory()

	for locale, translation in translations.iteritems():
			f = codecs.open(os.path.join(os.path.dirname(__file__), "../static/baked/", str(buildtools.get_build_number()), locale + ".js"), "w", encoding="utf-8")
			f.write(u'\u4500')
			f.seek(0)
			f.write("var LOCALE = \"" + locale + "\"; var lang = " + (json.dumps(translation.dict, ensure_ascii=False, encoding="utf-8", separators=(',',':'))) + ";")
			f.close()
Example #3
0
def load(file = None, testmode = False):
	global _opts
	global test_mode
	
	if not file:
		file = get_config_file(testmode)
	
	config_file = open(file)
	_opts = json.load(config_file)
	config_file.close()
	
	stations = _opts.pop('stations')
	_opts['stations'] = {}
	for key in stations.keys():
		_opts['stations'][int(key)] = stations[key]
	
	require('stations')
	set_station_ids(get("song_dirs"), get("station_id_friendly"))
	if get("test_mode") == True:
		test_mode = True
		
	_opts["revision_number"] = buildtools.get_build_number()
Example #4
0
def load(file=None, testmode=False):
    global _opts
    global test_mode

    if not file:
        file = get_config_file(testmode)

    config_file = open(file)
    _opts = json.load(config_file)
    config_file.close()

    stations = _opts.pop('stations')
    _opts['stations'] = {}
    for key in stations.keys():
        _opts['stations'][int(key)] = stations[key]

    require('stations')
    set_station_ids(get("song_dirs"), get("station_id_friendly"))
    if get("test_mode") == True:
        test_mode = True

    _opts["revision_number"] = buildtools.get_build_number()
Example #5
0
shutil.copytree("api", installdir + "/api", ignore=shutil.ignore_patterns("*.pyc"))
shutil.copytree("api_requests", installdir + "/api_requests", ignore=shutil.ignore_patterns("*.pyc"))
shutil.copytree("backend", installdir + "/backend", ignore=shutil.ignore_patterns("*.pyc"))
shutil.copytree("lang", installdir + "/lang")
shutil.copytree("libs", installdir + "/libs", ignore=shutil.ignore_patterns("*.pyc"))
shutil.copytree("rainwave", installdir + "/rainwave", ignore=shutil.ignore_patterns("*.pyc"))
shutil.copytree("etc", installdir + "/etc")
shutil.copytree("static", installdir + "/static")
shutil.copytree("templates", installdir + "/templates")

shutil.copy("rw_api.py", installdir + "/rw_api.py")
shutil.copy("rw_backend.py", installdir + "/rw_backend.py")
shutil.copy("rw_scanner.py", installdir + "/rw_scanner.py")
shutil.copy("rw_clear_cache.py", installdir + "/rw_clear_cache.py")
shutil.copy("rw_get_next.py", installdir + "/rw_get_next.py")
shutil.copy("rw_icecast_sync.py", installdir + "/rw_icecast_sync.py")
shutil.copy("tagset.py", installdir + "/tagset.py")

shutil.copy("initscript", "/etc/init.d/rainwave")
shutil.copy("rw_get_next.py", "/usr/local/bin/rw_get_next.py")

os.makedirs(os.path.join(installdir, "static", "baked", str(buildtools.get_build_number()) ))

subprocess.call(["chown", "-R", "%s:%s" % (user, group), installdir ])

print "Rainwave installed to /opt/rainwave."

if os.path.exists("/etc/init.d/rainwave"):
	subprocess.check_call([ "/etc/init.d/rainwave", "start" ])
Example #6
0
def load(file=None, testmode=False):
    global _opts
    global test_mode
    global build_number
    global public_relays
    global public_relays_json
    global station_ids
    global station_list_json
    global station_hostnames
    global station_mount_filenames

    if not file:
        file = get_config_file(testmode)

    config_file = open(file)
    _opts = json.load(config_file)
    config_file.close()

    stations = _opts.pop('stations')
    _opts['stations'] = {}
    for key in stations.keys():
        _opts['stations'][int(key)] = stations[key]

    require('stations')
    set_station_ids(get("song_dirs"), get("station_id_friendly"))
    if get("test_mode") == True:
        test_mode = True

    public_relays = {}
    for sid in station_ids:
        public_relays[sid] = []
        public_relays[sid].append({
            "name":
            "Random",
            "protocol":
            "http://",
            "hostname":
            get_station(sid, "round_robin_relay_host"),
            "port":
            get_station(sid, "round_robin_relay_port"),
            #"url": "http://%s:%s" % (get_station(sid, "round_robin_relay_host"), get_station(sid, "round_robin_relay_port"))
        })
        for relay_name, relay in get("relays").iteritems():
            if sid in relay['sids']:
                public_relays[sid].append({
                    "name": relay_name,
                    "protocol": relay['protocol'],
                    "hostname": relay['hostname'],
                    "port": relay['port'],
                    #'url': "http://%s:%s" % (relay['hostname'], relay['port'])
                })
        public_relays_json[sid] = tornado.escape.json_encode(
            public_relays[sid])
        station_hostnames[get_station(sid, "host")] = sid
        station_mount_filenames[sid] = get_station(sid, "stream_filename")

    station_list = {}
    for station_id in station_ids:
        station_list[station_id] = {
            "id": station_id,
            "name": station_id_friendly[station_id],
            "url": "http://%s" % get_station(station_id, "host")
        }
        station_mounts[get_station(station_id, "stream_filename") +
                       ".mp3"] = station_id
        station_mounts[get_station(station_id, "stream_filename") +
                       ".ogg"] = station_id
    station_list_json = tornado.escape.json_encode(station_list)

    build_number = buildtools.get_build_number()
Example #7
0
def load(file = None, testmode = False):
	global _opts
	global test_mode
	global build_number
	global public_relays
	global public_relays_json
	global station_ids
	global station_list_json
	global station_hostnames
	global station_mount_filenames

	if not file:
		file = get_config_file(testmode)
	
	config_file = open(file)
	_opts = json.load(config_file)
	config_file.close()
	
	stations = _opts.pop('stations')
	_opts['stations'] = {}
	for key in stations.keys():
		_opts['stations'][int(key)] = stations[key]
	
	require('stations')
	set_station_ids(get("song_dirs"), get("station_id_friendly"))
	if get("test_mode") == True:
		test_mode = True

	public_relays = {}
	for sid in station_ids:
		public_relays[sid] = []
		public_relays[sid].append({
			"name": "Random",
			"protocol": "http://",
			"hostname": get_station(sid, "round_robin_relay_host"),
			"port": get_station(sid, "round_robin_relay_port"),
			#"url": "http://%s:%s" % (get_station(sid, "round_robin_relay_host"), get_station(sid, "round_robin_relay_port"))
		})
		for relay_name, relay in get("relays").iteritems():
			if sid in relay['sids']:
				public_relays[sid].append({
					"name": relay_name, 
					"protocol": relay['protocol'], 
					"hostname": relay['hostname'], 
					"port": relay['port'], 
					#'url': "http://%s:%s" % (relay['hostname'], relay['port'])
				})
		public_relays_json[sid] = tornado.escape.json_encode(public_relays[sid])
		station_hostnames[get_station(sid, "host")] = sid
		station_mount_filenames[sid] = get_station(sid, "stream_filename")

	station_list = {}
	for station_id in station_ids:
		station_list[station_id] = {
			"id": station_id,
			"name": station_id_friendly[station_id],
			"url": "http://%s" % get_station(station_id, "host")
		}
		station_mounts[get_station(station_id, "stream_filename") + ".mp3"] = station_id
		station_mounts[get_station(station_id, "stream_filename") + ".ogg"] = station_id
	station_list_json = tornado.escape.json_encode(station_list)

	build_number = buildtools.get_build_number()