Merge branch '1.9.1' of dev.sourcefabric.org:airtime into 1.9.1
This commit is contained in:
commit
bf15b4cf0d
4 changed files with 18 additions and 7 deletions
|
@ -112,6 +112,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
$file_base_name = substr($file_base_name, 1);
|
$file_base_name = substr($file_base_name, 1);
|
||||||
header('Content-Disposition: attachment; filename="'.$file_base_name.'"');
|
header('Content-Disposition: attachment; filename="'.$file_base_name.'"');
|
||||||
}
|
}
|
||||||
|
$logger->info("Sending $filepath");
|
||||||
header("Content-Length: " . filesize($filepath));
|
header("Content-Length: " . filesize($filepath));
|
||||||
|
|
||||||
// !! binary mode !!
|
// !! binary mode !!
|
||||||
|
|
|
@ -751,7 +751,7 @@ class StoredFile {
|
||||||
$chunk = isset($_REQUEST["chunk"]) ? $_REQUEST["chunk"] : 0;
|
$chunk = isset($_REQUEST["chunk"]) ? $_REQUEST["chunk"] : 0;
|
||||||
$chunks = isset($_REQUEST["chunks"]) ? $_REQUEST["chunks"] : 0;
|
$chunks = isset($_REQUEST["chunks"]) ? $_REQUEST["chunks"] : 0;
|
||||||
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
|
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
|
||||||
Logging::log(__FILE__.':uploadFile(): filename='.$fileName);
|
Logging::log(__FILE__.":uploadFile(): filename=$fileName to $p_targetDir");
|
||||||
// Clean the fileName for security reasons
|
// Clean the fileName for security reasons
|
||||||
//this needs fixing for songs not in ascii.
|
//this needs fixing for songs not in ascii.
|
||||||
//$fileName = preg_replace('/[^\w\._]+/', '', $fileName);
|
//$fileName = preg_replace('/[^\w\._]+/', '', $fileName);
|
||||||
|
|
|
@ -677,7 +677,10 @@ class Airtime190Upgrade{
|
||||||
->findOne();
|
->findOne();
|
||||||
|
|
||||||
/* Handle Database Changes. */
|
/* Handle Database Changes. */
|
||||||
$stor_dir = realpath($values['general']['base_files_dir']."/stor")."/";
|
|
||||||
|
$pi = pathinfo($values['general']['base_files_dir']);
|
||||||
|
$stor_dir = $pi["dirname"].DIRECTORY_SEPARATOR.$pi["basename"].DIRECTORY_SEPARATOR."stor".DIRECTORY_SEPARATOR;
|
||||||
|
|
||||||
echo "* Inserting stor directory location $stor_dir into music_dirs table".PHP_EOL;
|
echo "* Inserting stor directory location $stor_dir into music_dirs table".PHP_EOL;
|
||||||
$propel_stor_dir->setDirectory($stor_dir);
|
$propel_stor_dir->setDirectory($stor_dir);
|
||||||
$propel_stor_dir->save();
|
$propel_stor_dir->save();
|
||||||
|
@ -763,6 +766,7 @@ exec("svc -dx /etc/service/pypo-liquidsoap/log");
|
||||||
exec("svc -dx /etc/service/recorder");
|
exec("svc -dx /etc/service/recorder");
|
||||||
exec("svc -dx /etc/service/recorder/log");
|
exec("svc -dx /etc/service/recorder/log");
|
||||||
exec("killall supervise");
|
exec("killall supervise");
|
||||||
|
exec("killall liquidsoap");
|
||||||
|
|
||||||
$pathnames = array("/usr/bin/airtime-pypo-start",
|
$pathnames = array("/usr/bin/airtime-pypo-start",
|
||||||
"/usr/bin/airtime-pypo-stop",
|
"/usr/bin/airtime-pypo-stop",
|
||||||
|
@ -819,6 +823,7 @@ AirtimeInstall::SetUniqueId();
|
||||||
AirtimeInstall::SetImportTimestamp();
|
AirtimeInstall::SetImportTimestamp();
|
||||||
|
|
||||||
AirtimeIni::CreateMonitFile();
|
AirtimeIni::CreateMonitFile();
|
||||||
|
exec("/etc/init.d/monit start");
|
||||||
|
|
||||||
AirtimeInstall::CreateSymlinksToUtils();
|
AirtimeInstall::CreateSymlinksToUtils();
|
||||||
|
|
||||||
|
|
|
@ -40,11 +40,14 @@ def to_unicode(obj, encoding='utf-8'):
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
def encode_to(obj, encoding='utf-8'):
|
def encode_to(obj, encoding='utf-8'):
|
||||||
if isinstance(obj, basestring):
|
if isinstance(obj, unicode):
|
||||||
if not isinstance(obj, str):
|
|
||||||
obj = obj.encode(encoding)
|
obj = obj.encode(encoding)
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
def convert_dict_value_to_utf8(md):
|
||||||
|
#list comprehension to convert all values of md to utf-8
|
||||||
|
return dict([(item[0], encode_to(item[1], "utf-8")) for item in md.items()])
|
||||||
|
|
||||||
class ApiClientInterface:
|
class ApiClientInterface:
|
||||||
|
|
||||||
# Implementation: optional
|
# Implementation: optional
|
||||||
|
@ -409,6 +412,8 @@ class AirTimeApiClient(ApiClientInterface):
|
||||||
url = url.replace("%%api_key%%", self.config["api_key"])
|
url = url.replace("%%api_key%%", self.config["api_key"])
|
||||||
url = url.replace("%%mode%%", mode)
|
url = url.replace("%%mode%%", mode)
|
||||||
|
|
||||||
|
md = convert_dict_value_to_utf8(md)
|
||||||
|
|
||||||
data = urllib.urlencode(md)
|
data = urllib.urlencode(md)
|
||||||
req = urllib2.Request(url, data)
|
req = urllib2.Request(url, data)
|
||||||
|
|
||||||
|
@ -434,7 +439,7 @@ class AirTimeApiClient(ApiClientInterface):
|
||||||
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
response = None
|
response = None
|
||||||
logger.error("Exception with filepath %s: %s", md['MDATA_KEY_FILEPATH'], e)
|
logger.error("Exception with file %s: %s", md, e)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue