CC-4369: Remove upgrade scripts from versions we no longer support

-removed files
This commit is contained in:
Martin Konecny 2012-09-07 00:10:10 -04:00
parent 18f310d28b
commit 8b37e50bd6
382 changed files with 0 additions and 138299 deletions

View File

@ -1,56 +0,0 @@
<?php
/**
* @package Airtime
* @subpackage StorageServer
* @copyright 2010 Sourcefabric O.P.S.
* @license http://www.gnu.org/licenses/gpl.txt
*/
require_once(dirname(__FILE__).'/../../include/AirtimeIni.php');
require_once(dirname(__FILE__).'/../../include/AirtimeInstall.php');
/**
* This function creates the /etc/airtime configuration folder
* and copies the default config files to it.
*/
function CreateIniFiles()
{
global $AIRTIME_PYTHON_APPS;
if (!file_exists("/etc/airtime/")){
if (!mkdir("/etc/airtime/", 0755, true)){
echo "Could not create /etc/airtime/ directory. Exiting.";
exit(1);
}
}
if (!copy("airtime.conf.170", CONF_FILE_AIRTIME)){
echo "Could not copy airtime.conf to /etc/airtime/. Exiting.";
exit(1);
}
if (!copy($AIRTIME_PYTHON_APPS."/pypo/pypo.cfg", CONF_FILE_PYPO)){
echo "Could not copy pypo.cfg to /etc/airtime/. Exiting.";
exit(1);
}
if (!copy($AIRTIME_PYTHON_APPS."/show-recorder/recorder.cfg", CONF_FILE_RECORDER)){
echo "Could not copy recorder.cfg to /etc/airtime/. Exiting.";
exit(1);
}
if (!copy($AIRTIME_PYTHON_APPS."/pypo/liquidsoap_scripts/liquidsoap.cfg", CONF_FILE_LIQUIDSOAP)){
echo "Could not copy liquidsoap.cfg to /etc/airtime/. Exiting.";
exit(1);
}
}
CreateIniFiles();
AirtimeIni::UpdateIniFiles();
echo PHP_EOL."*** Updating Database Tables ***".PHP_EOL;
AirtimeInstall::MigrateTablesToVersion(__DIR__, '20110402164819');
echo PHP_EOL."*** Updating Pypo ***".PHP_EOL;
system("python ".__DIR__."/../../../python_apps/pypo/install/pypo-install.py");
echo PHP_EOL."*** Recorder Installation ***".PHP_EOL;
system("python ".__DIR__."/../../../python_apps/show-recorder/install/recorder-install.py");

View File

@ -1,22 +0,0 @@
[database]
host = localhost
dbname = airtime
dbuser = airtime
dbpass = airtime
[rabbitmq]
host = 127.0.0.1
port = 5672
user = guest
password = guest
vhost = /
[general]
api_key = AAA
web_server_user = www-data
airtime_dir = x
base_files_dir = x
[soundcloud]
connection_retries = 3
time_between_retries = 60

View File

