Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
b692abb9ae
|
@ -50,7 +50,7 @@ class WebstreamController extends Zend_Controller_Action
|
|||
//clear the session in case an old playlist was open: CC-4196
|
||||
Application_Model_Library::changePlaylist(null, null);
|
||||
|
||||
$this->view->obj = new Application_Model_Webstream($webstream);
|
||||
$this->view->obj = new Application_Model_Webstream($webstream->getDbId());
|
||||
$this->view->action = "new";
|
||||
$this->view->html = $this->view->render('webstream/webstream.phtml');
|
||||
}
|
||||
|
|
|
@ -64,7 +64,8 @@ class Logging {
|
|||
$function = $caller['function'];
|
||||
|
||||
$logger = self::getLogger();
|
||||
$logger->info("[$file : $function() : line $line] [WARN] - ".self::toString($p_msg));
|
||||
$logger->warn("[$file : $function() : line $line] - "
|
||||
. self::toString($p_msg));
|
||||
}
|
||||
|
||||
public static function debug($p_msg)
|
||||
|
|
|
@ -73,13 +73,12 @@ class Application_Model_Datatables
|
|||
$orig2searchTerm[$index] = $d;
|
||||
}
|
||||
}
|
||||
// map that maps current column position to original position
|
||||
$current2orig = $librarySetting['ColReorder'];
|
||||
|
||||
// map that maps dbname to searchTerm
|
||||
$dbname2searchTerm = array();
|
||||
foreach ($current2dbname as $currentPos=>$dbname) {
|
||||
$dbname2searchTerm[$dbname] = $orig2searchTerm[$current2orig[$currentPos]];
|
||||
$dbname2searchTerm[$dbname] =
|
||||
$orig2searchTerm[$librarySetting($currentPos)];
|
||||
}
|
||||
|
||||
$where = array();
|
||||
|
@ -193,12 +192,8 @@ class Application_Model_Datatables
|
|||
$r['length'] = $pl->getLength();
|
||||
} elseif ($r['ftype'] == "block") {
|
||||
$bl = new Application_Model_Block($r['id']);
|
||||
if ($bl->isStatic()) {
|
||||
$r['bl_type'] = 'static';
|
||||
} else {
|
||||
$r['bl_type'] = 'dynamic';
|
||||
}
|
||||
$r['length'] = $bl->getLength();
|
||||
$r['bl_type'] = $bl->isStatic() ? 'static' : 'dynamic';
|
||||
$r['length'] = $bl->getLength();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -226,11 +226,7 @@ class Application_Model_Preference
|
|||
public static function GetDefaultTransitionFade()
|
||||
{
|
||||
$transition_fade = self::getValue("default_transition_fade");
|
||||
if ($transition_fade == "") {
|
||||
$transition_fade = "00.000000";
|
||||
}
|
||||
|
||||
return $transition_fade;
|
||||
return ($transition_fade == "") ? "00.000000" : $transition_fade;
|
||||
}
|
||||
|
||||
public static function SetStreamLabelFormat($type)
|
||||
|
@ -332,11 +328,7 @@ class Application_Model_Preference
|
|||
public static function GetAllow3rdPartyApi()
|
||||
{
|
||||
$val = self::getValue("third_party_api");
|
||||
if (strlen($val) == 0) {
|
||||
return "0";
|
||||
} else {
|
||||
return $val;
|
||||
}
|
||||
return (strlen($val) == 0 ) ? "0" : $val;
|
||||
}
|
||||
|
||||
public static function SetPhone($phone)
|
||||
|
@ -447,6 +439,8 @@ class Application_Model_Preference
|
|||
$image = @file_get_contents($imagePath);
|
||||
$image = base64_encode($image);
|
||||
self::setValue("logoImage", $image);
|
||||
} else {
|
||||
Logging::warn("Attempting to set imagePath to empty string");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -786,11 +780,7 @@ class Application_Model_Preference
|
|||
public static function GetWeekStartDay()
|
||||
{
|
||||
$val = self::getValue("week_start_day");
|
||||
if (strlen($val) == 0) {
|
||||
return "0";
|
||||
} else {
|
||||
return $val;
|
||||
}
|
||||
return (strlen($val) == 0) ? "0" : $val;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -808,11 +798,7 @@ class Application_Model_Preference
|
|||
public static function GetStreamUpdateTimestemp()
|
||||
{
|
||||
$update_time = self::getValue("stream_update_timestamp");
|
||||
if ($update_time == null) {
|
||||
$update_time = 0;
|
||||
}
|
||||
|
||||
return $update_time;
|
||||
return ($update_time == null) ? 0 : $update_time;
|
||||
}
|
||||
|
||||
public static function GetClientId()
|
||||
|
@ -824,6 +810,8 @@ class Application_Model_Preference
|
|||
{
|
||||
if (is_numeric($id)) {
|
||||
self::setValue("client_id", $id);
|
||||
} else {
|
||||
Logging::warn("Attempting to set client_id to invalid value: $id");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -894,11 +882,7 @@ class Application_Model_Preference
|
|||
public static function GetCalendarTimeInterval()
|
||||
{
|
||||
$val = self::getValue("calendar_time_interval", true /* user specific */);
|
||||
if (strlen($val) == 0) {
|
||||
$val = "30";
|
||||
}
|
||||
|
||||
return $val;
|
||||
return (strlen($val) == 0) ? "30" : $val;
|
||||
}
|
||||
|
||||
public static function SetDiskQuota($value)
|
||||
|
@ -909,11 +893,7 @@ class Application_Model_Preference
|
|||
public static function GetDiskQuota()
|
||||
{
|
||||
$val = self::getValue("disk_quota");
|
||||
if (strlen($val) == 0) {
|
||||
$val = "0";
|
||||
}
|
||||
|
||||
return $val;
|
||||
return (strlen($val) == 0) ? 0 : $val;
|
||||
}
|
||||
|
||||
public static function SetLiveSteamMasterUsername($value)
|
||||
|
@ -944,11 +924,7 @@ class Application_Model_Preference
|
|||
public static function GetSourceStatus($sourcename)
|
||||
{
|
||||
$value = self::getValue($sourcename);
|
||||
if ($value == null || $value == "false") {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return !($value == null || $value == "false");
|
||||
}
|
||||
|
||||
public static function SetSourceSwitchStatus($sourcename, $status)
|
||||
|
@ -959,11 +935,7 @@ class Application_Model_Preference
|
|||
public static function GetSourceSwitchStatus($sourcename)
|
||||
{
|
||||
$value = self::getValue($sourcename."_switch");
|
||||
if ($value == null || $value == "off") {
|
||||
return "off";
|
||||
} else {
|
||||
return "on";
|
||||
}
|
||||
return ($value == null || $value == "off") ? 'off' : 'on';
|
||||
}
|
||||
|
||||
public static function SetMasterDJSourceConnectionURL($value)
|
||||
|
@ -1036,12 +1008,7 @@ class Application_Model_Preference
|
|||
public static function GetEnableSystemEmail()
|
||||
{
|
||||
$v = self::getValue("enable_system_email");
|
||||
|
||||
if ($v === "") {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return $v;
|
||||
return ($v === "") ? 0 : $v;
|
||||
}
|
||||
|
||||
public static function SetSystemEmail($value)
|
||||
|
@ -1130,6 +1097,13 @@ class Application_Model_Preference
|
|||
|
||||
public static function getCurrentLibraryTableSetting()
|
||||
{
|
||||
return unserialize(self::getValue("library_datatable"));
|
||||
$v = self::getValue("library_datatable");
|
||||
if( $v === '' ) {
|
||||
return function ($x) { return $x; };
|
||||
} else {
|
||||
$ds = unserialize($v);
|
||||
return function ($x) use ($ds) { return $ds['ColReorder'][$x]; } ;
|
||||
}
|
||||
//return unserialize(self::getValue("library_datatable"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,12 +26,11 @@ class Application_Model_RabbitMq
|
|||
$channel->access_request($CC_CONFIG["rabbitmq"]["vhost"], false, false,
|
||||
true, true);
|
||||
|
||||
$EXCHANGE = 'airtime-pypo';
|
||||
$channel->exchange_declare($EXCHANGE, 'direct', false, true);
|
||||
$channel->exchange_declare($exchange, 'direct', false, true);
|
||||
|
||||
$msg = new AMQPMessage($data, array('content_type' => 'text/plain'));
|
||||
|
||||
$channel->basic_publish($msg, $EXCHANGE);
|
||||
$channel->basic_publish($msg, $exchange);
|
||||
$channel->close();
|
||||
$conn->close();
|
||||
}
|
||||
|
|
|
@ -410,7 +410,9 @@ class Application_Model_StoredFile
|
|||
return "mp3";
|
||||
} elseif ($mime == "audio/x-flac") {
|
||||
return "flac";
|
||||
} else {
|
||||
} elseif ($mime == "audio/mp4") {
|
||||
return "mp4";
|
||||
} else {
|
||||
throw new Exception("Unknown $mime");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
|
||||
class Common {
|
||||
|
||||
public static function setTimeInSub($row, $col, $time)
|
||||
{
|
||||
$class = get_class($row).'Peer';
|
||||
|
||||
$con = Propel::getConnection($class::DATABASE_NAME);
|
||||
|
||||
$sql = 'UPDATE '.$class::TABLE_NAME
|
||||
. ' SET '.$col.' = :f1'
|
||||
. ' WHERE ' .$class::ID. ' = :p1';
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':f1', $time);
|
||||
$stmt->bindValue(':p1', $row->getDbId());
|
||||
$stmt->execute();
|
||||
}
|
||||
}
|
|
@ -63,6 +63,10 @@ try {
|
|||
}
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
echo "<pre>";
|
||||
echo $e->getTraceAsString();
|
||||
echo "</pre>";
|
||||
Logging::info($e->getMessage());
|
||||
Logging::info($e->getTraceAsString());
|
||||
}
|
||||
|
||||
|
|
|
@ -1115,12 +1115,13 @@ var validationTypes = {
|
|||
"mood" : "s",
|
||||
"name" : "s",
|
||||
"orchestra" : "s",
|
||||
"owner_id" : "i",
|
||||
"owner" : "s",
|
||||
"rating" : "i",
|
||||
"replay_gain" : "n",
|
||||
"sample_rate" : "i",
|
||||
"track_title" : "s",
|
||||
"track_number" : "i",
|
||||
"info_url" : "s",
|
||||
"year" : "i"
|
||||
"year" : "i",
|
||||
"lptime" : "t"
|
||||
};
|
||||
|
|
|
@ -113,7 +113,7 @@ CREATE TABLE cc_webstream_metadata (
|
|||
ALTER TABLE cc_files
|
||||
DROP COLUMN gunid,
|
||||
ADD COLUMN replay_gain character varying(16),
|
||||
ADD COLUMN owner_id integer;
|
||||
ADD COLUMN owner_id integer,
|
||||
ALTER COLUMN bpm TYPE integer using airtime_to_int(bpm) /* TYPE change - table: cc_files original: character varying(8) new: integer */;
|
||||
|
||||
ALTER TABLE cc_playlistcontents
|
||||
|
|
|
@ -54,6 +54,8 @@ class AirtimeNotifier(Loggable):
|
|||
message.ack()
|
||||
self.logger.info("Received md from RabbitMQ: %s" % str(body))
|
||||
m = json.loads(message.body)
|
||||
# TODO : normalize any other keys that could be used to pass
|
||||
# directories
|
||||
if 'directory' in m: m['directory'] = normpath(m['directory'])
|
||||
self.handler.message(m)
|
||||
|
||||
|
@ -121,7 +123,6 @@ class AirtimeMessageReceiver(Loggable):
|
|||
% md_path, e)
|
||||
|
||||
def new_watch(self, msg, restart=False):
|
||||
msg['directory'] = normpath(msg['directory'])
|
||||
self.logger.info("Creating watch for directory: '%s'" %
|
||||
msg['directory'])
|
||||
if not os.path.exists(msg['directory']):
|
||||
|
@ -134,14 +135,14 @@ class AirtimeMessageReceiver(Loggable):
|
|||
msg['directory'])
|
||||
self.new_watch(msg)
|
||||
else:
|
||||
self.__request_now_bootstrap( directory=msg['directory'],
|
||||
self.__reFalsequest_now_bootstrap( directory=msg['directory'],
|
||||
all_files=restart)
|
||||
self.manager.add_watch_directory(msg['directory'])
|
||||
|
||||
def remove_watch(self, msg):
|
||||
self.logger.info("Removing watch from directory: '%s'" %
|
||||
msg['directory'])
|
||||
self.manager.remove_watch_directory(normpath(msg['directory']))
|
||||
self.manager.remove_watch_directory(msg['directory'])
|
||||
|
||||
def rescan_watch(self, msg):
|
||||
self.logger.info("Trying to rescan watched directory: '%s'" %
|
||||
|
@ -174,6 +175,8 @@ class AirtimeMessageReceiver(Loggable):
|
|||
Out of curiousity we will print some details.")
|
||||
self.logger.info(msg)
|
||||
return
|
||||
# TODO : Add validation that we are deleting a file that's under our
|
||||
# surveillance. We don't to delete some random system file.
|
||||
if os.path.exists(msg['filepath']):
|
||||
try:
|
||||
self.logger.info("Attempting to delete '%s'" %
|
||||
|
|
|
@ -113,7 +113,7 @@ def main(global_config, api_client_config, log_config,
|
|||
log.error("Could not create watch directory: '%s' \
|
||||
(given from the database)." % watch_dir)
|
||||
if os.path.exists(watch_dir):
|
||||
airtime_receiver.new_watch({ 'directory':watch_dir })
|
||||
airtime_receiver.new_watch({ 'directory':watch_dir }, restart=True)
|
||||
|
||||
bs = Bootstrapper( db=sdb, watch_signal='watch' )
|
||||
|
||||
|
|
Loading…
Reference in New Issue