@ -1,269 +0,0 @@
<?php
/**
* @package Airtime
* @subpackage StorageServer
* @copyright 2010 Sourcefabric O.P.S.
* @license http://www.gnu.org/licenses/gpl.txt
*/
set_include_path(__DIR__.'/../../../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
require_once(dirname(__FILE__).'/../../include/AirtimeInstall.php');
global $CC_CONFIG;
function load_airtime_config(){
$ini_array = parse_ini_file('/etc/airtime/airtime.conf', true);
return $ini_array;
}
$values = load_airtime_config();
$CC_CONFIG = array(
// Name of the web server user
'webServerUser' => $values['general']['web_server_user'],
'rabbitmq' => $values['rabbitmq'],
'baseFilesDir' => $values['general']['base_files_dir'],
// main directory for storing binary media files
'storageDir' => $values['general']['base_files_dir']."/stor",
// Database config
'dsn' => array(
'username' => $values['database']['dbuser'],
'password' => $values['database']['dbpass'],
'hostspec' => $values['database']['host'],
'phptype' => 'pgsql',
'database' => $values['database']['dbname']),
// prefix for table names in the database
'tblNamePrefix' => 'cc_',
/* ================================================ storage configuration */
'apiKey' => array($values['general']['api_key']),
'apiPath' => '/api/',
'soundcloud-client-id' => '2CLCxcSXYzx7QhhPVHN4A',
'soundcloud-client-secret' => 'pZ7beWmF06epXLHVUP1ufOg2oEnIt9XhE8l8xt0bBs',
'soundcloud-connection-retries' => $values['soundcloud']['connection_retries'],
'soundcloud-connection-wait' => $values['soundcloud']['time_between_retries'],
"rootDir" => __DIR__."/../.."
);
AirtimeInstall::DbConnect(true);
$con = Propel::getConnection();
echo PHP_EOL."*** Updating Database Tables ***".PHP_EOL;
if(AirtimeInstall::DbTableExists('doctrine_migration_versions') === false) {
$migrations = array('20110312121200', '20110331111708', '20110402164819');
foreach($migrations as $migration) {
AirtimeInstall::BypassMigrations(__DIR__, $migration);
}
}
AirtimeInstall::MigrateTablesToVersion(__DIR__, '20110406182005');
//setting data for new aggregate show length column.
$sql = "SELECT id FROM cc_show_instances";
$show_instances = $con->query($sql)->fetchAll();
foreach ($show_instances as $show_instance) {
$sql = "UPDATE cc_show_instances SET time_filled = (SELECT SUM(clip_length) FROM cc_schedule WHERE instance_id = {$show_instance["id"]}) WHERE id = {$show_instance["id"]}";
$con->exec($sql);
}
//end setting data for new aggregate show length column.
exec("rm -fr /opt/pypo");
exec("rm -fr /opt/recorder");
const CONF_FILE_AIRTIME = "/etc/airtime/airtime.conf";
const CONF_FILE_PYPO = "/etc/airtime/pypo.cfg";
const CONF_FILE_RECORDER = "/etc/airtime/recorder.cfg";
const CONF_FILE_LIQUIDSOAP = "/etc/airtime/liquidsoap.cfg";
$configFiles = array(CONF_FILE_AIRTIME,
CONF_FILE_PYPO,
CONF_FILE_RECORDER,
CONF_FILE_LIQUIDSOAP);
/**
* This function creates the /etc/airtime configuration folder
* and copies the default config files to it.
*/
function CreateIniFiles($suffix)
{
if (!file_exists("/etc/airtime/")){
if (!mkdir("/etc/airtime/", 0755, true)){
echo "Could not create /etc/airtime/ directory. Exiting.";
exit(1);
}
}
if (!copy(__DIR__."/airtime.conf.$suffix", CONF_FILE_AIRTIME)){
echo "Could not copy airtime.conf.$suffix to /etc/airtime/. Exiting.";
exit(1);
}
if (!copy(__DIR__."/pypo.cfg.$suffix", CONF_FILE_PYPO)){
echo "Could not copy pypo.cfg.$suffix to /etc/airtime/. Exiting.";
exit(1);
}
if (!copy(__DIR__."/recorder.cfg.$suffix", CONF_FILE_RECORDER)){
echo "Could not copy recorder.cfg.$suffix to /etc/airtime/. Exiting.";
exit(1);
}
if (!copy(__DIR__."/liquidsoap.cfg.$suffix", CONF_FILE_LIQUIDSOAP)){
echo "Could not copy liquidsoap.cfg.$suffix to /etc/airtime/. Exiting.";
exit(1);
}
}
function ReadPythonConfig($p_filename)
{
$values = array();
$lines = file($p_filename);
$n=count($lines);
for ($i=0; $i<$n; $i++) {
if (strlen($lines[$i]) && !in_array(substr($lines[$i], 0, 1), array('#', PHP_EOL))){
$info = explode("=", $lines[$i]);
$values[trim($info[0])] = trim($info[1]);
}
}
return $values;
}
function UpdateIniValue($p_filename, $p_property, $p_value)
{
$lines = file($p_filename);
$n=count($lines);
foreach ($lines as &$line) {
if ($line[0] != "#"){
$key_value = split("=", $line);
$key = trim($key_value[0]);
if ($key == $p_property){
$line = "$p_property = $p_value".PHP_EOL;
}
}
}
$fp=fopen($p_filename, 'w');
for($i=0; $i<$n; $i++){
fwrite($fp, $lines[$i]);
}
fclose($fp);
}
function MergeConfigFiles($configFiles, $suffix)
{
foreach ($configFiles as $conf) {
if (file_exists("$conf$suffix.bak")) {
if($conf === CONF_FILE_AIRTIME) {
// Parse with sections
$newSettings = parse_ini_file($conf, true);
$oldSettings = parse_ini_file("$conf$suffix.bak", true);
$oldSettings['general']['airtime_dir'] = '/var/www/airtime';
$oldSettings['general']['base_files_dir'] = '/srv/airtime';
}
else {
$newSettings = ReadPythonConfig($conf);
$oldSettings = ReadPythonConfig("$conf$suffix.bak");
}
//override some values needed for 1.8.0.
if($conf === CONF_FILE_PYPO) {
$oldSettings['cache_dir'] = '/var/tmp/airtime/pypo/cache/';
$oldSettings['file_dir'] = '/var/tmp/airtime/pypo/files/';
$oldSettings['tmp_dir'] = '/var/tmp/airtime/pypo/tmp/';
}
else if($conf === CONF_FILE_RECORDER) {
$oldSettings['base_recorded_files'] = '/var/tmp/airtime/show-recorder/';
}
$settings = array_keys($newSettings);
foreach($settings as $section) {
if(isset($oldSettings[$section])) {
if(is_array($oldSettings[$section])) {
$sectionKeys = array_keys($newSettings[$section]);
foreach($sectionKeys as $sectionKey) {
if(isset($oldSettings[$section][$sectionKey])) {
UpdateIniValue($conf, $sectionKey, $oldSettings[$section][$sectionKey]);
}
}
}
else {
UpdateIniValue($conf, $section, $oldSettings[$section]);
}
}
}
}
}
}
function LoadConfig($CC_CONFIG) {
$values = parse_ini_file(CONF_FILE_AIRTIME, true);
// Name of the web server user
$CC_CONFIG['webServerUser'] = $values['general']['web_server_user'];
$CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
$CC_CONFIG['rabbitmq'] = $values['rabbitmq'];
$CC_CONFIG['baseFilesDir'] = $values['general']['base_files_dir'];
// main directory for storing binary media files
$CC_CONFIG['storageDir'] = $values['general']['base_files_dir']."/stor";
// Database config
$CC_CONFIG['dsn']['username'] = $values['database']['dbuser'];
$CC_CONFIG['dsn']['password'] = $values['database']['dbpass'];
$CC_CONFIG['dsn']['hostspec'] = $values['database']['host'];
$CC_CONFIG['dsn']['phptype'] = 'pgsql';
$CC_CONFIG['dsn']['database'] = $values['database']['dbname'];
$CC_CONFIG['apiKey'] = array($values['general']['api_key']);
$CC_CONFIG['soundcloud-connection-retries'] = $values['soundcloud']['connection_retries'];
$CC_CONFIG['soundcloud-connection-wait'] = $values['soundcloud']['time_between_retries'];
return $CC_CONFIG;
}
function movePhpFiles($CC_CONFIG){
$phpDir = $CC_CONFIG['phpDir'];
echo "Copying Server files from $phpDir/airtime_mvc to /var/www/airtime";
exec("mkdir -p /var/www/airtime");
exec("cp -R $phpDir/airtime_mvc/* /var/www/airtime");
}
// Backup the config files
$suffix = date("Ymdhis")."-1.8.0";
foreach ($configFiles as $conf) {
if (file_exists($conf)) {
echo "Backing up $conf to $conf$suffix.bak".PHP_EOL;
exec("cp $conf $conf$suffix.bak");
}
}
$CC_CONFIG = LoadConfig($CC_CONFIG);
movePhpFiles($CC_CONFIG);
$default_suffix = "180";
CreateIniFiles($default_suffix);
echo "* Initializing INI files".PHP_EOL;
MergeConfigFiles($configFiles, $suffix);

View File

@ -1,22 +0,0 @@
[database]
host = localhost
dbname = airtime
dbuser = airtime
dbpass = airtime
[rabbitmq]
host = 127.0.0.1
port = 5672
user = guest
password = guest
vhost = /
[general]
api_key = AAA
web_server_user = www-data
airtime_dir = x
base_files_dir = x
[soundcloud]
connection_retries = 3
time_between_retries = 60

View File

@ -1,38 +0,0 @@
###########################################
# liquidsoap config file #
###########################################
###########################################
# general settings #
###########################################
log_file = "/var/log/airtime/pypo-liquidsoap/<script>.log"
log_level = 3
###########################################
# stream settings #
###########################################
icecast_host = "127.0.0.1"
icecast_port = 8000
icecast_pass = "hackme"
###########################################
# webstream mountpoint names #
###########################################
mount_point_mp3 = "airtime.mp3"
mount_point_vorbis = "airtime.ogg"
###########################################
# webstream metadata settings #
###########################################
icecast_url = "http://airtime.sourcefabric.org"
icecast_description = "Airtime Radio!"
icecast_genre = "genre"
###########################################
#liquidsoap output settings #
###########################################
output_sound_device = false
output_icecast_vorbis = true
output_icecast_mp3 = false

View File

@ -1,112 +0,0 @@
############################################
# pypo - configuration #
############################################
# Set the type of client you are using.
# Currently supported types:
# 1) "obp" = Open Broadcast Platform
# 2) "airtime"
#
api_client = "airtime"
############################################
# Cache Directories #
# *include* trailing slash !! #
############################################
cache_dir = '/var/tmp/airtime/pypo/cache/'
file_dir = '/var/tmp/airtime/pypo/files/'
tmp_dir = '/var/tmp/airtime/pypo/tmp/'
############################################
# Setup Directories #
# Do *not* include trailing slash !! #
############################################
cache_base_dir = '/var/tmp/airtime/pypo'
bin_dir = '/usr/lib/airtime/pypo'
log_base_dir = '/var/log/airtime'
pypo_log_dir = '/var/log/airtime/pypo'
liquidsoap_log_dir = '/var/log/airtime/pypo-liquidsoap'
# Hostname
base_url = 'localhost'
base_port = 80
############################################
# Liquidsoap settings #
############################################
ls_host = '127.0.0.1'
ls_port = '1234'
############################################
# RabbitMQ settings #
############################################
rabbitmq_host = 'localhost'
rabbitmq_user = 'guest'
rabbitmq_password = 'guest'
############################################
# pypo preferences #
############################################
prepare_ahead = 24 #in hours
cache_for = 24 #how long to hold the cache, in hours
# Poll interval in seconds.
#
# This will rarely need to be changed because any schedule changes are
# automatically sent to pypo immediately.
#
# This is how often the poll script downloads new schedules and files from the
# server in the event that no changes are made to the schedule.
#
poll_interval = 3600 # in seconds.
# Push interval in seconds.
#
# This is how often the push script checks whether it has something new to
# push to liquidsoap.
#
# It's hard to imagine a situation where this should be more than 1 second.
#
push_interval = 1 # in seconds
# 'pre' or 'otf'. 'pre' cues while playlist preparation
# while 'otf' (on the fly) cues while loading into ls
# (needs the post_processor patch)
cue_style = 'pre'
################################################################################
# Uncomment *one of the sets* of values from the API clients below, and comment
# out all the others.
################################################################################
#####################
# Airtime Config #
#####################
# Value needed to access the API
api_key = 'AAA'
# Path to the base of the API
api_base = 'api'
# URL to get the version number of the server API
version_url = 'version/api_key/%%api_key%%'
# 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
export_url = 'schedule/api_key/%%api_key%%'
get_media_url = 'get-media/file/%%file%%/api_key/%%api_key%%'
# Update whether a schedule group has begun playing.
update_item_url = 'notify-schedule-group-play/api_key/%%api_key%%/schedule_id/%%schedule_id%%'
# Update whether an audio clip is currently playing.
update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/media_id/%%media_id%%/schedule_id/%%schedule_id%%'
# ???
generate_range_url = 'generate_range_dp.php'

View File

@ -1,35 +0,0 @@
api_client = "airtime"
# Hostname
base_url = 'localhost'
base_port = 80
# where the binary files live
bin_dir = '/usr/lib/airtime/show-recorder'
# base path to store recordered shows at
base_recorded_files = '/var/tmp/airtime/show-recorder/'
# where the logging files live
log_dir = '/var/log/airtime/show-recorder'
# Value needed to access the API
api_key = 'AAA'
# Path to the base of the API
api_base = 'api'
# URL to get the version number of the server API
version_url = 'version/api_key/%%api_key%%'
# URL to get the schedule of shows set to record
show_schedule_url = 'recorded-shows/format/json/api_key/%%api_key%%'
# URL to upload the recorded show's file to Airtime
upload_file_url = 'upload-recorded/format/json/api_key/%%api_key%%'
#number of retries to upload file if connection problem
upload_retries = 3
#time to wait between attempts to upload file if connection problem (in seconds)
upload_wait = 60

View File

@ -1,215 +0,0 @@
<?php
/**
* @package Airtime
* @subpackage StorageServer
* @copyright 2010 Sourcefabric O.P.S.
* @license http://www.gnu.org/licenses/gpl.txt
*/
set_include_path(__DIR__.'/../../../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
const CONF_FILE_AIRTIME = "/etc/airtime/airtime.conf";
const CONF_FILE_PYPO = "/etc/airtime/pypo.cfg";
const CONF_FILE_RECORDER = "/etc/airtime/recorder.cfg";
const CONF_FILE_LIQUIDSOAP = "/etc/airtime/liquidsoap.cfg";
const CONF_DIR_BINARIES = "/usr/lib/airtime";
const CONF_DIR_STORAGE = "/srv/airtime";
const CONF_DIR_WWW = "/var/www/airtime";
const CONF_DIR_LOG = "/var/log/airtime";
global $CC_CONFIG;
$configFiles = array(CONF_FILE_AIRTIME,
CONF_FILE_PYPO,
CONF_FILE_RECORDER,
CONF_FILE_LIQUIDSOAP);
$CC_CONFIG = array(
// prefix for table names in the database
'tblNamePrefix' => 'cc_',
/* ================================================ storage configuration */
'soundcloud-client-id' => '2CLCxcSXYzx7QhhPVHN4A',
'soundcloud-client-secret' => 'pZ7beWmF06epXLHVUP1ufOg2oEnIt9XhE8l8xt0bBs',
"rootDir" => __DIR__."/../.."
);
$CC_CONFIG = LoadConfig($CC_CONFIG);
// Add database table names
$CC_CONFIG['playListTable'] = $CC_CONFIG['tblNamePrefix'].'playlist';
$CC_CONFIG['playListContentsTable'] = $CC_CONFIG['tblNamePrefix'].'playlistcontents';
$CC_CONFIG['filesTable'] = $CC_CONFIG['tblNamePrefix'].'files';
$CC_CONFIG['accessTable'] = $CC_CONFIG['tblNamePrefix'].'access';
$CC_CONFIG['permTable'] = $CC_CONFIG['tblNamePrefix'].'perms';
$CC_CONFIG['sessTable'] = $CC_CONFIG['tblNamePrefix'].'sess';
$CC_CONFIG['subjTable'] = $CC_CONFIG['tblNamePrefix'].'subjs';
$CC_CONFIG['smembTable'] = $CC_CONFIG['tblNamePrefix'].'smemb';
$CC_CONFIG['prefTable'] = $CC_CONFIG['tblNamePrefix'].'pref';
$CC_CONFIG['scheduleTable'] = $CC_CONFIG['tblNamePrefix'].'schedule';
$CC_CONFIG['playListTimeView'] = $CC_CONFIG['tblNamePrefix'].'playlisttimes';
$CC_CONFIG['showSchedule'] = $CC_CONFIG['tblNamePrefix'].'show_schedule';
$CC_CONFIG['showDays'] = $CC_CONFIG['tblNamePrefix'].'show_days';
$CC_CONFIG['showTable'] = $CC_CONFIG['tblNamePrefix'].'show';
$CC_CONFIG['showInstances'] = $CC_CONFIG['tblNamePrefix'].'show_instances';
$CC_CONFIG['playListSequence'] = $CC_CONFIG['playListTable'].'_id';
$CC_CONFIG['filesSequence'] = $CC_CONFIG['filesTable'].'_id';
$CC_CONFIG['prefSequence'] = $CC_CONFIG['prefTable'].'_id';
$CC_CONFIG['permSequence'] = $CC_CONFIG['permTable'].'_id';
$CC_CONFIG['subjSequence'] = $CC_CONFIG['subjTable'].'_id';
$CC_CONFIG['smembSequence'] = $CC_CONFIG['smembTable'].'_id';
function LoadConfig($CC_CONFIG) {
$values = parse_ini_file(CONF_FILE_AIRTIME, true);
// Name of the web server user
$CC_CONFIG['webServerUser'] = $values['general']['web_server_user'];
$CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
$CC_CONFIG['rabbitmq'] = $values['rabbitmq'];
$CC_CONFIG['baseFilesDir'] = $values['general']['base_files_dir'];
// main directory for storing binary media files
$CC_CONFIG['storageDir'] = $values['general']['base_files_dir']."/stor";
//$CC_CONFIG['baseUrl'] = $values['general']['base_url'];
//$CC_CONFIG['basePort'] = $values['general']['base_port'];
// Database config
$CC_CONFIG['dsn']['username'] = $values['database']['dbuser'];
$CC_CONFIG['dsn']['password'] = $values['database']['dbpass'];
$CC_CONFIG['dsn']['hostspec'] = $values['database']['host'];
$CC_CONFIG['dsn']['phptype'] = 'pgsql';
$CC_CONFIG['dsn']['database'] = $values['database']['dbname'];
$CC_CONFIG['apiKey'] = array($values['general']['api_key']);
$CC_CONFIG['soundcloud-connection-retries'] = $values['soundcloud']['connection_retries'];
$CC_CONFIG['soundcloud-connection-wait'] = $values['soundcloud']['time_between_retries'];
return $CC_CONFIG;
}
/**
* This function creates the /etc/airtime configuration folder
* and copies the default config files to it.
*/
function CreateIniFiles($suffix)
{
if (!file_exists("/etc/airtime/")){
if (!mkdir("/etc/airtime/", 0755, true)){
echo "Could not create /etc/airtime/ directory. Exiting.";
exit(1);
}
}
if (!copy(__DIR__."/airtime.conf.$suffix", CONF_FILE_AIRTIME)){
echo "Could not copy airtime.conf.$suffix to /etc/airtime/. Exiting.";
exit(1);
}
if (!copy(__DIR__."/pypo.cfg.$suffix", CONF_FILE_PYPO)){
echo "Could not copy pypo.cfg.$suffix to /etc/airtime/. Exiting.";
exit(1);
}
if (!copy(__DIR__."/recorder.cfg.$suffix", CONF_FILE_RECORDER)){
echo "Could not copy recorder.cfg.$suffix to /etc/airtime/. Exiting.";
exit(1);
}
if (!copy(__DIR__."/liquidsoap.cfg.$suffix", CONF_FILE_LIQUIDSOAP)){
echo "Could not copy liquidsoap.cfg.$suffix to /etc/airtime/. Exiting.";
exit(1);
}
}
function ReadPythonConfig($p_filename)
{
$values = array();
$lines = file($p_filename);
$n=count($lines);
for ($i=0; $i<$n; $i++) {
if (strlen($lines[$i]) && !in_array(substr($lines[$i], 0, 1), array('#', PHP_EOL))){
$info = explode("=", $lines[$i]);
$values[trim($info[0])] = trim($info[1]);
}
}
return $values;
}
function UpdateIniValue($p_filename, $p_property, $p_value)
{
$lines = file($p_filename);
$n=count($lines);
foreach ($lines as &$line) {
if ($line[0] != "#"){
$key_value = split("=", $line);
$key = trim($key_value[0]);
if ($key == $p_property){
$line = "$p_property = $p_value".PHP_EOL;
}
}
}
$fp=fopen($p_filename, 'w');
for($i=0; $i<$n; $i++){
fwrite($fp, $lines[$i]);
}
fclose($fp);
}
function MergeConfigFiles($configFiles, $suffix)
{
foreach ($configFiles as $conf) {
if (file_exists("$conf$suffix.bak")) {
if($conf === CONF_FILE_AIRTIME) {
// Parse with sections
$newSettings = parse_ini_file($conf, true);
$oldSettings = parse_ini_file("$conf$suffix.bak", true);
}
else {
$newSettings = ReadPythonConfig($conf);
$oldSettings = ReadPythonConfig("$conf$suffix.bak");
}
$settings = array_keys($newSettings);
foreach($settings as $section) {
if(isset($oldSettings[$section])) {
if(is_array($oldSettings[$section])) {
$sectionKeys = array_keys($newSettings[$section]);
foreach($sectionKeys as $sectionKey) {
if(isset($oldSettings[$section][$sectionKey])) {
UpdateIniValue($conf, $sectionKey, $oldSettings[$section][$sectionKey]);
}
}
}
else {
UpdateIniValue($conf, $section, $oldSettings[$section]);
}
}
}
}
}
}
// Backup the config files
$suffix = date("Ymdhis")."-1.8.1";
foreach ($configFiles as $conf) {
if (file_exists($conf)) {
echo "Backing up $conf to $conf$suffix.bak".PHP_EOL;
exec("cp $conf $conf$suffix.bak");
}
}
$default_suffix = "181";
CreateIniFiles($default_suffix);
echo "* Initializing INI files".PHP_EOL;
MergeConfigFiles($configFiles, $suffix);
$CC_CONFIG = LoadConfig($CC_CONFIG);

View File

@ -1,22 +0,0 @@
[database]
host = localhost
dbname = airtime
dbuser = airtime
dbpass = airtime
[rabbitmq]
host = 127.0.0.1
port = 5672
user = guest
password = guest
vhost = /
[general]
api_key = AAA
web_server_user = www-data
airtime_dir = x
base_files_dir = x
[soundcloud]
connection_retries = 3
time_between_retries = 60

View File

@ -1,38 +0,0 @@
###########################################
# liquidsoap config file #
###########################################
###########################################
# general settings #
###########################################
log_file = "/var/log/airtime/pypo-liquidsoap/<script>.log"
log_level = 3
###########################################
# stream settings #
###########################################
icecast_host = "127.0.0.1"
icecast_port = 8000
icecast_pass = "hackme"
###########################################
# webstream mountpoint names #
###########################################
mount_point_mp3 = "airtime.mp3"
mount_point_vorbis = "airtime.ogg"
###########################################
# webstream metadata settings #
###########################################
icecast_url = "http://airtime.sourcefabric.org"
icecast_description = "Airtime Radio!"
icecast_genre = "genre"
###########################################
#liquidsoap output settings #
###########################################
output_sound_device = false
output_icecast_vorbis = true
output_icecast_mp3 = false

View File

@ -1,112 +0,0 @@
############################################
# pypo - configuration #
############################################
# Set the type of client you are using.
# Currently supported types:
# 1) "obp" = Open Broadcast Platform
# 2) "airtime"
#
api_client = "airtime"
############################################
# Cache Directories #
# *include* trailing slash !! #
############################################
cache_dir = '/var/tmp/airtime/pypo/cache/'
file_dir = '/var/tmp/airtime/pypo/files/'
tmp_dir = '/var/tmp/airtime/pypo/tmp/'
############################################
# Setup Directories #
# Do *not* include trailing slash !! #
############################################
cache_base_dir = '/var/tmp/airtime/pypo'
bin_dir = '/usr/lib/airtime/pypo'
log_base_dir = '/var/log/airtime'
pypo_log_dir = '/var/log/airtime/pypo'
liquidsoap_log_dir = '/var/log/airtime/pypo-liquidsoap'
# Hostname
base_url = 'localhost'
base_port = 80
############################################
# Liquidsoap settings #
############################################
ls_host = '127.0.0.1'
ls_port = '1234'
############################################
# RabbitMQ settings #
############################################
rabbitmq_host = 'localhost'
rabbitmq_user = 'guest'
rabbitmq_password = 'guest'
############################################
# pypo preferences #
############################################
prepare_ahead = 24 #in hours
cache_for = 24 #how long to hold the cache, in hours
# Poll interval in seconds.
#
# This will rarely need to be changed because any schedule changes are
# automatically sent to pypo immediately.
#
# This is how often the poll script downloads new schedules and files from the
# server in the event that no changes are made to the schedule.
#
poll_interval = 3600 # in seconds.
# Push interval in seconds.
#
# This is how often the push script checks whether it has something new to
# push to liquidsoap.
#
# It's hard to imagine a situation where this should be more than 1 second.
#
push_interval = 1 # in seconds
# 'pre' or 'otf'. 'pre' cues while playlist preparation
# while 'otf' (on the fly) cues while loading into ls
# (needs the post_processor patch)
cue_style = 'pre'
################################################################################
# Uncomment *one of the sets* of values from the API clients below, and comment
# out all the others.
################################################################################
#####################
# Airtime Config #
#####################
# Value needed to access the API
api_key = 'AAA'
# Path to the base of the API
api_base = 'api'
# URL to get the version number of the server API
version_url = 'version/api_key/%%api_key%%'
# 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
export_url = 'schedule/api_key/%%api_key%%'
get_media_url = 'get-media/file/%%file%%/api_key/%%api_key%%'
# Update whether a schedule group has begun playing.
update_item_url = 'notify-schedule-group-play/api_key/%%api_key%%/schedule_id/%%schedule_id%%'
# Update whether an audio clip is currently playing.
update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/media_id/%%media_id%%/schedule_id/%%schedule_id%%'
# ???
generate_range_url = 'generate_range_dp.php'

View File

@ -1,35 +0,0 @@
api_client = "airtime"
# Hostname
base_url = 'localhost'
base_port = 80
# where the binary files live
bin_dir = '/usr/lib/airtime/show-recorder'
# base path to store recordered shows at
base_recorded_files = '/var/tmp/airtime/show-recorder/'
# where the logging files live
log_dir = '/var/log/airtime/show-recorder'
# Value needed to access the API
api_key = 'AAA'
# Path to the base of the API
api_base = 'api'
# URL to get the version number of the server API
version_url = 'version/api_key/%%api_key%%'
# URL to get the schedule of shows set to record
show_schedule_url = 'recorded-shows/format/json/api_key/%%api_key%%'
# URL to upload the recorded show's file to Airtime
upload_file_url = 'upload-recorded/format/json/api_key/%%api_key%%'
#number of retries to upload file if connection problem
upload_retries = 3
#time to wait between attempts to upload file if connection problem (in seconds)
upload_wait = 60

View File

@ -1,216 +0,0 @@
<?php
/**
* @package Airtime
* @subpackage StorageServer
* @copyright 2010 Sourcefabric O.P.S.
* @license http://www.gnu.org/licenses/gpl.txt
*/
set_include_path(__DIR__.'/../../../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
const CONF_FILE_AIRTIME = "/etc/airtime/airtime.conf";
const CONF_FILE_PYPO = "/etc/airtime/pypo.cfg";
const CONF_FILE_RECORDER = "/etc/airtime/recorder.cfg";
const CONF_FILE_LIQUIDSOAP = "/etc/airtime/liquidsoap.cfg";
const CONF_DIR_BINARIES = "/usr/lib/airtime";
const CONF_DIR_STORAGE = "/srv/airtime";
const CONF_DIR_WWW = "/var/www/airtime";
const CONF_DIR_LOG = "/var/log/airtime";
global $CC_CONFIG;
$configFiles = array(CONF_FILE_AIRTIME,
CONF_FILE_PYPO,
CONF_FILE_RECORDER,
CONF_FILE_LIQUIDSOAP);
$CC_CONFIG = array(
// prefix for table names in the database
'tblNamePrefix' => 'cc_',
/* ================================================ storage configuration */
'soundcloud-client-id' => '2CLCxcSXYzx7QhhPVHN4A',
'soundcloud-client-secret' => 'pZ7beWmF06epXLHVUP1ufOg2oEnIt9XhE8l8xt0bBs',
"rootDir" => __DIR__."/../.."
);
$CC_CONFIG = LoadConfig($CC_CONFIG);
// Add database table names
$CC_CONFIG['playListTable'] = $CC_CONFIG['tblNamePrefix'].'playlist';
$CC_CONFIG['playListContentsTable'] = $CC_CONFIG['tblNamePrefix'].'playlistcontents';
$CC_CONFIG['filesTable'] = $CC_CONFIG['tblNamePrefix'].'files';
$CC_CONFIG['accessTable'] = $CC_CONFIG['tblNamePrefix'].'access';
$CC_CONFIG['permTable'] = $CC_CONFIG['tblNamePrefix'].'perms';
$CC_CONFIG['sessTable'] = $CC_CONFIG['tblNamePrefix'].'sess';
$CC_CONFIG['subjTable'] = $CC_CONFIG['tblNamePrefix'].'subjs';
$CC_CONFIG['smembTable'] = $CC_CONFIG['tblNamePrefix'].'smemb';
$CC_CONFIG['prefTable'] = $CC_CONFIG['tblNamePrefix'].'pref';
$CC_CONFIG['scheduleTable'] = $CC_CONFIG['tblNamePrefix'].'schedule';
$CC_CONFIG['playListTimeView'] = $CC_CONFIG['tblNamePrefix'].'playlisttimes';
$CC_CONFIG['showSchedule'] = $CC_CONFIG['tblNamePrefix'].'show_schedule';
$CC_CONFIG['showDays'] = $CC_CONFIG['tblNamePrefix'].'show_days';
$CC_CONFIG['showTable'] = $CC_CONFIG['tblNamePrefix'].'show';
$CC_CONFIG['showInstances'] = $CC_CONFIG['tblNamePrefix'].'show_instances';
$CC_CONFIG['playListSequence'] = $CC_CONFIG['playListTable'].'_id';
$CC_CONFIG['filesSequence'] = $CC_CONFIG['filesTable'].'_id';
$CC_CONFIG['prefSequence'] = $CC_CONFIG['prefTable'].'_id';
$CC_CONFIG['permSequence'] = $CC_CONFIG['permTable'].'_id';
$CC_CONFIG['subjSequence'] = $CC_CONFIG['subjTable'].'_id';
$CC_CONFIG['smembSequence'] = $CC_CONFIG['smembTable'].'_id';
function LoadConfig($CC_CONFIG) {
$values = parse_ini_file(CONF_FILE_AIRTIME, true);
// Name of the web server user
$CC_CONFIG['webServerUser'] = $values['general']['web_server_user'];
$CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
$CC_CONFIG['rabbitmq'] = $values['rabbitmq'];
$CC_CONFIG['baseFilesDir'] = $values['general']['base_files_dir'];
// main directory for storing binary media files
$CC_CONFIG['storageDir'] = $values['general']['base_files_dir']."/stor";
//these next two entries are new for this release, will be undefined on first load.
$CC_CONFIG['baseUrl'] = isset($values['general']['base_url'])?$values['general']['base_url']:null;
$CC_CONFIG['basePort'] = isset($values['general']['base_port'])?$values['general']['base_port']:null;
// Database config
$CC_CONFIG['dsn']['username'] = $values['database']['dbuser'];
$CC_CONFIG['dsn']['password'] = $values['database']['dbpass'];
$CC_CONFIG['dsn']['hostspec'] = $values['database']['host'];
$CC_CONFIG['dsn']['phptype'] = 'pgsql';
$CC_CONFIG['dsn']['database'] = $values['database']['dbname'];
$CC_CONFIG['apiKey'] = array($values['general']['api_key']);
$CC_CONFIG['soundcloud-connection-retries'] = $values['soundcloud']['connection_retries'];
$CC_CONFIG['soundcloud-connection-wait'] = $values['soundcloud']['time_between_retries'];
return $CC_CONFIG;
}
/**
* This function creates the /etc/airtime configuration folder
* and copies the default config files to it.
*/
function CreateIniFiles($suffix)
{
if (!file_exists("/etc/airtime/")){
if (!mkdir("/etc/airtime/", 0755, true)){
echo "Could not create /etc/airtime/ directory. Exiting.";
exit(1);
}
}
if (!copy(__DIR__."/airtime.conf.$suffix", CONF_FILE_AIRTIME)){
echo "Could not copy airtime.conf.$suffix to /etc/airtime/. Exiting.";
exit(1);
}
if (!copy(__DIR__."/pypo.cfg.$suffix", CONF_FILE_PYPO)){
echo "Could not copy pypo.cfg.$suffix to /etc/airtime/. Exiting.";
exit(1);
}
if (!copy(__DIR__."/recorder.cfg.$suffix", CONF_FILE_RECORDER)){
echo "Could not copy recorder.cfg.$suffix to /etc/airtime/. Exiting.";
exit(1);
}
if (!copy(__DIR__."/liquidsoap.cfg.$suffix", CONF_FILE_LIQUIDSOAP)){
echo "Could not copy liquidsoap.cfg.$suffix to /etc/airtime/. Exiting.";
exit(1);
}
}
function ReadPythonConfig($p_filename)
{
$values = array();
$lines = file($p_filename);
$n=count($lines);
for ($i=0; $i<$n; $i++) {
if (strlen($lines[$i]) && !in_array(substr($lines[$i], 0, 1), array('#', PHP_EOL))){
$info = explode("=", $lines[$i]);
$values[trim($info[0])] = trim($info[1]);
}
}
return $values;
}
function UpdateIniValue($p_filename, $p_property, $p_value)
{
$lines = file($p_filename);
$n=count($lines);
foreach ($lines as &$line) {
if ($line[0] != "#"){
$key_value = split("=", $line);
$key = trim($key_value[0]);
if ($key == $p_property){
$line = "$p_property = $p_value".PHP_EOL;
}
}
}
$fp=fopen($p_filename, 'w');
for($i=0; $i<$n; $i++){
fwrite($fp, $lines[$i]);
}
fclose($fp);
}
function MergeConfigFiles($configFiles, $suffix)
{
foreach ($configFiles as $conf) {
if (file_exists("$conf$suffix.bak")) {
if($conf === CONF_FILE_AIRTIME) {
// Parse with sections
$newSettings = parse_ini_file($conf, true);
$oldSettings = parse_ini_file("$conf$suffix.bak", true);
}
else {
$newSettings = ReadPythonConfig($conf);
$oldSettings = ReadPythonConfig("$conf$suffix.bak");
}
$settings = array_keys($newSettings);
foreach($settings as $section) {
if(isset($oldSettings[$section])) {
if(is_array($oldSettings[$section])) {
$sectionKeys = array_keys($newSettings[$section]);
foreach($sectionKeys as $sectionKey) {
if(isset($oldSettings[$section][$sectionKey])) {
UpdateIniValue($conf, $sectionKey, $oldSettings[$section][$sectionKey]);
}
}
}
else {
UpdateIniValue($conf, $section, $oldSettings[$section]);
}
}
}
}
}
}
$suffix = date("Ymdhis")."-1.8.2";
foreach ($configFiles as $conf) {
if (file_exists($conf)) {
echo "Backing up $conf to $conf$suffix.bak".PHP_EOL;
exec("cp $conf $conf$suffix.bak");
}
}
$default_suffix = "182";
CreateIniFiles($default_suffix);
echo "* Initializing INI files".PHP_EOL;
MergeConfigFiles($configFiles, $suffix);
$CC_CONFIG = LoadConfig($CC_CONFIG);

View File

@ -1,24 +0,0 @@
[database]
host = localhost
dbname = airtime
dbuser = airtime
dbpass = airtime
[rabbitmq]
host = 127.0.0.1
port = 5672
user = guest
password = guest
vhost = /
[general]
api_key = AAA
web_server_user = www-data
airtime_dir = x
base_files_dir = x
base_url = localhost
base_port = 80
[soundcloud]
connection_retries = 3
time_between_retries = 60

View File

@ -1,46 +0,0 @@
###########################################
# liquidsoap config file #
###########################################
###########################################
# general settings #
###########################################
log_file = "/var/log/airtime/pypo-liquidsoap/<script>.log"
log_level = 3
###########################################
# stream settings #
###########################################
icecast_host = "127.0.0.1"
icecast_port = 8000
icecast_pass = "hackme"
###########################################
# webstream mountpoint names #
###########################################
mount_point_mp3 = "airtime.mp3"
mount_point_vorbis = "airtime.ogg"
###########################################
# webstream metadata settings #
###########################################
icecast_url = "http://airtime.sourcefabric.org"
icecast_description = "Airtime Radio!"
icecast_genre = "genre"
###########################################
#liquidsoap output settings #
###########################################
output_sound_device = false
output_icecast_vorbis = true
output_icecast_mp3 = false
#audio stream metadata for vorbis/ogg is disabled by default
#due to a large number of client media players that disconnect
#when the metadata changes to that of a new track. Some versions of
#mplayer and VLC have this problem. Enable this option at your
#own risk!
output_icecast_vorbis_metadata = false

View File

@ -1,112 +0,0 @@
############################################
# pypo - configuration #
############################################
# Set the type of client you are using.
# Currently supported types:
# 1) "obp" = Open Broadcast Platform
# 2) "airtime"
#
api_client = "airtime"
############################################
# Cache Directories #
# *include* trailing slash !! #
############################################
cache_dir = '/var/tmp/airtime/pypo/cache/'
file_dir = '/var/tmp/airtime/pypo/files/'
tmp_dir = '/var/tmp/airtime/pypo/tmp/'
############################################
# Setup Directories #
# Do *not* include trailing slash !! #
############################################
cache_base_dir = '/var/tmp/airtime/pypo'
bin_dir = '/usr/lib/airtime/pypo'
log_base_dir = '/var/log/airtime'
pypo_log_dir = '/var/log/airtime/pypo'
liquidsoap_log_dir = '/var/log/airtime/pypo-liquidsoap'
# Hostname
base_url = 'localhost'
base_port = 80
############################################
# Liquidsoap settings #
############################################
ls_host = '127.0.0.1'
ls_port = '1234'
############################################
# RabbitMQ settings #
############################################
rabbitmq_host = 'localhost'
rabbitmq_user = 'guest'
rabbitmq_password = 'guest'
############################################
# pypo preferences #
############################################
prepare_ahead = 24 #in hours
cache_for = 24 #how long to hold the cache, in hours
# Poll interval in seconds.
#
# This will rarely need to be changed because any schedule changes are
# automatically sent to pypo immediately.
#
# This is how often the poll script downloads new schedules and files from the
# server in the event that no changes are made to the schedule.
#
poll_interval = 3600 # in seconds.
# Push interval in seconds.
#
# This is how often the push script checks whether it has something new to
# push to liquidsoap.
#
# It's hard to imagine a situation where this should be more than 1 second.
#
push_interval = 1 # in seconds
# 'pre' or 'otf'. 'pre' cues while playlist preparation
# while 'otf' (on the fly) cues while loading into ls
# (needs the post_processor patch)
cue_style = 'pre'
################################################################################
# Uncomment *one of the sets* of values from the API clients below, and comment
# out all the others.
################################################################################
#####################
# Airtime Config #
#####################
# Value needed to access the API
api_key = 'AAA'
# Path to the base of the API
api_base = 'api'
# URL to get the version number of the server API
version_url = 'version/api_key/%%api_key%%'
# 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
export_url = 'schedule/api_key/%%api_key%%'
get_media_url = 'get-media/file/%%file%%/api_key/%%api_key%%'
# Update whether a schedule group has begun playing.
update_item_url = 'notify-schedule-group-play/api_key/%%api_key%%/schedule_id/%%schedule_id%%'
# Update whether an audio clip is currently playing.
update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/media_id/%%media_id%%/schedule_id/%%schedule_id%%'
# ???
generate_range_url = 'generate_range_dp.php'

View File

@ -1,35 +0,0 @@
api_client = "airtime"
# Hostname
base_url = 'localhost'
base_port = 80
# where the binary files live
bin_dir = '/usr/lib/airtime/show-recorder'
# base path to store recordered shows at
base_recorded_files = '/var/tmp/airtime/show-recorder/'
# where the logging files live
log_dir = '/var/log/airtime/show-recorder'
# Value needed to access the API
api_key = 'AAA'
# Path to the base of the API
api_base = 'api'
# URL to get the version number of the server API
version_url = 'version/api_key/%%api_key%%'
# URL to get the schedule of shows set to record
show_schedule_url = 'recorded-shows/format/json/api_key/%%api_key%%'
# URL to upload the recorded show's file to Airtime
upload_file_url = 'upload-recorded/format/json/api_key/%%api_key%%'
#number of retries to upload file if connection problem
upload_retries = 3
#time to wait between attempts to upload file if connection problem (in seconds)
upload_wait = 60

View File

@ -1,23 +0,0 @@
set daemon 10 # Poll at 10 second intervals
set logfile syslog facility log_daemon
set httpd port 2812 and use address 127.0.0.1
allow localhost
allow admin:monit
check process airtime-playout
with pidfile "/var/run/airtime-playout.pid"
start program = "/etc/init.d/airtime-playout start" with timeout 10 seconds
stop program = "/etc/init.d/airtime-playout stop"
check process airtime-liquidsoap
with pidfile "/var/run/airtime-liquidsoap.pid"
start program = "/etc/init.d/airtime-playout start" with timeout 10 seconds
stop program = "/etc/init.d/airtime-playout stop"
check process airtime-media-monitor
with pidfile "/var/run/airtime-media-monitor.pid"
start program = "/etc/init.d/airtime-media-monitor start" with timeout 10 seconds
stop program = "/etc/init.d/airtime-media-monitor stop"
check process airtime-show-recorder
with pidfile "/var/run/airtime-show-recorder.pid"
start program = "/etc/init.d/airtime-show-recorder start" with timeout 10 seconds
stop program = "/etc/init.d/airtime-show-recorder stop"

View File

@ -1,844 +0,0 @@
<?php
set_include_path(__DIR__.'/../../../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
require_once 'conf.php';
require_once 'propel/runtime/lib/Propel.php';
set_include_path(__DIR__.'/propel' . PATH_SEPARATOR . get_include_path());
Propel::init(__DIR__."/propel/airtime-conf.php");
date_default_timezone_set(exec("cat /etc/timezone"));
const CONF_DIR_BINARIES = "/usr/lib/airtime";
class AirtimeInstall{
const CONF_DIR_LOG = "/var/log/airtime";
const CONF_DIR_BINARIES = "/usr/lib/airtime";
public static function CreateZendPhpLogFile(){
global $CC_CONFIG;
echo "* Creating logs directory ".AirtimeInstall::CONF_DIR_LOG.PHP_EOL;
$path = AirtimeInstall::CONF_DIR_LOG;
$file = $path.'/zendphp.log';
if (!file_exists($path)){
mkdir($path, 0755, true);
}
touch($file);
chmod($file, 0755);
chown($file, $CC_CONFIG['webServerUser']);
chgrp($file, $CC_CONFIG['webServerUser']);
}
public static function CreateSymlinksToUtils()
{
echo "* Creating /usr/bin symlinks".PHP_EOL;
AirtimeInstall::RemoveSymlinks();
echo "* Installing airtime-import".PHP_EOL;
$dir = CONF_DIR_BINARIES."/utils/airtime-import/airtime-import";
exec("ln -s $dir /usr/bin/airtime-import");
echo "* Installing airtime-update-db-settings".PHP_EOL;
$dir = CONF_DIR_BINARIES."/utils/airtime-update-db-settings";
exec("ln -s $dir /usr/bin/airtime-update-db-settings");
echo "* Installing airtime-check-system".PHP_EOL;
$dir = CONF_DIR_BINARIES."/utils/airtime-check-system";
exec("ln -s $dir /usr/bin/airtime-check-system");
echo "* Installing airtime-user".PHP_EOL;
$dir = AirtimeInstall::CONF_DIR_BINARIES."/utils/airtime-user";
exec("ln -s $dir /usr/bin/airtime-user");
}
public static function RemoveSymlinks()
{
exec("rm -f /usr/bin/airtime-import");
exec("rm -f /usr/bin/airtime-update-db-settings");
exec("rm -f /usr/bin/airtime-check-system");
exec("rm -f /usr/bin/airtime-user");
exec("rm -f /usr/bin/airtime-clean-storage ");
}
public static function DbTableExists($p_name)
{
$con = Propel::getConnection();
try {
$sql = "SELECT * FROM ".$p_name." LIMIT 1";
$con->query($sql);
} catch (PDOException $e){
return false;
}
return true;
}
public static function BypassMigrations($dir, $version)
{
$appDir = AirtimeInstall::GetAirtimeSrcDir();
$SCRIPTPATH = __DIR__;
$command = "php --php-ini $SCRIPTPATH/../../airtime-php.ini ".
"$appDir/library/doctrine/migrations/doctrine-migrations.phar ".
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
"--no-interaction --add migrations:version $version";
passthru($command);
}
public static function MigrateTablesToVersion($dir, $version)
{
echo "Upgrading database, may take several minutes, please wait".PHP_EOL;
$appDir = AirtimeInstall::GetAirtimeSrcDir();
$SCRIPTPATH = __DIR__;
$command = "php --php-ini $SCRIPTPATH/../../airtime-php.ini ".
"$appDir/library/doctrine/migrations/doctrine-migrations.phar ".
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
"--no-interaction migrations:migrate $version";
passthru($command);
}
public static function CreateCronFile(){
// Create CRON task to run every day. Time of day is initialized to a random time.
$hour = rand(0,23);
$minute = rand(0,59);
$fp = fopen('/etc/cron.d/airtime-crons','w');
fwrite($fp, "$minute $hour * * * root /usr/lib/airtime/utils/phone_home_stat\n");
fclose($fp);
}
public static function GetAirtimeSrcDir()
{
return __DIR__."/../../../airtime_mvc";
}
public static function InsertCountryDataIntoDatabase(){
$sql = "INSERT INTO cc_country (isocode, name) VALUES ('AFG', 'Afghanistan ');
INSERT INTO cc_country (isocode, name) VALUES ('ALA', 'Åland Islands');
INSERT INTO cc_country (isocode, name) VALUES ('ALB', 'Albania ');
INSERT INTO cc_country (isocode, name) VALUES ('DZA', 'Algeria ');
INSERT INTO cc_country (isocode, name) VALUES ('ASM', 'American Samoa ');
INSERT INTO cc_country (isocode, name) VALUES ('AND', 'Andorra ');
INSERT INTO cc_country (isocode, name) VALUES ('AGO', 'Angola ');
INSERT INTO cc_country (isocode, name) VALUES ('AIA', 'Anguilla ');
INSERT INTO cc_country (isocode, name) VALUES ('ATG', 'Antigua and Barbuda ');
INSERT INTO cc_country (isocode, name) VALUES ('ARG', 'Argentina ');
INSERT INTO cc_country (isocode, name) VALUES ('ARM', 'Armenia ');
INSERT INTO cc_country (isocode, name) VALUES ('ABW', 'Aruba ');
INSERT INTO cc_country (isocode, name) VALUES ('AUS', 'Australia ');
INSERT INTO cc_country (isocode, name) VALUES ('AUT', 'Austria ');
INSERT INTO cc_country (isocode, name) VALUES ('AZE', 'Azerbaijan ');
INSERT INTO cc_country (isocode, name) VALUES ('BHS', 'Bahamas ');
INSERT INTO cc_country (isocode, name) VALUES ('BHR', 'Bahrain ');
INSERT INTO cc_country (isocode, name) VALUES ('BGD', 'Bangladesh ');
INSERT INTO cc_country (isocode, name) VALUES ('BRB', 'Barbados ');
INSERT INTO cc_country (isocode, name) VALUES ('BLR', 'Belarus ');
INSERT INTO cc_country (isocode, name) VALUES ('BEL', 'Belgium ');
INSERT INTO cc_country (isocode, name) VALUES ('BLZ', 'Belize ');
INSERT INTO cc_country (isocode, name) VALUES ('BEN', 'Benin ');
INSERT INTO cc_country (isocode, name) VALUES ('BMU', 'Bermuda ');
INSERT INTO cc_country (isocode, name) VALUES ('BTN', 'Bhutan ');
INSERT INTO cc_country (isocode, name) VALUES ('BOL', 'Bolivia (Plurinational State of) ');
INSERT INTO cc_country (isocode, name) VALUES ('BES', 'Bonaire, Saint Eustatius and Saba');
INSERT INTO cc_country (isocode, name) VALUES ('BIH', 'Bosnia and Herzegovina ');
INSERT INTO cc_country (isocode, name) VALUES ('BWA', 'Botswana ');
INSERT INTO cc_country (isocode, name) VALUES ('BRA', 'Brazil ');
INSERT INTO cc_country (isocode, name) VALUES ('VGB', 'British Virgin Islands ');
INSERT INTO cc_country (isocode, name) VALUES ('BRN', 'Brunei Darussalam ');
INSERT INTO cc_country (isocode, name) VALUES ('BGR', 'Bulgaria ');
INSERT INTO cc_country (isocode, name) VALUES ('BFA', 'Burkina Faso ');
INSERT INTO cc_country (isocode, name) VALUES ('BDI', 'Burundi ');
INSERT INTO cc_country (isocode, name) VALUES ('KHM', 'Cambodia ');
INSERT INTO cc_country (isocode, name) VALUES ('CMR', 'Cameroon ');
INSERT INTO cc_country (isocode, name) VALUES ('CAN', 'Canada ');
INSERT INTO cc_country (isocode, name) VALUES ('CPV', 'Cape Verde ');
INSERT INTO cc_country (isocode, name) VALUES ('CYM', 'Cayman Islands ');
INSERT INTO cc_country (isocode, name) VALUES ('CAF', 'Central African Republic ');
INSERT INTO cc_country (isocode, name) VALUES ('TCD', 'Chad ');
INSERT INTO cc_country (isocode, name) VALUES ('CHL', 'Chile ');
INSERT INTO cc_country (isocode, name) VALUES ('CHN', 'China ');
INSERT INTO cc_country (isocode, name) VALUES ('HKG', 'China, Hong Kong Special Administrative Region');
INSERT INTO cc_country (isocode, name) VALUES ('MAC', 'China, Macao Special Administrative Region');
INSERT INTO cc_country (isocode, name) VALUES ('COL', 'Colombia ');
INSERT INTO cc_country (isocode, name) VALUES ('COM', 'Comoros ');
INSERT INTO cc_country (isocode, name) VALUES ('COG', 'Congo ');
INSERT INTO cc_country (isocode, name) VALUES ('COK', 'Cook Islands ');
INSERT INTO cc_country (isocode, name) VALUES ('CRI', 'Costa Rica ');
INSERT INTO cc_country (isocode, name) VALUES ('CIV', 'Côte d''Ivoire ');
INSERT INTO cc_country (isocode, name) VALUES ('HRV', 'Croatia ');
INSERT INTO cc_country (isocode, name) VALUES ('CUB', 'Cuba ');
INSERT INTO cc_country (isocode, name) VALUES ('CUW', 'Curaçao');
INSERT INTO cc_country (isocode, name) VALUES ('CYP', 'Cyprus ');
INSERT INTO cc_country (isocode, name) VALUES ('CZE', 'Czech Republic ');
INSERT INTO cc_country (isocode, name) VALUES ('PRK', 'Democratic People''s Republic of Korea ');
INSERT INTO cc_country (isocode, name) VALUES ('COD', 'Democratic Republic of the Congo ');
INSERT INTO cc_country (isocode, name) VALUES ('DNK', 'Denmark ');
INSERT INTO cc_country (isocode, name) VALUES ('DJI', 'Djibouti ');
INSERT INTO cc_country (isocode, name) VALUES ('DMA', 'Dominica ');
INSERT INTO cc_country (isocode, name) VALUES ('DOM', 'Dominican Republic ');
INSERT INTO cc_country (isocode, name) VALUES ('ECU', 'Ecuador ');
INSERT INTO cc_country (isocode, name) VALUES ('EGY', 'Egypt ');
INSERT INTO cc_country (isocode, name) VALUES ('SLV', 'El Salvador ');
INSERT INTO cc_country (isocode, name) VALUES ('GNQ', 'Equatorial Guinea ');
INSERT INTO cc_country (isocode, name) VALUES ('ERI', 'Eritrea ');
INSERT INTO cc_country (isocode, name) VALUES ('EST', 'Estonia ');
INSERT INTO cc_country (isocode, name) VALUES ('ETH', 'Ethiopia ');
INSERT INTO cc_country (isocode, name) VALUES ('FRO', 'Faeroe Islands ');
INSERT INTO cc_country (isocode, name) VALUES ('FLK', 'Falkland Islands (Malvinas) ');
INSERT INTO cc_country (isocode, name) VALUES ('FJI', 'Fiji ');
INSERT INTO cc_country (isocode, name) VALUES ('FIN', 'Finland ');
INSERT INTO cc_country (isocode, name) VALUES ('FRA', 'France ');
INSERT INTO cc_country (isocode, name) VALUES ('GUF', 'French Guiana ');
INSERT INTO cc_country (isocode, name) VALUES ('PYF', 'French Polynesia ');
INSERT INTO cc_country (isocode, name) VALUES ('GAB', 'Gabon ');
INSERT INTO cc_country (isocode, name) VALUES ('GMB', 'Gambia ');
INSERT INTO cc_country (isocode, name) VALUES ('GEO', 'Georgia ');
INSERT INTO cc_country (isocode, name) VALUES ('DEU', 'Germany ');
INSERT INTO cc_country (isocode, name) VALUES ('GHA', 'Ghana ');
INSERT INTO cc_country (isocode, name) VALUES ('GIB', 'Gibraltar ');
INSERT INTO cc_country (isocode, name) VALUES ('GRC', 'Greece ');
INSERT INTO cc_country (isocode, name) VALUES ('GRL', 'Greenland ');
INSERT INTO cc_country (isocode, name) VALUES ('GRD', 'Grenada ');
INSERT INTO cc_country (isocode, name) VALUES ('GLP', 'Guadeloupe ');
INSERT INTO cc_country (isocode, name) VALUES ('GUM', 'Guam ');
INSERT INTO cc_country (isocode, name) VALUES ('GTM', 'Guatemala ');
INSERT INTO cc_country (isocode, name) VALUES ('GGY', 'Guernsey');
INSERT INTO cc_country (isocode, name) VALUES ('GIN', 'Guinea ');
INSERT INTO cc_country (isocode, name) VALUES ('GNB', 'Guinea-Bissau ');
INSERT INTO cc_country (isocode, name) VALUES ('GUY', 'Guyana ');
INSERT INTO cc_country (isocode, name) VALUES ('HTI', 'Haiti ');
INSERT INTO cc_country (isocode, name) VALUES ('VAT', 'Holy See ');
INSERT INTO cc_country (isocode, name) VALUES ('HND', 'Honduras ');
INSERT INTO cc_country (isocode, name) VALUES ('HUN', 'Hungary ');
INSERT INTO cc_country (isocode, name) VALUES ('ISL', 'Iceland ');
INSERT INTO cc_country (isocode, name) VALUES ('IND', 'India ');
INSERT INTO cc_country (isocode, name) VALUES ('IDN', 'Indonesia ');
INSERT INTO cc_country (isocode, name) VALUES ('IRN', 'Iran (Islamic Republic of)');
INSERT INTO cc_country (isocode, name) VALUES ('IRQ', 'Iraq ');
INSERT INTO cc_country (isocode, name) VALUES ('IRL', 'Ireland ');
INSERT INTO cc_country (isocode, name) VALUES ('IMN', 'Isle of Man ');
INSERT INTO cc_country (isocode, name) VALUES ('ISR', 'Israel ');
INSERT INTO cc_country (isocode, name) VALUES ('ITA', 'Italy ');
INSERT INTO cc_country (isocode, name) VALUES ('JAM', 'Jamaica ');
INSERT INTO cc_country (isocode, name) VALUES ('JPN', 'Japan ');
INSERT INTO cc_country (isocode, name) VALUES ('JEY', 'Jersey');
INSERT INTO cc_country (isocode, name) VALUES ('JOR', 'Jordan ');
INSERT INTO cc_country (isocode, name) VALUES ('KAZ', 'Kazakhstan ');
INSERT INTO cc_country (isocode, name) VALUES ('KEN', 'Kenya ');
INSERT INTO cc_country (isocode, name) VALUES ('KIR', 'Kiribati ');
INSERT INTO cc_country (isocode, name) VALUES ('KWT', 'Kuwait ');
INSERT INTO cc_country (isocode, name) VALUES ('KGZ', 'Kyrgyzstan ');
INSERT INTO cc_country (isocode, name) VALUES ('LAO', 'Lao People''s Democratic Republic ');
INSERT INTO cc_country (isocode, name) VALUES ('LVA', 'Latvia ');
INSERT INTO cc_country (isocode, name) VALUES ('LBN', 'Lebanon ');
INSERT INTO cc_country (isocode, name) VALUES ('LSO', 'Lesotho ');
INSERT INTO cc_country (isocode, name) VALUES ('LBR', 'Liberia ');
INSERT INTO cc_country (isocode, name) VALUES ('LBY', 'Libyan Arab Jamahiriya ');
INSERT INTO cc_country (isocode, name) VALUES ('LIE', 'Liechtenstein ');
INSERT INTO cc_country (isocode, name) VALUES ('LTU', 'Lithuania ');
INSERT INTO cc_country (isocode, name) VALUES ('LUX', 'Luxembourg ');
INSERT INTO cc_country (isocode, name) VALUES ('MDG', 'Madagascar ');
INSERT INTO cc_country (isocode, name) VALUES ('MWI', 'Malawi ');
INSERT INTO cc_country (isocode, name) VALUES ('MYS', 'Malaysia ');
INSERT INTO cc_country (isocode, name) VALUES ('MDV', 'Maldives ');
INSERT INTO cc_country (isocode, name) VALUES ('MLI', 'Mali ');
INSERT INTO cc_country (isocode, name) VALUES ('MLT', 'Malta ');
INSERT INTO cc_country (isocode, name) VALUES ('MHL', 'Marshall Islands ');
INSERT INTO cc_country (isocode, name) VALUES ('MTQ', 'Martinique ');
INSERT INTO cc_country (isocode, name) VALUES ('MRT', 'Mauritania ');
INSERT INTO cc_country (isocode, name) VALUES ('MUS', 'Mauritius ');
INSERT INTO cc_country (isocode, name) VALUES ('MYT', 'Mayotte');
INSERT INTO cc_country (isocode, name) VALUES ('MEX', 'Mexico ');
INSERT INTO cc_country (isocode, name) VALUES ('FSM', 'Micronesia (Federated States of)');
INSERT INTO cc_country (isocode, name) VALUES ('MCO', 'Monaco ');
INSERT INTO cc_country (isocode, name) VALUES ('MNG', 'Mongolia ');
INSERT INTO cc_country (isocode, name) VALUES ('MNE', 'Montenegro');
INSERT INTO cc_country (isocode, name) VALUES ('MSR', 'Montserrat ');
INSERT INTO cc_country (isocode, name) VALUES ('MAR', 'Morocco ');
INSERT INTO cc_country (isocode, name) VALUES ('MOZ', 'Mozambique ');
INSERT INTO cc_country (isocode, name) VALUES ('MMR', 'Myanmar ');
INSERT INTO cc_country (isocode, name) VALUES ('NAM', 'Namibia ');
INSERT INTO cc_country (isocode, name) VALUES ('NRU', 'Nauru ');
INSERT INTO cc_country (isocode, name) VALUES ('NPL', 'Nepal ');
INSERT INTO cc_country (isocode, name) VALUES ('NLD', 'Netherlands ');
INSERT INTO cc_country (isocode, name) VALUES ('NCL', 'New Caledonia ');
INSERT INTO cc_country (isocode, name) VALUES ('NZL', 'New Zealand ');
INSERT INTO cc_country (isocode, name) VALUES ('NIC', 'Nicaragua ');
INSERT INTO cc_country (isocode, name) VALUES ('NER', 'Niger ');
INSERT INTO cc_country (isocode, name) VALUES ('NGA', 'Nigeria ');
INSERT INTO cc_country (isocode, name) VALUES ('NIU', 'Niue ');
INSERT INTO cc_country (isocode, name) VALUES ('NFK', 'Norfolk Island ');
INSERT INTO cc_country (isocode, name) VALUES ('MNP', 'Northern Mariana Islands ');
INSERT INTO cc_country (isocode, name) VALUES ('NOR', 'Norway ');
INSERT INTO cc_country (isocode, name) VALUES ('PSE', 'Occupied Palestinian Territory ');
INSERT INTO cc_country (isocode, name) VALUES ('OMN', 'Oman ');
INSERT INTO cc_country (isocode, name) VALUES ('PAK', 'Pakistan ');
INSERT INTO cc_country (isocode, name) VALUES ('PLW', 'Palau ');
INSERT INTO cc_country (isocode, name) VALUES ('PAN', 'Panama ');
INSERT INTO cc_country (isocode, name) VALUES ('PNG', 'Papua New Guinea ');
INSERT INTO cc_country (isocode, name) VALUES ('PRY', 'Paraguay ');
INSERT INTO cc_country (isocode, name) VALUES ('PER', 'Peru ');
INSERT INTO cc_country (isocode, name) VALUES ('PHL', 'Philippines ');
INSERT INTO cc_country (isocode, name) VALUES ('PCN', 'Pitcairn ');
INSERT INTO cc_country (isocode, name) VALUES ('POL', 'Poland ');
INSERT INTO cc_country (isocode, name) VALUES ('PRT', 'Portugal ');
INSERT INTO cc_country (isocode, name) VALUES ('PRI', 'Puerto Rico ');
INSERT INTO cc_country (isocode, name) VALUES ('QAT', 'Qatar ');
INSERT INTO cc_country (isocode, name) VALUES ('KOR', 'Republic of Korea ');
INSERT INTO cc_country (isocode, name) VALUES ('MDA', 'Republic of Moldova');
INSERT INTO cc_country (isocode, name) VALUES ('REU', 'Réunion ');
INSERT INTO cc_country (isocode, name) VALUES ('ROU', 'Romania ');
INSERT INTO cc_country (isocode, name) VALUES ('RUS', 'Russian Federation ');
INSERT INTO cc_country (isocode, name) VALUES ('RWA', 'Rwanda ');
INSERT INTO cc_country (isocode, name) VALUES ('BLM', 'Saint-Barthélemy');
INSERT INTO cc_country (isocode, name) VALUES ('SHN', 'Saint Helena ');
INSERT INTO cc_country (isocode, name) VALUES ('KNA', 'Saint Kitts and Nevis ');
INSERT INTO cc_country (isocode, name) VALUES ('LCA', 'Saint Lucia ');
INSERT INTO cc_country (isocode, name) VALUES ('MAF', 'Saint-Martin (French part)');
INSERT INTO cc_country (isocode, name) VALUES ('SPM', 'Saint Pierre and Miquelon ');
INSERT INTO cc_country (isocode, name) VALUES ('VCT', 'Saint Vincent and the Grenadines ');
INSERT INTO cc_country (isocode, name) VALUES ('WSM', 'Samoa ');
INSERT INTO cc_country (isocode, name) VALUES ('SMR', 'San Marino ');
INSERT INTO cc_country (isocode, name) VALUES ('STP', 'Sao Tome and Principe ');
INSERT INTO cc_country (isocode, name) VALUES ('SAU', 'Saudi Arabia ');
INSERT INTO cc_country (isocode, name) VALUES ('SEN', 'Senegal ');
INSERT INTO cc_country (isocode, name) VALUES ('SRB', 'Serbia ');
INSERT INTO cc_country (isocode, name) VALUES ('SYC', 'Seychelles ');
INSERT INTO cc_country (isocode, name) VALUES ('SLE', 'Sierra Leone ');
INSERT INTO cc_country (isocode, name) VALUES ('SGP', 'Singapore ');
INSERT INTO cc_country (isocode, name) VALUES ('SXM', 'Sint Maarten (Dutch part)');
INSERT INTO cc_country (isocode, name) VALUES ('SVK', 'Slovakia ');
INSERT INTO cc_country (isocode, name) VALUES ('SVN', 'Slovenia ');
INSERT INTO cc_country (isocode, name) VALUES ('SLB', 'Solomon Islands ');
INSERT INTO cc_country (isocode, name) VALUES ('SOM', 'Somalia ');
INSERT INTO cc_country (isocode, name) VALUES ('ZAF', 'South Africa ');
INSERT INTO cc_country (isocode, name) VALUES ('ESP', 'Spain ');
INSERT INTO cc_country (isocode, name) VALUES ('LKA', 'Sri Lanka ');
INSERT INTO cc_country (isocode, name) VALUES ('SDN', 'Sudan ');
INSERT INTO cc_country (isocode, name) VALUES ('SUR', 'Suriname ');
INSERT INTO cc_country (isocode, name) VALUES ('SJM', 'Svalbard and Jan Mayen Islands ');
INSERT INTO cc_country (isocode, name) VALUES ('SWZ', 'Swaziland ');
INSERT INTO cc_country (isocode, name) VALUES ('SWE', 'Sweden ');
INSERT INTO cc_country (isocode, name) VALUES ('CHE', 'Switzerland ');
INSERT INTO cc_country (isocode, name) VALUES ('SYR', 'Syrian Arab Republic ');
INSERT INTO cc_country (isocode, name) VALUES ('TJK', 'Tajikistan ');
INSERT INTO cc_country (isocode, name) VALUES ('THA', 'Thailand ');
INSERT INTO cc_country (isocode, name) VALUES ('MKD', 'The former Yugoslav Republic of Macedonia ');
INSERT INTO cc_country (isocode, name) VALUES ('TLS', 'Timor-Leste');
INSERT INTO cc_country (isocode, name) VALUES ('TGO', 'Togo ');
INSERT INTO cc_country (isocode, name) VALUES ('TKL', 'Tokelau ');
INSERT INTO cc_country (isocode, name) VALUES ('TON', 'Tonga ');
INSERT INTO cc_country (isocode, name) VALUES ('TTO', 'Trinidad and Tobago ');
INSERT INTO cc_country (isocode, name) VALUES ('TUN', 'Tunisia ');
INSERT INTO cc_country (isocode, name) VALUES ('TUR', 'Turkey ');
INSERT INTO cc_country (isocode, name) VALUES ('TKM', 'Turkmenistan ');
INSERT INTO cc_country (isocode, name) VALUES ('TCA', 'Turks and Caicos Islands ');
INSERT INTO cc_country (isocode, name) VALUES ('TUV', 'Tuvalu ');
INSERT INTO cc_country (isocode, name) VALUES ('UGA', 'Uganda ');
INSERT INTO cc_country (isocode, name) VALUES ('UKR', 'Ukraine ');
INSERT INTO cc_country (isocode, name) VALUES ('ARE', 'United Arab Emirates ');
INSERT INTO cc_country (isocode, name) VALUES ('GBR', 'United Kingdom of Great Britain and Northern Ireland');
INSERT INTO cc_country (isocode, name) VALUES ('TZA', 'United Republic of Tanzania ');
INSERT INTO cc_country (isocode, name) VALUES ('USA', 'United States of America');
INSERT INTO cc_country (isocode, name) VALUES ('VIR', 'United States Virgin Islands ');
INSERT INTO cc_country (isocode, name) VALUES ('URY', 'Uruguay ');
INSERT INTO cc_country (isocode, name) VALUES ('UZB', 'Uzbekistan ');
INSERT INTO cc_country (isocode, name) VALUES ('VUT', 'Vanuatu ');
INSERT INTO cc_country (isocode, name) VALUES ('VEN', 'Venezuela (Bolivarian Republic of)');
INSERT INTO cc_country (isocode, name) VALUES ('VNM', 'Viet Nam ');
INSERT INTO cc_country (isocode, name) VALUES ('WLF', 'Wallis and Futuna Islands ');
INSERT INTO cc_country (isocode, name) VALUES ('ESH', 'Western Sahara ');
INSERT INTO cc_country (isocode, name) VALUES ('YEM', 'Yemen ');
INSERT INTO cc_country (isocode, name) VALUES ('ZMB', 'Zambia ');
INSERT INTO cc_country (isocode, name) VALUES ('ZWE', 'Zimbabwe ');";
echo "* Inserting data into country table".PHP_EOL;
Airtime190Upgrade::execSqlQuery($sql);
}
public static function SetUniqueId()
{
$con = Propel::getConnection();
$uniqueId = md5(uniqid("", true));
$sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('uniqueId', '$uniqueId')";
$result = $con->exec($sql);
if ($result < 1) {
return false;
}
return true;
}
public static function SetImportTimestamp()
{
$con = Propel::getConnection();
$sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('import_timestamp', '0')";
$result = $con->exec($sql);
if ($result < 1) {
return false;
}
return true;
}
}
class AirtimeIni{
const CONF_FILE_AIRTIME = "/etc/airtime/airtime.conf";
const CONF_FILE_PYPO = "/etc/airtime/pypo.cfg";
const CONF_FILE_RECORDER = "/etc/airtime/recorder.cfg";
const CONF_FILE_LIQUIDSOAP = "/etc/airtime/liquidsoap.cfg";
const CONF_FILE_MEDIAMONITOR = "/etc/airtime/media-monitor.cfg";
const CONF_FILE_API_CLIENT = "/etc/airtime/api_client.cfg";
const CONF_FILE_MONIT = "/etc/monit/conf.d/airtime-monit.cfg";
/**
* This function updates an INI style config file.
*
* A property and the value the property should be changed to are
* supplied. If the property is not found, then no changes are made.
*
* @param string $p_filename
* The path the to the file.
* @param string $p_property
* The property to look for in order to change its value.
* @param string $p_value
* The value the property should be changed to.
*
*/
public static function UpdateIniValue($p_filename, $p_property, $p_value)
{
$lines = file($p_filename);
$n=count($lines);
foreach ($lines as &$line) {
if ($line[0] != "#"){
$key_value = explode("=", $line);
$key = trim($key_value[0]);
if ($key == $p_property){
$line = "$p_property = $p_value".PHP_EOL;
}
}
}
$fp=fopen($p_filename, 'w');
for($i=0; $i<$n; $i++){
fwrite($fp, $lines[$i]);
}
fclose($fp);
}
public static function CreateMonitFile(){
if (!copy(__DIR__."/airtime-monit.cfg.190", AirtimeIni::CONF_FILE_MONIT)){
echo "Could not copy airtime-monit.cfg to /etc/monit/conf.d/. Exiting.";
exit(1);
}
}
public static function ReadPythonConfig($p_filename)
{
$values = array();
$lines = file($p_filename);
$n=count($lines);
for ($i=0; $i<$n; $i++) {
if (strlen($lines[$i]) && !in_array(substr($lines[$i], 0, 1), array('#', PHP_EOL))){
$info = explode("=", $lines[$i]);
$values[trim($info[0])] = trim($info[1]);
}
}
return $values;
}
public static function MergeConfigFiles($configFiles, $suffix) {
foreach ($configFiles as $conf) {
if (file_exists("$conf$suffix.bak")) {
if($conf === AirtimeIni::CONF_FILE_AIRTIME) {
// Parse with sections
$newSettings = parse_ini_file($conf, true);
$oldSettings = parse_ini_file("$conf$suffix.bak", true);
}
else {
$newSettings = AirtimeIni::ReadPythonConfig($conf);
$oldSettings = AirtimeIni::ReadPythonConfig("$conf$suffix.bak");
}
$settings = array_keys($newSettings);
foreach($settings as $section) {
if(isset($oldSettings[$section])) {
if(is_array($oldSettings[$section])) {
$sectionKeys = array_keys($newSettings[$section]);
foreach($sectionKeys as $sectionKey) {
if(isset($oldSettings[$section][$sectionKey])) {
AirtimeIni::UpdateIniValue($conf, $sectionKey, $oldSettings[$section][$sectionKey]);
}
}
}
else {
AirtimeIni::UpdateIniValue($conf, $section, $oldSettings[$section]);
}
}
}
}
}
}
public static function upgradeConfigFiles(){
$configFiles = array(AirtimeIni::CONF_FILE_AIRTIME,
AirtimeIni::CONF_FILE_PYPO,
AirtimeIni::CONF_FILE_RECORDER,
AirtimeIni::CONF_FILE_LIQUIDSOAP);
// Backup the config files
$suffix = date("Ymdhis")."-1.9.0";
foreach ($configFiles as $conf) {
if (file_exists($conf)) {
echo "Backing up $conf to $conf$suffix.bak".PHP_EOL;
copy($conf, $conf.$suffix.".bak");
}
}
$default_suffix = "190";
AirtimeIni::CreateIniFiles($default_suffix);
AirtimeIni::MergeConfigFiles($configFiles, $suffix);
}
/**
* This function creates the /etc/airtime configuration folder
* and copies the default config files to it.
*/
public static function CreateIniFiles($suffix)
{
if (!file_exists("/etc/airtime/")){
if (!mkdir("/etc/airtime/", 0755, true)){
echo "Could not create /etc/airtime/ directory. Exiting.";
exit(1);
}
}
if (!copy(__DIR__."/airtime.conf.$suffix", AirtimeIni::CONF_FILE_AIRTIME)){
echo "Could not copy airtime.conf to /etc/airtime/. Exiting.";
exit(1);
}
if (!copy(__DIR__."/pypo.cfg.$suffix", AirtimeIni::CONF_FILE_PYPO)){
echo "Could not copy pypo.cfg to /etc/airtime/. Exiting.";
exit(1);
}
if (!copy(__DIR__."/recorder.cfg.$suffix", AirtimeIni::CONF_FILE_RECORDER)){
echo "Could not copy recorder.cfg to /etc/airtime/. Exiting.";
exit(1);
}
if (!copy(__DIR__."/liquidsoap.cfg.$suffix", AirtimeIni::CONF_FILE_LIQUIDSOAP)){
echo "Could not copy liquidsoap.cfg to /etc/airtime/. Exiting.";
exit(1);
}
}
}
class Airtime190Upgrade{
public static function InstallAirtimePhpServerCode($phpDir)
{
// delete old files
exec("rm -rf ".$phpDir);
$AIRTIME_SRC = realpath(__DIR__.'/../../../airtime_mvc');
echo "* Installing PHP code to ".$phpDir.PHP_EOL;
exec("mkdir -p ".$phpDir);
exec("cp -R ".$AIRTIME_SRC."/* ".$phpDir);
}
public static function CopyUtils()
{
$utilsSrc = __DIR__."/../../../utils";
echo "* Installing binaries to ".CONF_DIR_BINARIES.PHP_EOL;
exec("mkdir -p ".CONF_DIR_BINARIES);
exec("cp -R ".$utilsSrc." ".CONF_DIR_BINARIES);
}
/* Removes pypo, media-monitor, show-recorder and utils from system. These will
* be reinstalled by the main airtime-upgrade script.
*/
public static function UninstallBinaries()
{
echo "* Removing Airtime binaries from ".CONF_DIR_BINARIES.PHP_EOL;
$command = "rm -rf $(ls -d /usr/lib/airtime/* | grep -v airtime_virtualenv)";
exec($command);
}
public static function execSqlQuery($sql)
{
$result = 0;
try {
$con = Propel::getConnection();
$result = $con->exec($sql);
} catch (Exception $e) {
echo "* Failed sql query: $sql".PHP_EOL;
echo "* Message {$e->getMessage()}".PHP_EOL;
}
return $result;
}
public static function connectToDatabase()
{
try {
$con = Propel::getConnection();
} catch (Exception $e) {
echo $e->getMessage().PHP_EOL;
echo "Database connection problem.".PHP_EOL;
echo "Check if database exists with corresponding permissions.".PHP_EOL;
return false;
}
return true;
}
public static function backupFileInfoInStorToFile($values) {
echo "Save DbMd to File".PHP_EOL;
/* Do not use realpath. It expands a symlinked path into its real path
* which then causes us problems for string comparisons later on. */
//$stor_dir = realpath($values['general']['base_files_dir']."/stor");
$baseDir = $values['general']['base_files_dir'];
if ($baseDir[strlen($baseDir)-1] != '/'){
$baseDir.='/';
}
$stor_dir = $baseDir.'stor';
$files = CcFilesQuery::create()
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)
->find();
$dumpFile = __DIR__."/storDump.txt";
$fh = fopen($dumpFile, 'w') or die("can't open file to backup stor.");
$s = "SF_BACKUP_1.9.0";
foreach ($files as $file) {
$filepath = $file->getDbFilepath();
if (substr($filepath, 0, strlen($stor_dir)) == $stor_dir) {
$recorded_show = CcShowInstancesQuery::create()
->filterByDbRecordedFile($file->getDbId())
->findOne();
if (isset($recorded_show)) {
$start_time = $recorded_show->getDbStarts();
$title = $file->getDbTrackTitle();
$start_time = str_replace(" ", "-", $start_time);
$start_time = str_replace(":", "-", $start_time);
//$start_time like yyyy-mm-dd-hh-MM-ss
list($yyyy, $mm, $dd, $hh, $MM, $ss) = explode("-", $start_time);
$data = "1$s$filepath$s$title$s$yyyy$s$mm$s$dd$s$hh$s$MM\n";
}
else {
$artist = $file->getDbArtistName();
$album = $file->getDbAlbumTitle();
$track = $file->getDbTrackNumber();
$title = $file->getDbTrackTitle();
$data = "0$s$filepath$s$title$s$artist$s$album$s$track\n";
}
fwrite($fh, $data);
}
}
fclose($fh);
}
/* Old database had a "fullpath" column that stored the absolute path of each track. We have to
* change it so that the "fullpath" column has path relative to the "directory" column.
*/
public static function installMediaMonitor($values){
$propel_stor_dir = CcMusicDirsQuery::create()
->filterByType('stor')
->findOne();
$propel_link_dir = CcMusicDirsQuery::create()
->filterByType('link')
->findOne();
/* Handle Database Changes. */
$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;
$propel_stor_dir->setDirectory($stor_dir);
$propel_stor_dir->save();
echo "Creating media-monitor log file".PHP_EOL;
mkdir("/var/log/airtime/media-monitor/", 755, true);
touch("/var/log/airtime/media-monitor/media-monitor.log");
/* create media monitor config: */
if (!copy(__DIR__."/media-monitor.cfg.190", AirtimeIni::CONF_FILE_MEDIAMONITOR)){
echo "Could not copy media-monitor.cfg to /etc/airtime/. Exiting.";
}
if (!copy(__DIR__."/api_client.cfg.190", AirtimeIni::CONF_FILE_API_CLIENT)){
echo "Could not copy api_client.cfg to /etc/airtime/. Exiting.";
}
AirtimeIni::UpdateIniValue(AirtimeIni::CONF_FILE_API_CLIENT, "api_key", $values["general"]["api_key"]);
echo "Reorganizing files in stor directory".PHP_EOL;
$cwd = __DIR__;
$mediaMonitorUpgradePath = __DIR__."/media-monitor-upgrade.py";
$command = "cd $cwd && python $mediaMonitorUpgradePath";
exec($command, $output);
print_r($output);
if (isset($output[0])) {
$oldAndNewFileNames = json_decode($output[0]);
$stor_dir_id = $propel_stor_dir->getId();
foreach ($oldAndNewFileNames as $pair){
$relPathNew = pg_escape_string(substr($pair[1], strlen($stor_dir)));
$absPathOld = pg_escape_string($pair[0]);
$sql = "UPDATE cc_files SET filepath = '$relPathNew', directory=$stor_dir_id WHERE filepath = '$absPathOld'";
echo $sql.PHP_EOL;
Airtime190Upgrade::execSqlQuery($sql);
}
}
echo "Upgrading Linked Files".PHP_EOL;
//HANDLE LINKED FILES HERE.
$db_files = CcFilesQuery::create()
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)
->filterByDbDirectory(NULL)
->find();
//Check to see if the file still exists. (Could have still some entries under the stor dir or linked files that don't exist)
$link_dir_id = $propel_link_dir->getId();
foreach($db_files as $db_file) {
$filepath = $db_file->getDbFilepath();
echo $filepath.PHP_EOL;
if (!file_exists($filepath)) {
$db_file->delete();
echo "Removed Missing File: ".$filepath.PHP_EOL;
}
else {
$db_file->setDbDirectory($link_dir_id);
$db_file->save();
}
}
}
}
AirtimeInstall::CreateZendPhpLogFile();
/* In version 1.9.0 we have have switched from daemontools to more traditional
* init.d daemon system. Let's remove all the daemontools files
*/
exec("/usr/bin/airtime-pypo-stop");
exec("/usr/bin/airtime-show-recorder-stop");
exec("svc -dx /etc/service/pypo");
exec("svc -dx /etc/service/pypo/log");
exec("svc -dx /etc/service/pypo-liquidsoap");
exec("svc -dx /etc/service/pypo-liquidsoap/log");
exec("svc -dx /etc/service/recorder");
exec("svc -dx /etc/service/recorder/log");
exec("killall supervise");
exec("killall liquidsoap");
$pathnames = array("/usr/bin/airtime-pypo-start",
"/usr/bin/airtime-pypo-stop",
"/usr/bin/airtime-show-recorder-start",
"/usr/bin/airtime-show-recorder-stop",
"/usr/bin/airtime-media-monitor-start",
"/usr/bin/airtime-media-monitor-stop",
"/etc/service/pypo",
"/etc/service/pypo-liquidsoap",
"/etc/service/media-monitor",
"/etc/service/recorder",
"/var/log/airtime/pypo/main",
"/var/log/airtime/pypo-liquidsoap/main",
"/var/log/airtime/show-recorder/main"
);
foreach ($pathnames as $pn){
echo "Removing $pn\n";
exec("rm -rf \"$pn\"");
}
/* update Airtime Server PHP files */
$values = parse_ini_file(AirtimeIni::CONF_FILE_AIRTIME, true);
$phpDir = $values['general']['airtime_dir'];
Airtime190Upgrade::InstallAirtimePhpServerCode($phpDir);
/* update utils (/usr/lib/airtime) folder */
Airtime190Upgrade::UninstallBinaries();
Airtime190Upgrade::CopyUtils();
/* James made a new airtime-import script, lets remove the old airtime-import php script,
*install the new airtime-import.py script and update the /usr/bin/symlink.
*/
// we don't need thses functions anymore as it's done in CreateSymlinksToUtils()
/*Airtime190Upgrade::removeOldAirtimeImport();
Airtime190Upgrade::updateAirtimeImportSymLink();*/
Airtime190Upgrade::connectToDatabase();
if(AirtimeInstall::DbTableExists('doctrine_migration_versions') === false) {
$migrations = array('20110312121200', '20110331111708', '20110402164819', '20110406182005');
foreach($migrations as $migration) {
AirtimeInstall::BypassMigrations(__DIR__, $migration);
}
}
/* adding music_dir and country table. 20110629143017 and 20110713161043 respetivly */
AirtimeInstall::MigrateTablesToVersion(__DIR__, '20110713161043');
AirtimeInstall::InsertCountryDataIntoDatabase();
// set up some keys in DB
AirtimeInstall::SetUniqueId();
AirtimeInstall::SetImportTimestamp();
AirtimeIni::CreateMonitFile();
exec("/etc/init.d/monit start");
AirtimeInstall::CreateSymlinksToUtils();
/* create cron file for phone home stat */
AirtimeInstall::CreateCronFile();
Airtime190Upgrade::backupFileInfoInStorToFile($values);
Airtime190Upgrade::installMediaMonitor($values);
AirtimeIni::upgradeConfigFiles();

View File

@ -1,23 +0,0 @@
[database]
host = localhost
dbname = airtime
dbuser = airtime
dbpass = airtime
[rabbitmq]
host = 127.0.0.1
port = 5672
user = guest
password = guest
vhost = /
[general]
api_key = AAA
web_server_user = www-data
airtime_dir = x
base_url = localhost
base_port = 80
[soundcloud]
connection_retries = 3
time_between_retries = 60

View File

@ -1,197 +0,0 @@
import os
import hashlib
import mutagen
import logging
import math
import re
def to_unicode(obj, encoding='utf-8'):
if isinstance(obj, basestring):
if not isinstance(obj, unicode):
obj = unicode(obj, encoding)
return obj
def encode_to(obj, encoding='utf-8'):
if isinstance(obj, basestring):
if not isinstance(obj, str):
obj = obj.encode(encoding)
return obj
"""
list of supported easy tags in mutagen version 1.20
['albumartistsort', 'musicbrainz_albumstatus', 'lyricist', 'releasecountry', 'date', 'performer', 'musicbrainz_albumartistid', 'composer', 'encodedby', 'tracknumber', 'musicbrainz_albumid', 'album', 'asin', 'musicbrainz_artistid', 'mood', 'copyright', 'author', 'media', 'length', 'version', 'artistsort', 'titlesort', 'discsubtitle', 'website', 'musicip_fingerprint', 'conductor', 'compilation', 'barcode', 'performer:*', 'composersort', 'musicbrainz_discid', 'musicbrainz_albumtype', 'genre', 'isrc', 'discnumber', 'musicbrainz_trmid', 'replaygain_*_gain', 'musicip_puid', 'artist', 'title', 'bpm', 'musicbrainz_trackid', 'arranger', 'albumsort', 'replaygain_*_peak', 'organization']
"""
class AirtimeMetadata:
def __init__(self):
self.airtime2mutagen = {\
"MDATA_KEY_TITLE": "title",\
"MDATA_KEY_CREATOR": "artist",\
"MDATA_KEY_SOURCE": "album",\
"MDATA_KEY_GENRE": "genre",\
"MDATA_KEY_MOOD": "mood",\
"MDATA_KEY_TRACKNUMBER": "tracknumber",\
"MDATA_KEY_BPM": "bpm",\
"MDATA_KEY_LABEL": "organization",\
"MDATA_KEY_COMPOSER": "composer",\
"MDATA_KEY_ENCODER": "encodedby",\
"MDATA_KEY_CONDUCTOR": "conductor",\
"MDATA_KEY_YEAR": "date",\
"MDATA_KEY_URL": "website",\
"MDATA_KEY_ISRC": "isrc",\
"MDATA_KEY_COPYRIGHT": "copyright",\
}
self.mutagen2airtime = {\
"title": "MDATA_KEY_TITLE",\
"artist": "MDATA_KEY_CREATOR",\
"album": "MDATA_KEY_SOURCE",\
"genre": "MDATA_KEY_GENRE",\
"mood": "MDATA_KEY_MOOD",\
"tracknumber": "MDATA_KEY_TRACKNUMBER",\
"bpm": "MDATA_KEY_BPM",\
"organization": "MDATA_KEY_LABEL",\
"composer": "MDATA_KEY_COMPOSER",\
"encodedby": "MDATA_KEY_ENCODER",\
"conductor": "MDATA_KEY_CONDUCTOR",\
"date": "MDATA_KEY_YEAR",\
"website": "MDATA_KEY_URL",\
"isrc": "MDATA_KEY_ISRC",\
"copyright": "MDATA_KEY_COPYRIGHT",\
}
self.logger = logging.getLogger()
def get_md5(self, filepath):
f = open(filepath, 'rb')
m = hashlib.md5()
m.update(f.read())
md5 = m.hexdigest()
return md5
## mutagen_length is in seconds with the format (d+).dd
## return format hh:mm:ss.uuu
def format_length(self, mutagen_length):
t = float(mutagen_length)
h = int(math.floor(t/3600))
t = t % 3600
m = int(math.floor(t/60))
s = t % 60
# will be ss.uuu
s = str(s)
seconds = s.split(".")
s = seconds[0]
# have a maximum of 6 subseconds.
if len(seconds[1]) >= 6:
ss = seconds[1][0:6]
else:
ss = seconds[1][0:]
length = "%s:%s:%s.%s" % (h, m, s, ss)
return length
def save_md_to_file(self, m):
try:
airtime_file = mutagen.File(m['MDATA_KEY_FILEPATH'], easy=True)
for key in m.keys() :
if key in self.airtime2mutagen:
value = m[key]
if (value is not None):
self.logger.debug("Saving %s to file", key)
self.logger.debug(value)
if isinstance(value, basestring) and (len(value) > 0):
airtime_file[self.airtime2mutagen[key]] = unicode(value, "utf-8")
elif isinstance(value, int):
airtime_file[self.airtime2mutagen[key]] = str(value)
airtime_file.save()
except Exception, e:
self.logger.error('Trying to save md')
self.logger.error('Exception: %s', e)
self.logger.error('Filepath %s', m['MDATA_KEY_FILEPATH'])
def get_md_from_file(self, filepath):
self.logger.info("getting info from filepath %s", filepath)
try:
md = {}
md5 = self.get_md5(filepath)
md['MDATA_KEY_MD5'] = md5
file_info = mutagen.File(filepath, easy=True)
except Exception, e:
self.logger.error("failed getting metadata from %s", filepath)
self.logger.error("Exception %s", e)
return None
self.logger.info(file_info)
if file_info is None:
return None
#check if file has any metadata
if file_info is not None:
for key in file_info.keys() :
if key in self.mutagen2airtime :
md[self.mutagen2airtime[key]] = file_info[key][0]
if 'MDATA_KEY_TITLE' not in md:
#get rid of file extention from original name, name might have more than 1 '.' in it.
#filepath = to_unicode(filepath)
#filepath = filepath.encode('utf-8')
original_name = os.path.basename(filepath)
original_name = original_name.split(".")[0:-1]
original_name = ''.join(original_name)
md['MDATA_KEY_TITLE'] = original_name
#incase track number is in format u'4/11'
#need to also check that the tracknumber is even a tracknumber (cc-2582)
if 'MDATA_KEY_TRACKNUMBER' in md:
try:
md['MDATA_KEY_TRACKNUMBER'] = int(md['MDATA_KEY_TRACKNUMBER'])
except Exception, e:
pass
if isinstance(md['MDATA_KEY_TRACKNUMBER'], basestring):
match = re.search('^(\d*/\d*)?', md['MDATA_KEY_TRACKNUMBER'])
if match.group(0) is not u'':
md['MDATA_KEY_TRACKNUMBER'] = int(md['MDATA_KEY_TRACKNUMBER'].split("/")[0])
else:
del md['MDATA_KEY_TRACKNUMBER']
#make sure bpm is valid, need to check more types of formats for this tag to assure correct parsing.
if 'MDATA_KEY_BPM' in md:
if isinstance(md['MDATA_KEY_BPM'], basestring):
try:
md['MDATA_KEY_BPM'] = int(md['MDATA_KEY_BPM'])
except Exception, e:
del md['MDATA_KEY_BPM']
md['MDATA_KEY_BITRATE'] = file_info.info.bitrate
md['MDATA_KEY_SAMPLERATE'] = file_info.info.sample_rate
md['MDATA_KEY_DURATION'] = self.format_length(file_info.info.length)
md['MDATA_KEY_MIME'] = file_info.mime[0]
if "mp3" in md['MDATA_KEY_MIME']:
md['MDATA_KEY_FTYPE'] = "audioclip"
elif "vorbis" in md['MDATA_KEY_MIME']:
md['MDATA_KEY_FTYPE'] = "audioclip"
#do this so object can be urlencoded properly.
for key in md.keys():
if (isinstance(md[key], basestring)):
#self.logger.info("Converting md[%s] = '%s' ", key, md[key])
md[key] = encode_to(md[key], 'utf-8')
#self.logger.info("Converting complete: md[%s] = '%s' ", key, md[key])
return md

View File

@ -1,24 +0,0 @@
import sys
from configobj import ConfigObj
class AirtimeMediaConfig:
MODE_CREATE = "create"
MODE_MODIFY = "modify"
MODE_MOVED = "moved"
MODE_DELETE = "delete"
def __init__(self, logger):
# loading config file
try:
config = ConfigObj('/etc/airtime/media-monitor.cfg')
self.cfg = config
except Exception, e:
logger.info('Error loading config: ', e)
sys.exit()
self.storage_directory = None

View File

@ -1,260 +0,0 @@
import os
import grp
import pwd
import logging
from subprocess import Popen, PIPE
from airtimemetadata import AirtimeMetadata
def encode_to(obj, encoding='utf-8'):
if isinstance(obj, basestring):
if not isinstance(obj, str):
obj = obj.encode(encoding)
return obj
class MediaMonitorCommon:
timestamp_file = "/var/tmp/airtime/last_index"
def __init__(self, airtime_config):
self.supported_file_formats = ['mp3', 'ogg']
self.logger = logging.getLogger()
self.config = airtime_config
self.md_manager = AirtimeMetadata()
def is_parent_directory(self, filepath, directory):
filepath = os.path.normpath(filepath)
directory = os.path.normpath(directory)
return (directory == filepath[0:len(directory)])
def is_temp_file(self, filename):
info = filename.split(".")
if(info[-2] in self.supported_file_formats):
return True
else:
return False
def is_audio_file(self, filename):
info = filename.split(".")
if(info[-1] in self.supported_file_formats):
return True
else:
return False
#check if file is readable by "nobody"
def has_correct_permissions(self, filepath):
#drop root permissions and become "nobody"
os.seteuid(65534)
try:
open(filepath)
readable = True
except IOError:
self.logger.warn("File does not have correct permissions: '%s'", filepath)
readable = False
except Exception, e:
self.logger.error("Unexpected exception thrown: %s", e)
readable = False
finally:
#reset effective user to root
os.seteuid(0)
return readable
def set_needed_file_permissions(self, item, is_dir):
try:
omask = os.umask(0)
uid = pwd.getpwnam('www-data')[2]
gid = grp.getgrnam('www-data')[2]
os.chown(item, uid, gid)
if is_dir is True:
os.chmod(item, 02777)
else:
os.chmod(item, 0666)
except Exception, e:
self.logger.error("Failed to change file's owner/group/permissions. %s", e)
finally:
os.umask(omask)
#checks if path is a directory, and if it doesnt exist, then creates it.
#Otherwise prints error to log file.
def ensure_is_dir(self, directory):
try:
omask = os.umask(0)
if not os.path.exists(directory):
os.makedirs(directory, 02777)
elif not os.path.isdir(directory):
#path exists but it is a file not a directory!
self.logger.error("path %s exists, but it is not a directory!!!")
finally:
os.umask(omask)
#moves file from source to dest but also recursively removes the
#the source file's parent directories if they are now empty.
def move_file(self, source, dest):
try:
omask = os.umask(0)
os.rename(source, dest)
except Exception, e:
self.logger.error("failed to move file. %s", e)
finally:
os.umask(omask)
dir = os.path.dirname(source)
self.cleanup_empty_dirs(dir)
#keep moving up the file hierarchy and deleting parent
#directories until we hit a non-empty directory, or we
#hit the organize dir.
def cleanup_empty_dirs(self, dir):
if os.path.normpath(dir) != self.config.organize_directory:
if len(os.listdir(dir)) == 0:
os.rmdir(dir)
pdir = os.path.dirname(dir)
self.cleanup_empty_dirs(pdir)
#checks if path exists already in stor. If the path exists and the md5s are the
#same just overwrite.
def create_unique_filename(self, filepath, old_filepath):
try:
if(os.path.exists(filepath)):
self.logger.info("Path %s exists", filepath)
self.logger.info("Checking if md5s are the same.")
md5_fp = self.md_manager.get_md5(filepath)
md5_ofp = self.md_manager.get_md5(old_filepath)
if(md5_fp == md5_ofp):
self.logger.info("Md5s are the same, moving to same filepath.")
return filepath
self.logger.info("Md5s aren't the same, appending to filepath.")
file_dir = os.path.dirname(filepath)
filename = os.path.basename(filepath).split(".")[0]
#will be in the format .ext
file_ext = os.path.splitext(filepath)[1]
i = 1;
while(True):
new_filepath = '%s/%s(%s)%s' % (file_dir, filename, i, file_ext)
self.logger.error("Trying %s", new_filepath)
if(os.path.exists(new_filepath)):
i = i+1;
else:
filepath = new_filepath
break
except Exception, e:
self.logger.error("Exception %s", e)
return filepath
#create path in /srv/airtime/stor/imported/[song-metadata]
def create_file_path(self, original_path, orig_md):
storage_directory = self.config.storage_directory
is_recorded_show = False
try:
#will be in the format .ext
file_ext = os.path.splitext(original_path)[1]
file_ext = encode_to(file_ext, 'utf-8')
path_md = ['MDATA_KEY_TITLE', 'MDATA_KEY_CREATOR', 'MDATA_KEY_SOURCE', 'MDATA_KEY_TRACKNUMBER', 'MDATA_KEY_BITRATE']
md = {}
for m in path_md:
if m not in orig_md:
md[m] = encode_to(u'unknown', 'utf-8')
else:
#get rid of any "/" which will interfere with the filepath.
if isinstance(orig_md[m], basestring):
md[m] = orig_md[m].replace("/", "-")
else:
md[m] = orig_md[m]
if 'MDATA_KEY_TRACKNUMBER' in orig_md:
#make sure all track numbers are at least 2 digits long in the filepath.
md['MDATA_KEY_TRACKNUMBER'] = "%02d" % (int(md['MDATA_KEY_TRACKNUMBER']))
#format bitrate as 128kbps
md['MDATA_KEY_BITRATE'] = str(md['MDATA_KEY_BITRATE']/1000)+"kbps"
filepath = None
#file is recorded by Airtime
#/srv/airtime/stor/recorded/year/month/year-month-day-time-showname-bitrate.ext
if(md['MDATA_KEY_CREATOR'] == encode_to("Airtime Show Recorder", 'utf-8')):
#yyyy-mm-dd-hh-MM-ss
y = orig_md['MDATA_KEY_YEAR'].split("-")
filepath = '%s/%s/%s/%s/%s-%s-%s%s' % (storage_directory, encode_to("recorded", 'utf-8'), y[0], y[1], orig_md['MDATA_KEY_YEAR'], md['MDATA_KEY_TITLE'], md['MDATA_KEY_BITRATE'], file_ext)
#"Show-Title-2011-03-28-17:15:00"
title = md['MDATA_KEY_TITLE'].split("-")
show_hour = title[0]
show_min = title[1]
show_sec = title[2]
show_name = '-'.join(title[3:])
new_md = {}
new_md["MDATA_KEY_FILEPATH"] = original_path
new_md['MDATA_KEY_TITLE'] = '%s-%s-%s:%s:%s' % (show_name, orig_md['MDATA_KEY_YEAR'], show_hour, show_min, show_sec)
self.md_manager.save_md_to_file(new_md)
elif(md['MDATA_KEY_TRACKNUMBER'] == encode_to(u'unknown', 'utf-8')):
filepath = '%s/%s/%s/%s/%s-%s%s' % (storage_directory, encode_to("imported", 'utf-8'), md['MDATA_KEY_CREATOR'], md['MDATA_KEY_SOURCE'], md['MDATA_KEY_TITLE'], md['MDATA_KEY_BITRATE'], file_ext)
else:
filepath = '%s/%s/%s/%s/%s-%s-%s%s' % (storage_directory, encode_to("imported", 'utf-8'), md['MDATA_KEY_CREATOR'], md['MDATA_KEY_SOURCE'], md['MDATA_KEY_TRACKNUMBER'], md['MDATA_KEY_TITLE'], md['MDATA_KEY_BITRATE'], file_ext)
filepath = self.create_unique_filename(filepath, original_path)
self.logger.info('Unique filepath: %s', filepath)
self.ensure_is_dir(os.path.dirname(filepath))
except Exception, e:
self.logger.error('Exception: %s', e)
return filepath
def exec_command(self, command):
p = Popen(command, shell=True, stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate()
if p.returncode != 0:
self.logger.warn("command \n%s\n return with a non-zero return value", command)
self.logger.error(stderr)
return stdout
def scan_dir_for_new_files(self, dir):
command = 'find "%s" -type f -iname "*.ogg" -o -iname "*.mp3" -readable' % dir.replace('"', '\\"')
self.logger.debug(command)
stdout = self.exec_command(command)
return stdout.splitlines()
def touch_index_file(self):
open(self.timestamp_file, "w")
def organize_new_file(self, pathname):
self.logger.info("Organizing new file: %s", pathname)
file_md = self.md_manager.get_md_from_file(pathname)
if file_md is not None:
filepath = self.create_file_path(pathname, file_md)
self.logger.debug("Moving from %s to %s", pathname, filepath)
self.move_file(pathname, filepath)
else:
filepath = None
self.logger.warn("File %s, has invalid metadata", pathname)
return filepath

View File

@ -1,89 +0,0 @@
bin_dir = "/usr/lib/airtime/api_clients"
#############################
## Common
#############################
# Value needed to access the API
api_key = 'AAA'
# Path to the base of the API
api_base = 'api'
# URL to get the version number of the server API
version_url = 'version/api_key/%%api_key%%'
# Hostname
base_url = 'localhost'
base_port = 80
#############################
## Config for Media Monitor
#############################
# URL to setup the media monitor
media_setup_url = 'media-monitor-setup/format/json/api_key/%%api_key%%'
# Tell Airtime the file id associated with a show instance.
upload_recorded = 'upload-recorded/format/json/api_key/%%api_key%%/fileid/%%fileid%%/showinstanceid/%%showinstanceid%%'
# URL to tell Airtime to update file's meta data
update_media_url = 'reload-metadata/format/json/api_key/%%api_key%%/mode/%%mode%%'
# URL to tell Airtime we want a listing of all files it knows about
list_all_db_files = 'list-all-files/format/json/api_key/%%api_key%%/dir_id/%%dir_id%%'
# URL to tell Airtime we want a listing of all dirs its watching (including the stor dir)
list_all_watched_dirs = 'list-all-watched-dirs/format/json/api_key/%%api_key%%'
# URL to tell Airtime we want to add watched directory
add_watched_dir = 'add-watched-dir/format/json/api_key/%%api_key%%/path/%%path%%'
# URL to tell Airtime we want to add watched directory
remove_watched_dir = 'remove-watched-dir/format/json/api_key/%%api_key%%/path/%%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
#############################
# URL to get the schedule of shows set to record
show_schedule_url = 'recorded-shows/format/json/api_key/%%api_key%%'
# URL to upload the recorded show's file to Airtime
upload_file_url = 'upload-file/format/json/api_key/%%api_key%%'
#number of retries to upload file if connection problem
upload_retries = 3
#time to wait between attempts to upload file if connection problem (in seconds)
upload_wait = 60
################################################################################
# Uncomment *one of the sets* of values from the API clients below, and comment
# out all the others.
################################################################################
#############################
## Config for Pypo
#############################
# 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
export_url = 'schedule/api_key/%%api_key%%'
get_media_url = 'get-media/file/%%file%%/api_key/%%api_key%%'
# Update whether a schedule group has begun playing.
update_item_url = 'notify-schedule-group-play/api_key/%%api_key%%/schedule_id/%%schedule_id%%'
# Update whether an audio clip is currently playing.
update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/media_id/%%media_id%%/schedule_id/%%schedule_id%%'
# ???
generate_range_url = 'generate_range_dp.php'

View File

@ -1,74 +0,0 @@
<?php
/* THIS FILE IS NOT MEANT FOR CUSTOMIZING.
* PLEASE EDIT THE FOLLOWING TO CHANGE YOUR CONFIG:
* /etc/airtime/airtime.conf
* /etc/airtime/pypo.cfg
* /etc/airtime/recorder.cfg
*/
global $CC_CONFIG;
$CC_CONFIG = array(
// prefix for table names in the database
'tblNamePrefix' => 'cc_',
/* ================================================ storage configuration */
'soundcloud-client-id' => '2CLCxcSXYzx7QhhPVHN4A',
'soundcloud-client-secret' => 'pZ7beWmF06epXLHVUP1ufOg2oEnIt9XhE8l8xt0bBs',
"rootDir" => __DIR__."/../.."
);
$CC_CONFIG = Config::loadConfig($CC_CONFIG);
// Add database table names
$CC_CONFIG['playListTable'] = $CC_CONFIG['tblNamePrefix'].'playlist';
$CC_CONFIG['playListContentsTable'] = $CC_CONFIG['tblNamePrefix'].'playlistcontents';
$CC_CONFIG['filesTable'] = $CC_CONFIG['tblNamePrefix'].'files';
$CC_CONFIG['accessTable'] = $CC_CONFIG['tblNamePrefix'].'access';
$CC_CONFIG['permTable'] = $CC_CONFIG['tblNamePrefix'].'perms';
$CC_CONFIG['sessTable'] = $CC_CONFIG['tblNamePrefix'].'sess';
$CC_CONFIG['subjTable'] = $CC_CONFIG['tblNamePrefix'].'subjs';
$CC_CONFIG['smembTable'] = $CC_CONFIG['tblNamePrefix'].'smemb';
$CC_CONFIG['prefTable'] = $CC_CONFIG['tblNamePrefix'].'pref';
$CC_CONFIG['scheduleTable'] = $CC_CONFIG['tblNamePrefix'].'schedule';
$CC_CONFIG['playListTimeView'] = $CC_CONFIG['tblNamePrefix'].'playlisttimes';
$CC_CONFIG['showSchedule'] = $CC_CONFIG['tblNamePrefix'].'show_schedule';
$CC_CONFIG['showDays'] = $CC_CONFIG['tblNamePrefix'].'show_days';
$CC_CONFIG['showTable'] = $CC_CONFIG['tblNamePrefix'].'show';
$CC_CONFIG['showInstances'] = $CC_CONFIG['tblNamePrefix'].'show_instances';
$CC_CONFIG['playListSequence'] = $CC_CONFIG['playListTable'].'_id';
$CC_CONFIG['filesSequence'] = $CC_CONFIG['filesTable'].'_id';
$CC_CONFIG['prefSequence'] = $CC_CONFIG['prefTable'].'_id';
$CC_CONFIG['permSequence'] = $CC_CONFIG['permTable'].'_id';
$CC_CONFIG['subjSequence'] = $CC_CONFIG['subjTable'].'_id';
$CC_CONFIG['smembSequence'] = $CC_CONFIG['smembTable'].'_id';
class Config {
public static function loadConfig($CC_CONFIG) {
$values = parse_ini_file('/etc/airtime/airtime.conf', true);
// Name of the web server user
$CC_CONFIG['webServerUser'] = $values['general']['web_server_user'];
$CC_CONFIG['rabbitmq'] = $values['rabbitmq'];
$CC_CONFIG['baseUrl'] = $values['general']['base_url'];
$CC_CONFIG['basePort'] = $values['general']['base_port'];
// Database config
$CC_CONFIG['dsn']['username'] = $values['database']['dbuser'];
$CC_CONFIG['dsn']['password'] = $values['database']['dbpass'];
$CC_CONFIG['dsn']['hostspec'] = $values['database']['host'];
$CC_CONFIG['dsn']['phptype'] = 'pgsql';
$CC_CONFIG['dsn']['database'] = $values['database']['dbname'];
$CC_CONFIG['apiKey'] = array($values['general']['api_key']);
$CC_CONFIG['soundcloud-connection-retries'] = $values['soundcloud']['connection_retries'];
$CC_CONFIG['soundcloud-connection-wait'] = $values['soundcloud']['time_between_retries'];
return $CC_CONFIG;
}
}

View File

@ -1,55 +0,0 @@
###########################################
# Liquidsoap config file #
###########################################
###########################################
# Output settings #
###########################################
output_sound_device = false
output_icecast_vorbis = true
output_icecast_mp3 = false
output_shoutcast = false
#output_bitrate = 128
#output_samplerate = 44100
#output_stereo = true
###########################################
# Logging settings #
###########################################
log_file = "/var/log/airtime/pypo-liquidsoap/<script>.log"
#log_level = 3
###########################################
# Icecast Stream settings #
###########################################
icecast_host = "127.0.0.1"
icecast_port = 8000
icecast_pass = "hackme"
# Icecast mountpoint names
mount_point_mp3 = "airtime.mp3"
mount_point_vorbis = "airtime.ogg"
# Webstream metadata settings
icecast_url = "http://airtime.sourcefabric.org"
icecast_description = "Airtime Radio!"
icecast_genre = "genre"
# Audio stream metadata for vorbis/ogg is disabled by default
# due to a number of client media players that disconnect
# when the metadata changes to a new track. Some versions of
# mplayer and VLC have this problem. Enable this option at your
# own risk!
output_icecast_vorbis_metadata = false
###########################################
# Shoutcast Stream settings #
###########################################
shoutcast_host = "127.0.0.1"
shoutcast_port = 9000
shoutcast_pass = "testing"
# Webstream metadata settings
shoutcast_url = "http://airtime.sourcefabric.org"
shoutcast_genre = "genre"

View File

@ -1,22 +0,0 @@
[loggers]
keys=root
[handlers]
keys=fileOutHandler
[formatters]
keys=simpleFormatter
[logger_root]
level=DEBUG
handlers=fileOutHandler
[handler_fileOutHandler]
class=logging.handlers.RotatingFileHandler
level=DEBUG
formatter=simpleFormatter
args=("/var/log/airtime/media-monitor/media-monitor.log", 'a', 1000000, 5,)
[formatter_simpleFormatter]
format=%(asctime)s %(levelname)s - [%(filename)s : %(funcName)s() : line %(lineno)d] - %(message)s
datefmt=

View File

@ -1,131 +0,0 @@
from airtimefilemonitor.mediamonitorcommon import MediaMonitorCommon
from airtimefilemonitor.mediaconfig import AirtimeMediaConfig
import logging
import logging.config
import sys
import os
import json
import ConfigParser
import pwd
import grp
import subprocess
import re
import os.path
# configure logging
try:
logging.config.fileConfig("logging.cfg")
except Exception, e:
print 'Error configuring logging: ', e
sys.exit(1)
logger = logging.getLogger()
mmconfig = AirtimeMediaConfig(logger)
#get stor folder location from /etc/airtime/airtime.conf
config = ConfigParser.RawConfigParser()
config.read('/etc/airtime/airtime.conf')
stor_dir = config.get('general', 'base_files_dir') + "/stor"
organize_dir = stor_dir + '/organize'
mmconfig.storage_directory = os.path.normpath(stor_dir)
mmconfig.imported_directory = os.path.normpath(stor_dir + '/imported')
mmconfig.organize_directory = os.path.normpath(organize_dir)
mmc = MediaMonitorCommon(mmconfig)
try:
os.makedirs(organize_dir)
except Exception, e:
#organize dir already exists. ( really shouldn't though )
pass
#older versions of Airtime installed from repository at least had owner of stor dir as "root"
mmc.set_needed_file_permissions(stor_dir, True)
mmc.set_needed_file_permissions(organize_dir, True)
#read list of all files in stor location.....and one-by-one pass this through to
#mmc.organize_files. print out json encoding of before and after
pairs = []
f = open('storDump.txt','r')
for line in f.readlines():
db_md = line.split("SF_BACKUP_1.9.0")
#remove newlines.
for i in range(0, len(db_md)):
db_md[i] = db_md[i].strip()
logger.debug(db_md)
file_md = {}
old_filepath = db_md[1]
file_md["MDATA_KEY_FILEPATH"] = old_filepath
#file is recorded
#format 1 title year month day hour min
if int(db_md[0]):
file_md["MDATA_KEY_TITLE"] = db_md[2]
match = re.search('^.*(?=\-\d{4}\-\d{2}\-\d{2}\-\d{2}:\d{2}:\d{2}\.(mp3|ogg))', file_md["MDATA_KEY_TITLE"])
#"Show-Title-2011-03-28-17:15:00.mp3"
if match:
file_md["MDATA_KEY_TITLE"] = match.group(0)
file_md["MDATA_KEY_TITLE"] = file_md["MDATA_KEY_TITLE"].replace(" ", "-")
file_md["MDATA_KEY_TITLE"] = db_md[6]+"-"+db_md[7]+"-00-"+file_md["MDATA_KEY_TITLE"]
file_md["MDATA_KEY_YEAR"] = db_md[3]+"-"+db_md[4]+"-"+db_md[5]
file_md["MDATA_KEY_CREATOR"] = "Airtime Show Recorder".encode('utf-8')
#file is regular audio file
#format 0 title artist album track
else:
file_md["MDATA_KEY_TITLE"] = db_md[2]
match = re.search('^.*(?=\.mp3|\.ogg)', file_md["MDATA_KEY_TITLE"])
#"test.mp3" -> "test"
if match:
file_md["MDATA_KEY_TITLE"] = match.group(0)
if len(db_md[3]) > 0:
file_md["MDATA_KEY_CREATOR"] = db_md[3]
if len(db_md[4]) > 0:
file_md["MDATA_KEY_SOURCE"] = db_md[4]
if len(db_md[5]) > 0:
file_md["MDATA_KEY_TRACKNUMBER"] = int(db_md[5])
mmc.md_manager.save_md_to_file(file_md)
#new_filepath = mmc.organize_new_file(old_filepath)
#if new_filepath is not None:
#pair = old_filepath, new_filepath
#pairs.append(pair)
#mmc.set_needed_file_permissions(new_filepath, False)
f.close()
for root, dirs, files in os.walk(mmconfig.storage_directory):
for f in files:
old_filepath = os.path.join(root, f)
new_filepath = mmc.organize_new_file(old_filepath)
if new_filepath is not None:
pair = old_filepath, new_filepath
pairs.append(pair)
mmc.set_needed_file_permissions(new_filepath, False)
#incase file has a metadata problem.
else:
pair = old_filepath, old_filepath
pairs.append(pair)
mmc.set_needed_file_permissions(old_filepath, False)
#need to set all the dirs in imported to be owned by www-data.
command = "chown -R www-data " + stor_dir
subprocess.call(command.split(" "))
print json.dumps(pairs)

View File

@ -1,21 +0,0 @@
api_client = "airtime"
# where the binary files live
bin_dir = '/usr/lib/airtime/media-monitor'
# where the logging files live
log_dir = '/var/log/airtime/media-monitor'
############################################
# RabbitMQ settings #
############################################
rabbitmq_host = 'localhost'
rabbitmq_user = 'guest'
rabbitmq_password = 'guest'
############################################
# Media-Monitor preferences #
############################################
check_filesystem_events = 5 #how long to queue up events performed on the files themselves.
check_airtime_events = 30 #how long to queue metadata input from airtime.

View File

@ -1,28 +0,0 @@
<?php
// This file generated by Propel 1.5.2 convert-conf target - with modifications by Martin
// from XML runtime conf file /home/naomiaro/dev-campcaster/campcaster/build/runtime-conf.xml
$ini = parse_ini_file('/etc/airtime/airtime.conf', true);
$dbhost = $ini['database']['host'];
$dbname = $ini['database']['dbname'];
$dbuser = $ini['database']['dbuser'];
$dbpass = $ini['database']['dbpass'];
$conf = array (
'datasources' =>
array (
'airtime' =>
array (
'adapter' => 'pgsql',
'connection' =>
array (
'dsn' => "pgsql:host=$dbhost;port=5432;dbname=$dbname;user=$dbuser;password=$dbpass",
),
),
'default' => 'airtime',
),
'generator_version' => '1.5.2',
);
$conf['classmap'] = include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classmap-airtime-conf.php');
return $conf;

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_access' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcAccess extends BaseCcAccess {
} // CcAccess

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_access' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcAccessPeer extends BaseCcAccessPeer {
} // CcAccessPeer

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_access' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcAccessQuery extends BaseCcAccessQuery {
} // CcAccessQuery

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_backup' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcBackup extends BaseCcBackup {
} // CcBackup

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_backup' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcBackupPeer extends BaseCcBackupPeer {
} // CcBackupPeer

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_backup' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcBackupQuery extends BaseCcBackupQuery {
} // CcBackupQuery

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_country' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcCountry extends BaseCcCountry {
} // CcCountry

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_country' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcCountryPeer extends BaseCcCountryPeer {
} // CcCountryPeer

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_country' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcCountryQuery extends BaseCcCountryQuery {
} // CcCountryQuery

View File

@ -1,31 +0,0 @@
<?php
require_once('Common.php');
/**
* Skeleton subclass for representing a row from the 'cc_files' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.campcaster
*/
class CcFiles extends BaseCcFiles {
public function getDbLength()
{
return $this->length;
}
public function setDbLength($time)
{
$this->length = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::LENGTH;
return Common::setTimeInSub($this, 'LENGTH', $time);
}
} // CcFiles

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_files' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcFilesPeer extends BaseCcFilesPeer {
} // CcFilesPeer

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_files' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcFilesQuery extends BaseCcFilesQuery {
} // CcFilesQuery

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_music_dirs' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcMusicDirs extends BaseCcMusicDirs {
} // CcMusicDirs

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_music_dirs' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcMusicDirsPeer extends BaseCcMusicDirsPeer {
} // CcMusicDirsPeer

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_music_dirs' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcMusicDirsQuery extends BaseCcMusicDirsQuery {
} // CcMusicDirsQuery

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_perms' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcPerms extends BaseCcPerms {
} // CcPerms

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_perms' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcPermsPeer extends BaseCcPermsPeer {
} // CcPermsPeer

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_perms' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcPermsQuery extends BaseCcPermsQuery {
} // CcPermsQuery

View File

@ -1,48 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_playlist' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.campcaster
*/
class CcPlaylist extends BaseCcPlaylist {
public function computeLastPosition()
{
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
$sql = 'SELECT MAX('.CcPlaylistcontentsPeer::POSITION.') AS pos'
. ' FROM ' .CcPlaylistcontentsPeer::TABLE_NAME
. ' WHERE ' .CcPlaylistcontentsPeer::PLAYLIST_ID. ' = :p1';
$stmt = $con->prepare($sql);
$stmt->bindValue(':p1', $this->getDbId());
$stmt->execute();
return $stmt->fetchColumn();
}
public function computeLength()
{
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
$sql = 'SELECT SUM('.CcPlaylistcontentsPeer::CLIPLENGTH.') AS length'
. ' FROM ' .CcPlaylistcontentsPeer::TABLE_NAME
. ' WHERE ' .CcPlaylistcontentsPeer::PLAYLIST_ID. ' = :p1';
$stmt = $con->prepare($sql);
$stmt->bindValue(':p1', $this->getDbId());
$stmt->execute();
return $stmt->fetchColumn();
}
} // CcPlaylist

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_playlist' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcPlaylistPeer extends BaseCcPlaylistPeer {
} // CcPlaylistPeer

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_playlist' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcPlaylistQuery extends BaseCcPlaylistQuery {
} // CcPlaylistQuery

View File

@ -1,81 +0,0 @@
<?php
require_once('Common.php');
/**
* Skeleton subclass for representing a row from the 'cc_playlistcontents' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.campcaster
*/
class CcPlaylistcontents extends BaseCcPlaylistcontents {
public function getDbFadein()
{
return $this->fadein;
}
public function setDbFadein($time)
{
$this->fadein = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEIN;
Common::setTimeInSub($this, 'FADEIN', $time);
}
public function getDbFadeout()
{
return $this->fadeout;
}
public function setDbFadeout($time)
{
$this->fadeout = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEOUT;
Common::setTimeInSub($this, 'FADEOUT', $time);
}
public function getDbCuein()
{
return $this->cuein;
}
public function setDbCuein($time)
{
$this->cuein = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEIN;
Common::setTimeInSub($this, 'CUEIN', $time);
}
public function getDbCueout()
{
return $this->cueout;
}
public function setDbCueout($time)
{
$this->cueout = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEOUT;
Common::setTimeInSub($this, 'CUEOUT', $time);
}
public function getDbCliplength()
{
return $this->cliplength;
}
public function setDbCliplength($time)
{
$this->cliplength = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::CLIPLENGTH;
Common::setTimeInSub($this, 'CLIPLENGTH', $time);
}
} // CcPlaylistcontents

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_playlistcontents' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcPlaylistcontentsPeer extends BaseCcPlaylistcontentsPeer {
} // CcPlaylistcontentsPeer

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_playlistcontents' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcPlaylistcontentsQuery extends BaseCcPlaylistcontentsQuery {
} // CcPlaylistcontentsQuery

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_pref' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcPref extends BaseCcPref {
} // CcPref

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_pref' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcPrefPeer extends BaseCcPrefPeer {
} // CcPrefPeer

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_pref' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcPrefQuery extends BaseCcPrefQuery {
} // CcPrefQuery

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_schedule' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcSchedule extends BaseCcSchedule {
} // CcSchedule

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_schedule' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcSchedulePeer extends BaseCcSchedulePeer {
} // CcSchedulePeer

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_schedule' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcScheduleQuery extends BaseCcScheduleQuery {
} // CcScheduleQuery

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_sess' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcSess extends BaseCcSess {
} // CcSess

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_sess' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcSessPeer extends BaseCcSessPeer {
} // CcSessPeer

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_sess' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcSessQuery extends BaseCcSessQuery {
} // CcSessQuery

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_show' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcShow extends BaseCcShow {
} // CcShow

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_show_days' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcShowDays extends BaseCcShowDays {
} // CcShowDays

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show_days' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcShowDaysPeer extends BaseCcShowDaysPeer {
} // CcShowDaysPeer

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show_days' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcShowDaysQuery extends BaseCcShowDaysQuery {
} // CcShowDaysQuery

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_show_hosts' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcShowHosts extends BaseCcShowHosts {
} // CcShowHosts

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show_hosts' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcShowHostsPeer extends BaseCcShowHostsPeer {
} // CcShowHostsPeer

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show_hosts' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcShowHostsQuery extends BaseCcShowHostsQuery {
} // CcShowHostsQuery

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_show_instances' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcShowInstances extends BaseCcShowInstances {
} // CcShowInstances

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show_instances' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcShowInstancesPeer extends BaseCcShowInstancesPeer {
} // CcShowInstancesPeer

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show_instances' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcShowInstancesQuery extends BaseCcShowInstancesQuery {
} // CcShowInstancesQuery

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcShowPeer extends BaseCcShowPeer {
} // CcShowPeer

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcShowQuery extends BaseCcShowQuery {
} // CcShowQuery

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_show_rebroadcast' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcShowRebroadcast extends BaseCcShowRebroadcast {
} // CcShowRebroadcast

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show_rebroadcast' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcShowRebroadcastPeer extends BaseCcShowRebroadcastPeer {
} // CcShowRebroadcastPeer

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show_rebroadcast' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcShowRebroadcastQuery extends BaseCcShowRebroadcastQuery {
} // CcShowRebroadcastQuery

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_show_schedule' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcShowSchedule extends BaseCcShowSchedule {
} // CcShowSchedule

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show_schedule' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcShowSchedulePeer extends BaseCcShowSchedulePeer {
} // CcShowSchedulePeer

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show_schedule' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcShowScheduleQuery extends BaseCcShowScheduleQuery {
} // CcShowScheduleQuery

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_smemb' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcSmemb extends BaseCcSmemb {
} // CcSmemb

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_smemb' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcSmembPeer extends BaseCcSmembPeer {
} // CcSmembPeer

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_smemb' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcSmembQuery extends BaseCcSmembQuery {
} // CcSmembQuery

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_subjs' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcSubjs extends BaseCcSubjs {
} // CcSubjs

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_subjs' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcSubjsPeer extends BaseCcSubjsPeer {
} // CcSubjsPeer

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_subjs' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcSubjsQuery extends BaseCcSubjsQuery {
} // CcSubjsQuery

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_trans' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcTrans extends BaseCcTrans {
} // CcTrans

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_trans' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcTransPeer extends BaseCcTransPeer {
} // CcTransPeer

View File

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_trans' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcTransQuery extends BaseCcTransQuery {
} // CcTransQuery

View File

@ -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();
}
}

View File

@ -1,61 +0,0 @@
<?php
/**
* This class defines the structure of the 'cc_access' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package propel.generator.airtime.map
*/
class CcAccessTableMap extends TableMap {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'airtime.map.CcAccessTableMap';
/**
* Initialize the table attributes, columns and validators
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('cc_access');
$this->setPhpName('CcAccess');
$this->setClassname('CcAccess');
$this->setPackage('airtime');
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_access_id_seq');
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('GUNID', 'Gunid', 'CHAR', false, 32, null);
$this->addColumn('TOKEN', 'Token', 'BIGINT', false, null, null);
$this->addColumn('CHSUM', 'Chsum', 'CHAR', true, 32, '');
$this->addColumn('EXT', 'Ext', 'VARCHAR', true, 128, '');
$this->addColumn('TYPE', 'Type', 'VARCHAR', true, 20, '');
$this->addColumn('PARENT', 'Parent', 'BIGINT', false, null, null);
$this->addForeignKey('OWNER', 'Owner', 'INTEGER', 'cc_subjs', 'ID', false, null, null);
$this->addColumn('TS', 'Ts', 'TIMESTAMP', false, null, null);
// validators
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('owner' => 'id', ), null, null);
} // buildRelations()
} // CcAccessTableMap

View File

@ -1,55 +0,0 @@
<?php
/**
* This class defines the structure of the 'cc_backup' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package propel.generator.airtime.map
*/
class CcBackupTableMap extends TableMap {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'airtime.map.CcBackupTableMap';
/**
* Initialize the table attributes, columns and validators
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('cc_backup');
$this->setPhpName('CcBackup');
$this->setClassname('CcBackup');
$this->setPackage('airtime');
$this->setUseIdGenerator(false);
// columns
$this->addPrimaryKey('TOKEN', 'Token', 'VARCHAR', true, 64, null);
$this->addColumn('SESSIONID', 'Sessionid', 'VARCHAR', true, 64, null);
$this->addColumn('STATUS', 'Status', 'VARCHAR', true, 32, null);
$this->addColumn('FROMTIME', 'Fromtime', 'TIMESTAMP', true, null, null);
$this->addColumn('TOTIME', 'Totime', 'TIMESTAMP', true, null, null);
// validators
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
} // buildRelations()
} // CcBackupTableMap

View File

@ -1,52 +0,0 @@
<?php
/**
* This class defines the structure of the 'cc_country' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package propel.generator.airtime.map
*/
class CcCountryTableMap extends TableMap {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'airtime.map.CcCountryTableMap';
/**
* Initialize the table attributes, columns and validators
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('cc_country');
$this->setPhpName('CcCountry');
$this->setClassname('CcCountry');
$this->setPackage('airtime');
$this->setUseIdGenerator(false);
// columns
$this->addPrimaryKey('ISOCODE', 'DbIsoCode', 'CHAR', true, 3, null);
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, null);
// validators
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
} // buildRelations()
} // CcCountryTableMap

View File

@ -1,111 +0,0 @@
<?php
/**
* This class defines the structure of the 'cc_files' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package propel.generator.airtime.map
*/
class CcFilesTableMap extends TableMap {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'airtime.map.CcFilesTableMap';
/**
* Initialize the table attributes, columns and validators
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('cc_files');
$this->setPhpName('CcFiles');
$this->setClassname('CcFiles');
$this->setPackage('airtime');
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_files_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('GUNID', 'DbGunid', 'CHAR', true, 32, null);
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, '');
$this->addColumn('MIME', 'DbMime', 'VARCHAR', true, 255, '');
$this->addColumn('FTYPE', 'DbFtype', 'VARCHAR', true, 128, '');
$this->addForeignKey('DIRECTORY', 'DbDirectory', 'INTEGER', 'cc_music_dirs', 'ID', false, null, null);
$this->addColumn('FILEPATH', 'DbFilepath', 'LONGVARCHAR', false, null, '');
$this->addColumn('STATE', 'DbState', 'VARCHAR', true, 128, 'empty');
$this->addColumn('CURRENTLYACCESSING', 'DbCurrentlyaccessing', 'INTEGER', true, null, 0);
$this->addForeignKey('EDITEDBY', 'DbEditedby', 'INTEGER', 'cc_subjs', 'ID', false, null, null);
$this->addColumn('MTIME', 'DbMtime', 'TIMESTAMP', false, 6, null);
$this->addColumn('MD5', 'DbMd5', 'CHAR', false, 32, null);
$this->addColumn('TRACK_TITLE', 'DbTrackTitle', 'VARCHAR', false, 512, null);
$this->addColumn('ARTIST_NAME', 'DbArtistName', 'VARCHAR', false, 512, null);
$this->addColumn('BIT_RATE', 'DbBitRate', 'VARCHAR', false, 32, null);
$this->addColumn('SAMPLE_RATE', 'DbSampleRate', 'VARCHAR', false, 32, null);
$this->addColumn('FORMAT', 'DbFormat', 'VARCHAR', false, 128, null);
$this->addColumn('LENGTH', 'DbLength', 'TIME', false, null, null);
$this->addColumn('ALBUM_TITLE', 'DbAlbumTitle', 'VARCHAR', false, 512, null);
$this->addColumn('GENRE', 'DbGenre', 'VARCHAR', false, 64, null);
$this->addColumn('COMMENTS', 'DbComments', 'LONGVARCHAR', false, null, null);
$this->addColumn('YEAR', 'DbYear', 'VARCHAR', false, 16, null);
$this->addColumn('TRACK_NUMBER', 'DbTrackNumber', 'INTEGER', false, null, null);
$this->addColumn('CHANNELS', 'DbChannels', 'INTEGER', false, null, null);
$this->addColumn('URL', 'DbUrl', 'VARCHAR', false, 1024, null);
$this->addColumn('BPM', 'DbBpm', 'VARCHAR', false, 8, null);
$this->addColumn('RATING', 'DbRating', 'VARCHAR', false, 8, null);
$this->addColumn('ENCODED_BY', 'DbEncodedBy', 'VARCHAR', false, 255, null);
$this->addColumn('DISC_NUMBER', 'DbDiscNumber', 'VARCHAR', false, 8, null);
$this->addColumn('MOOD', 'DbMood', 'VARCHAR', false, 64, null);
$this->addColumn('LABEL', 'DbLabel', 'VARCHAR', false, 512, null);
$this->addColumn('COMPOSER', 'DbComposer', 'VARCHAR', false, 512, null);
$this->addColumn('ENCODER', 'DbEncoder', 'VARCHAR', false, 64, null);
$this->addColumn('CHECKSUM', 'DbChecksum', 'VARCHAR', false, 256, null);
$this->addColumn('LYRICS', 'DbLyrics', 'LONGVARCHAR', false, null, null);
$this->addColumn('ORCHESTRA', 'DbOrchestra', 'VARCHAR', false, 512, null);
$this->addColumn('CONDUCTOR', 'DbConductor', 'VARCHAR', false, 512, null);
$this->addColumn('LYRICIST', 'DbLyricist', 'VARCHAR', false, 512, null);
$this->addColumn('ORIGINAL_LYRICIST', 'DbOriginalLyricist', 'VARCHAR', false, 512, null);
$this->addColumn('RADIO_STATION_NAME', 'DbRadioStationName', 'VARCHAR', false, 512, null);
$this->addColumn('INFO_URL', 'DbInfoUrl', 'VARCHAR', false, 512, null);
$this->addColumn('ARTIST_URL', 'DbArtistUrl', 'VARCHAR', false, 512, null);
$this->addColumn('AUDIO_SOURCE_URL', 'DbAudioSourceUrl', 'VARCHAR', false, 512, null);
$this->addColumn('RADIO_STATION_URL', 'DbRadioStationUrl', 'VARCHAR', false, 512, null);
$this->addColumn('BUY_THIS_URL', 'DbBuyThisUrl', 'VARCHAR', false, 512, null);
$this->addColumn('ISRC_NUMBER', 'DbIsrcNumber', 'VARCHAR', false, 512, null);
$this->addColumn('CATALOG_NUMBER', 'DbCatalogNumber', 'VARCHAR', false, 512, null);
$this->addColumn('ORIGINAL_ARTIST', 'DbOriginalArtist', 'VARCHAR', false, 512, null);
$this->addColumn('COPYRIGHT', 'DbCopyright', 'VARCHAR', false, 512, null);
$this->addColumn('REPORT_DATETIME', 'DbReportDatetime', 'VARCHAR', false, 32, null);
$this->addColumn('REPORT_LOCATION', 'DbReportLocation', 'VARCHAR', false, 512, null);
$this->addColumn('REPORT_ORGANIZATION', 'DbReportOrganization', 'VARCHAR', false, 512, null);
$this->addColumn('SUBJECT', 'DbSubject', 'VARCHAR', false, 512, null);
$this->addColumn('CONTRIBUTOR', 'DbContributor', 'VARCHAR', false, 512, null);
$this->addColumn('LANGUAGE', 'DbLanguage', 'VARCHAR', false, 512, null);
// validators
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('editedby' => 'id', ), null, null);
$this->addRelation('CcMusicDirs', 'CcMusicDirs', RelationMap::MANY_TO_ONE, array('directory' => 'id', ), 'CASCADE', null);
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
$this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
$this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
} // buildRelations()
} // CcFilesTableMap

View File

@ -1,55 +0,0 @@
<?php
/**
* This class defines the structure of the 'cc_music_dirs' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package propel.generator.airtime.map
*/
class CcMusicDirsTableMap extends TableMap {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'airtime.map.CcMusicDirsTableMap';
/**
* Initialize the table attributes, columns and validators
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('cc_music_dirs');
$this->setPhpName('CcMusicDirs');
$this->setClassname('CcMusicDirs');
$this->setPackage('airtime');
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_music_dirs_id_seq');
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('DIRECTORY', 'Directory', 'LONGVARCHAR', false, null, null);
$this->addColumn('TYPE', 'Type', 'VARCHAR', false, 255, null);
// validators
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('CcFiles', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'directory', ), 'CASCADE', null);
} // buildRelations()
} // CcMusicDirsTableMap

View File

@ -1,56 +0,0 @@
<?php
/**
* This class defines the structure of the 'cc_perms' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package propel.generator.airtime.map
*/
class CcPermsTableMap extends TableMap {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'airtime.map.CcPermsTableMap';
/**
* Initialize the table attributes, columns and validators
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('cc_perms');
$this->setPhpName('CcPerms');
$this->setClassname('CcPerms');
$this->setPackage('airtime');
$this->setUseIdGenerator(false);
// columns
$this->addPrimaryKey('PERMID', 'Permid', 'INTEGER', true, null, null);
$this->addForeignKey('SUBJ', 'Subj', 'INTEGER', 'cc_subjs', 'ID', false, null, null);
$this->addColumn('ACTION', 'Action', 'VARCHAR', false, 20, null);
$this->addColumn('OBJ', 'Obj', 'INTEGER', false, null, null);
$this->addColumn('TYPE', 'Type', 'CHAR', false, 1, null);
// validators
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('subj' => 'id', ), 'CASCADE', null);
} // buildRelations()
} // CcPermsTableMap

View File

@ -1,61 +0,0 @@
<?php
/**
* This class defines the structure of the 'cc_playlist' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package propel.generator.airtime.map
*/
class CcPlaylistTableMap extends TableMap {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'airtime.map.CcPlaylistTableMap';
/**
* Initialize the table attributes, columns and validators
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('cc_playlist');
$this->setPhpName('CcPlaylist');
$this->setClassname('CcPlaylist');
$this->setPackage('airtime');
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_playlist_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, '');
$this->addColumn('STATE', 'DbState', 'VARCHAR', true, 128, 'empty');
$this->addColumn('CURRENTLYACCESSING', 'DbCurrentlyaccessing', 'INTEGER', true, null, 0);
$this->addForeignKey('EDITEDBY', 'DbEditedby', 'INTEGER', 'cc_subjs', 'ID', false, null, null);
$this->addColumn('MTIME', 'DbMtime', 'TIMESTAMP', false, 6, null);
$this->addColumn('CREATOR', 'DbCreator', 'VARCHAR', false, 32, null);
$this->addColumn('DESCRIPTION', 'DbDescription', 'VARCHAR', false, 512, null);
// validators
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('editedby' => 'id', ), null, null);
$this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'playlist_id', ), 'CASCADE', null);
} // buildRelations()
} // CcPlaylistTableMap

View File

@ -1,62 +0,0 @@
<?php
/**
* This class defines the structure of the 'cc_playlistcontents' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package propel.generator.airtime.map
*/
class CcPlaylistcontentsTableMap extends TableMap {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'airtime.map.CcPlaylistcontentsTableMap';
/**
* Initialize the table attributes, columns and validators
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('cc_playlistcontents');
$this->setPhpName('CcPlaylistcontents');
$this->setClassname('CcPlaylistcontents');
$this->setPackage('airtime');
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_playlistcontents_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addForeignKey('PLAYLIST_ID', 'DbPlaylistId', 'INTEGER', 'cc_playlist', 'ID', false, null, null);
$this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null);
$this->addColumn('POSITION', 'DbPosition', 'INTEGER', false, null, null);
$this->addColumn('CLIPLENGTH', 'DbCliplength', 'TIME', false, null, '00:00:00');
$this->addColumn('CUEIN', 'DbCuein', 'TIME', false, null, '00:00:00');
$this->addColumn('CUEOUT', 'DbCueout', 'TIME', false, null, '00:00:00');
$this->addColumn('FADEIN', 'DbFadein', 'TIME', false, null, '00:00:00');
$this->addColumn('FADEOUT', 'DbFadeout', 'TIME', false, null, '00:00:00');
// validators
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null);
$this->addRelation('CcPlaylist', 'CcPlaylist', RelationMap::MANY_TO_ONE, array('playlist_id' => 'id', ), 'CASCADE', null);
} // buildRelations()
} // CcPlaylistcontentsTableMap

Some files were not shown because too many files have changed in this diff Show More