Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
Conflicts: airtime_mvc/application/controllers/LibraryController.php airtime_mvc/application/views/scripts/library/library.phtml airtime_mvc/public/js/airtime/showbuilder/main_builder.js
This commit is contained in:
commit
12009e95fc
|
@ -292,7 +292,8 @@ SQL;
|
|||
ft.artist_name AS file_artist_name,
|
||||
ft.album_title AS file_album_title,
|
||||
ft.length AS file_length,
|
||||
ft.file_exists AS file_exists
|
||||
ft.file_exists AS file_exists,
|
||||
ft.mime AS file_mime
|
||||
SQL;
|
||||
$filesJoin = <<<SQL
|
||||
cc_schedule AS sched
|
||||
|
@ -319,7 +320,8 @@ SQL;
|
|||
sub.login AS file_artist_name,
|
||||
ws.description AS file_album_title,
|
||||
ws.length AS file_length,
|
||||
't'::BOOL AS file_exists
|
||||
't'::BOOL AS file_exists,
|
||||
NULL as file_mime
|
||||
SQL;
|
||||
$streamJoin = <<<SQL
|
||||
cc_schedule AS sched
|
||||
|
|
|
@ -105,6 +105,10 @@ class Application_Model_Scheduler
|
|||
throw new Exception("You are not allowed to schedule show {$show->getDbName()}.");
|
||||
}
|
||||
|
||||
if ($instance->getDbRecord()) {
|
||||
throw new Exception("You cannot add files to recording shows.");
|
||||
}
|
||||
|
||||
$showEndEpoch = floatval($instance->getDbEnds("U.u"));
|
||||
|
||||
if ($showEndEpoch < $nowEpoch) {
|
||||
|
|
|
@ -41,6 +41,7 @@ class Application_Model_ShowBuilder
|
|||
"fadein" => "",
|
||||
"fadeout" => "",
|
||||
"image" => false,
|
||||
"mime" => null,
|
||||
"color" => "", //in hex without the '#' sign.
|
||||
"backgroundColor" => "", //in hex without the '#' sign.
|
||||
);
|
||||
|
@ -277,6 +278,7 @@ class Application_Model_ShowBuilder
|
|||
$row["cueout"] = $p_item["cue_out"];
|
||||
$row["fadein"] = round(substr($p_item["fade_in"], 6), 6);
|
||||
$row["fadeout"] = round(substr($p_item["fade_out"], 6), 6);
|
||||
$row["mime"] = $p_item["file_mime"];
|
||||
|
||||
$row["pos"] = $this->pos++;
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class CcBlockTableMap extends TableMap {
|
|||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('creator_id' => 'id', ), null, null);
|
||||
$this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('creator_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcBlockcontents', 'CcBlockcontents', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcBlockcriteria', 'CcBlockcriteria', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null);
|
||||
|
|
|
@ -64,7 +64,7 @@ class CcSubjsTableMap extends TableMap {
|
|||
$this->addRelation('CcPerms', 'CcPerms', RelationMap::ONE_TO_MANY, array('id' => 'subj', ), 'CASCADE', null);
|
||||
$this->addRelation('CcShowHosts', 'CcShowHosts', RelationMap::ONE_TO_MANY, array('id' => 'subjs_id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcPlaylist', 'CcPlaylist', RelationMap::ONE_TO_MANY, array('id' => 'creator_id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcBlock', 'CcBlock', RelationMap::ONE_TO_MANY, array('id' => 'creator_id', ), null, null);
|
||||
$this->addRelation('CcBlock', 'CcBlock', RelationMap::ONE_TO_MANY, array('id' => 'creator_id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcPref', 'CcPref', RelationMap::ONE_TO_MANY, array('id' => 'subjid', ), 'CASCADE', null);
|
||||
$this->addRelation('CcSess', 'CcSess', RelationMap::ONE_TO_MANY, array('id' => 'userid', ), 'CASCADE', null);
|
||||
$this->addRelation('CcSubjsToken', 'CcSubjsToken', RelationMap::ONE_TO_MANY, array('id' => 'user_id', ), 'CASCADE', null);
|
||||
|
|
|
@ -407,6 +407,9 @@ abstract class BaseCcSubjsPeer {
|
|||
// Invalidate objects in CcPlaylistPeer instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
CcPlaylistPeer::clearInstancePool();
|
||||
// Invalidate objects in CcBlockPeer instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
CcBlockPeer::clearInstancePool();
|
||||
// Invalidate objects in CcPrefPeer instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
CcPrefPeer::clearInstancePool();
|
||||
|
|
|
@ -30,8 +30,22 @@
|
|||
|
||||
<dd id='sp_criteria-element' class='criteria-element'>
|
||||
<?php for ($i = 0; $i < $this->criteriasLength; $i++) {?>
|
||||
<?php for ($j = 0; $j < $this->modRowMap[$i]; $j++) {?>
|
||||
<div <?php if (($i > 0) && ($this->element->getElement("sp_criteria_field_".$i."_".$j)->getAttrib('disabled') == 'disabled')) {
|
||||
<?php for ($j = 0; $j < $this->modRowMap[$i]; $j++) {
|
||||
if ($this->modRowMap[$i] > 1 && $j != $this->modRowMap[$i]-1) $logicLabel = 'or';
|
||||
else $logicLabel = 'and';
|
||||
$disabled = $this->element->getElement("sp_criteria_field_".$i."_".$j)->getAttrib('disabled') == 'disabled'?true:false;
|
||||
// determine if the next row is disabled and only display the logic label if it isn't
|
||||
if ($j == $this->modRowMap[$i]-1 && $i < 25) {
|
||||
$n = $i+1;
|
||||
$nextIndex = $n."_0";
|
||||
} elseif ($j+1 < $this->modRowMap[$i]-1) {
|
||||
$n = $j+1;
|
||||
$nextIndex = $i."_".$n;
|
||||
|
||||
}
|
||||
$nextDisabled = $this->element->getElement("sp_criteria_field_".$nextIndex)->getAttrib('disabled') == 'disabled'?true:false;
|
||||
?>
|
||||
<div <?php if (($i > 0) && $disabled) {
|
||||
echo 'style=display:none';
|
||||
} ?>>
|
||||
<?php echo $this->element->getElement("sp_criteria_field_".$i."_".$j) ?>
|
||||
|
@ -45,6 +59,9 @@
|
|||
<a style='margin-right:3px' class='btn btn-small btn-danger' id='criteria_remove_<?php echo $i ?>'>
|
||||
<i class='icon-white icon-remove'></i>
|
||||
</a>
|
||||
<span class='db-logic-label' <?php if ($nextDisabled) echo "style='display:none'"?>>
|
||||
<?php echo $logicLabel;?>
|
||||
</span>
|
||||
<?php if($this->element->getElement("sp_criteria_field_".$i."_".$j)->hasErrors()) : ?>
|
||||
<?php foreach($this->element->getElement("sp_criteria_field_".$i."_".$j)->getMessages() as $error): ?>
|
||||
<span class='errors sp-errors'>
|
||||
|
|
|
@ -250,7 +250,7 @@
|
|||
<parameter name="foreign_table" value="cc_blockcontents" />
|
||||
<parameter name="expression" value="SUM(cliplength)" />
|
||||
</behavior>
|
||||
<foreign-key foreignTable="cc_subjs" name="cc_block_createdby_fkey">
|
||||
<foreign-key foreignTable="cc_subjs" name="cc_block_createdby_fkey" onDelete="CASCADE">
|
||||
<reference local="creator_id" foreign="id"/>
|
||||
</foreign-key>
|
||||
</table>
|
||||
|
|
|
@ -697,7 +697,7 @@ ALTER TABLE "cc_playlistcontents" ADD CONSTRAINT "cc_playlistcontents_block_id_f
|
|||
|
||||
ALTER TABLE "cc_playlistcontents" ADD CONSTRAINT "cc_playlistcontents_playlist_id_fkey" FOREIGN KEY ("playlist_id") REFERENCES "cc_playlist" ("id") ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_block" ADD CONSTRAINT "cc_block_createdby_fkey" FOREIGN KEY ("creator_id") REFERENCES "cc_subjs" ("id");
|
||||
ALTER TABLE "cc_block" ADD CONSTRAINT "cc_block_createdby_fkey" FOREIGN KEY ("creator_id") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_blockcontents" ADD CONSTRAINT "cc_blockcontents_file_id_fkey" FOREIGN KEY ("file_id") REFERENCES "cc_files" ("id") ON DELETE CASCADE;
|
||||
|
||||
|
|
|
@ -514,6 +514,9 @@ table.library-get-file-md.table-small{
|
|||
|
||||
|
||||
/***** SMART BLOCK SPECIFIC STYLES BEGIN *****/
|
||||
.db-logic-label{
|
||||
font-size:11px;
|
||||
}
|
||||
.sp-invisible{
|
||||
visibility: hidden;
|
||||
}
|
||||
|
|
|
@ -37,6 +37,11 @@ var AIRTIME = (function(AIRTIME) {
|
|||
var $nRow = $(nRow);
|
||||
if (aData.ftype === "audioclip") {
|
||||
$nRow.addClass("lib-audio");
|
||||
$image = $nRow.find('td.library_type');
|
||||
if (!isAudioSupported(aData.mime)) {
|
||||
$image.html('<span class="ui-icon ui-icon-locked"></span>');
|
||||
aData.image = '<span class="ui-icon ui-icon-locked"></span>';
|
||||
}
|
||||
} else if (aData.ftype === "stream") {
|
||||
$nRow.addClass("lib-stream");
|
||||
} else if (aData.ftype === "block") {
|
||||
|
|
|
@ -29,6 +29,11 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
if (aData.ftype === "audioclip") {
|
||||
$nRow.addClass("lib-audio");
|
||||
$image = $nRow.find('td.library_type');
|
||||
if (!isAudioSupported(aData.mime)) {
|
||||
$image.html('<span class="ui-icon ui-icon-locked"></span>');
|
||||
aData.image = '<span class="ui-icon ui-icon-locked"></span>';
|
||||
}
|
||||
} else if (aData.ftype === "stream") {
|
||||
$nRow.addClass("lib-stream");
|
||||
} else {
|
||||
|
|
|
@ -562,7 +562,9 @@ var AIRTIME = (function(AIRTIME) {
|
|||
// pl_
|
||||
open_playlist_preview(playlistIndex, 0);
|
||||
} else if (aData.ftype === 'audioclip') {
|
||||
if (isAudioSupported(aData.mime)) {
|
||||
open_audio_preview(aData.ftype, aData.audioFile, aData.track_title, aData.artist_name);
|
||||
}
|
||||
} else if (aData.ftype == 'stream') {
|
||||
open_audio_preview(aData.ftype, aData.audioFile, aData.track_title, aData.artist_name);
|
||||
} else if (aData.ftype == 'block' && aData.bl_type == 'static') {
|
||||
|
|
|
@ -8,14 +8,17 @@ function setSmartBlockEvents() {
|
|||
/********** ADD CRITERIA ROW **********/
|
||||
form.find('#criteria_add').live('click', function(){
|
||||
|
||||
var div = $('dd[id="sp_criteria-element"]').children('div:visible:last').next();
|
||||
var div = $('dd[id="sp_criteria-element"]').children('div:visible:last');
|
||||
|
||||
div.find('.db-logic-label').text('and').show();
|
||||
div = div.next().show();
|
||||
|
||||
div.show();
|
||||
div.children().removeAttr('disabled');
|
||||
div = div.next();
|
||||
if (div.length === 0) {
|
||||
$(this).hide();
|
||||
}
|
||||
|
||||
appendAddButton();
|
||||
appendModAddButton();
|
||||
removeButtonCheck();
|
||||
|
@ -285,6 +288,11 @@ function reindexElements() {
|
|||
var divs = $('#smart-block-form').find('div select[name^="sp_criteria_field"]').parent(),
|
||||
index = 0,
|
||||
modIndex = 0;
|
||||
/* Hide all logic labels
|
||||
* We will re-add them as each row gets indexed
|
||||
*/
|
||||
$('.db-logic-label').text('').hide();
|
||||
|
||||
$.each(divs, function(i, div){
|
||||
if (i > 0 && index < 26) {
|
||||
|
||||
|
@ -292,8 +300,14 @@ function reindexElements() {
|
|||
* a modifier row
|
||||
*/
|
||||
if ($(div).find('select[name^="sp_criteria_field"]').hasClass('sp-invisible')) {
|
||||
if ($(div).is(':visible')) {
|
||||
$(div).prev().find('.db-logic-label').text('or').show();
|
||||
}
|
||||
modIndex++;
|
||||
} else {
|
||||
if ($(div).is(':visible')) {
|
||||
$(div).prev().find('.db-logic-label').text('and').show();
|
||||
}
|
||||
index++;
|
||||
modIndex = 0;
|
||||
}
|
||||
|
@ -338,7 +352,7 @@ function setupUI() {
|
|||
var plContents = $('#spl_sortable').children();
|
||||
var shuffleButton = $('button[id="shuffle_button"]');
|
||||
|
||||
if (plContents.text() !== 'Empty playlist') {
|
||||
if (!plContents.hasClass('spl_empty')) {
|
||||
if (shuffleButton.hasClass('ui-state-disabled')) {
|
||||
shuffleButton.removeClass('ui-state-disabled');
|
||||
shuffleButton.removeAttr('disabled');
|
||||
|
|
|
@ -369,7 +369,8 @@ var AIRTIME = (function(AIRTIME){
|
|||
/* cue in */ {"mDataProp": "cuein", "sTitle": "Cue In", "bVisible": false, "sClass": "sb-cue-in"},
|
||||
/* cue out */ {"mDataProp": "cueout", "sTitle": "Cue Out", "bVisible": false, "sClass": "sb-cue-out"},
|
||||
/* fade in */ {"mDataProp": "fadein", "sTitle": "Fade In", "bVisible": false, "sClass": "sb-fade-in"},
|
||||
/* fade out */ {"mDataProp": "fadeout", "sTitle": "Fade Out", "bVisible": false, "sClass": "sb-fade-out"}
|
||||
/* fade out */ {"mDataProp": "fadeout", "sTitle": "Fade Out", "bVisible": false, "sClass": "sb-fade-out"},
|
||||
/* Mime */ {"mDataProp" : "mime", "sTitle" : "Mime", "bVisible": false, "sClass": "sb-mime"}
|
||||
],
|
||||
|
||||
"bJQueryUI": true,
|
||||
|
@ -549,12 +550,17 @@ var AIRTIME = (function(AIRTIME){
|
|||
$image = $nRow.find('td.sb-image');
|
||||
//check if the file exists.
|
||||
if (aData.image === true) {
|
||||
$nRow.addClass("lib-audio");
|
||||
if (!isAudioSupported(aData.mime)) {
|
||||
$image.html('<span class="ui-icon ui-icon-locked"></span>');
|
||||
} else {
|
||||
$image.html('<img title="Track preview" src="'+baseUrl+'/css/images/icon_audioclip.png"></img>')
|
||||
.click(function() {
|
||||
open_show_preview(aData.instance, aData.pos);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
$image.html('<span class="ui-icon ui-icon-alert"></span>');
|
||||
$image.find(".ui-icon-alert").qtip({
|
||||
|
|
|
@ -419,7 +419,6 @@ AIRTIME = (function(AIRTIME) {
|
|||
};
|
||||
|
||||
return AIRTIME;
|
||||
|
||||
} (AIRTIME || {}));
|
||||
|
||||
$(document).ready(AIRTIME.builderMain.onReady);
|
||||
|
|
|
@ -574,7 +574,7 @@
|
|||
})
|
||||
|
||||
}(window.jQuery);/* ============================================================
|
||||
* bootstrap-dropdown.js v2.1.0
|
||||
* bootstrap-dropdown.js v2.2.1
|
||||
* http://twitter.github.com/bootstrap/javascript.html#dropdowns
|
||||
* ============================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
|
@ -675,8 +675,9 @@
|
|||
}
|
||||
|
||||
function clearMenus() {
|
||||
getParent($(toggle))
|
||||
.removeClass('open')
|
||||
$(toggle).each(function () {
|
||||
getParent($(this)).removeClass('open')
|
||||
})
|
||||
}
|
||||
|
||||
function getParent($this) {
|
||||
|
@ -685,7 +686,7 @@
|
|||
|
||||
if (!selector) {
|
||||
selector = $this.attr('href')
|
||||
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
||||
selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
||||
}
|
||||
|
||||
$parent = $(selector)
|
||||
|
@ -713,14 +714,11 @@
|
|||
/* APPLY TO STANDARD DROPDOWN ELEMENTS
|
||||
* =================================== */
|
||||
|
||||
$(function () {
|
||||
$('html')
|
||||
$(document)
|
||||
.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
|
||||
$('body')
|
||||
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown', function (e) { e.stopPropagation() })
|
||||
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
|
||||
.on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
|
||||
.on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
|
||||
})
|
||||
|
||||
}(window.jQuery);/* =========================================================
|
||||
* bootstrap-modal.js v2.1.0
|
||||
|
|
|
@ -148,6 +148,9 @@ class BaseEvent(Loggable):
|
|||
owners.remove_file_owner(self.path)
|
||||
return ret
|
||||
except BadSongFile as e: return [e]
|
||||
except Exception as e:
|
||||
self.unexpected_exception(e)
|
||||
return[e]
|
||||
|
||||
# nothing to see here, please move along
|
||||
def morph_into(self, evt):
|
||||
|
|
|
@ -201,9 +201,6 @@ def append_dj_inputs(master_harbor_input_port, master_harbor_input_mount_point,
|
|||
dj_live = mksafe(audio_to_stereo(input.harbor(id="live_dj_harbor", dj_harbor_input_mount_point, port=dj_harbor_input_port, auth=check_dj_client,
|
||||
max=40., on_connect=live_dj_connect, on_disconnect=live_dj_disconnect)))
|
||||
|
||||
master_dj = rewrite_metadata([("artist","Airtime"), ("title", "Master Dj")],master_dj)
|
||||
dj_live = rewrite_metadata([("artist","Airtime"), ("title", "Live Dj")],dj_live)
|
||||
|
||||
ignore(output.dummy(master_dj, fallible=true))
|
||||
ignore(output.dummy(dj_live, fallible=true))
|
||||
switch(id="master_dj_switch", track_sensitive=false, transitions=[transition, transition, transition], [({!master_dj_enabled},master_dj), ({!live_dj_enabled},dj_live), ({true}, s)])
|
||||
|
@ -211,14 +208,12 @@ def append_dj_inputs(master_harbor_input_port, master_harbor_input_mount_point,
|
|||
master_dj = mksafe(audio_to_stereo(input.harbor(id="master_harbor", master_harbor_input_mount_point, port=master_harbor_input_port, auth=check_master_dj_client,
|
||||
max=40., on_connect=master_dj_connect, on_disconnect=master_dj_disconnect)))
|
||||
ignore(output.dummy(master_dj, fallible=true))
|
||||
master_dj = rewrite_metadata([("artist","Airtime"), ("title", "Master Dj")],master_dj)
|
||||
|
||||
switch(id="master_dj_switch", track_sensitive=false, transitions=[transition, transition], [({!master_dj_enabled},master_dj), ({true}, s)])
|
||||
elsif dj_harbor_input_port != 0 and dj_harbor_input_mount_point != "" then
|
||||
dj_live = mksafe(audio_to_stereo(input.harbor(id="live_dj_harbor", dj_harbor_input_mount_point, port=dj_harbor_input_port, auth=check_dj_client,
|
||||
max=40., on_connect=live_dj_connect, on_disconnect=live_dj_disconnect)))
|
||||
|
||||
dj_live = rewrite_metadata([("artist","Airtime"), ("title", "Live Dj")],dj_live)
|
||||
|
||||
ignore(output.dummy(dj_live, fallible=true))
|
||||
switch(id="live_dj_switch", track_sensitive=false, transitions=[transition, transition], [({!live_dj_enabled},dj_live), ({true}, s)])
|
||||
else
|
||||
|
|
|
@ -1,100 +0,0 @@
|
|||
<?php
|
||||
|
||||
// Define path to application directory
|
||||
define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../../application'));
|
||||
echo APPLICATION_PATH.PHP_EOL;
|
||||
|
||||
// Ensure library/ is on include_path
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . realpath(APPLICATION_PATH . '/../library'));
|
||||
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . APPLICATION_PATH . '/models');
|
||||
echo get_include_path().PHP_EOL;
|
||||
|
||||
//Controller plugins.
|
||||
set_include_path(APPLICATION_PATH . get_include_path() . PATH_SEPARATOR . '/controllers/plugins');
|
||||
|
||||
|
||||
require_once APPLICATION_PATH.'/configs/conf.php';
|
||||
require_once(APPLICATION_PATH.'/../library/propel/runtime/lib/Propel.php');
|
||||
|
||||
require_once 'Soundcloud.php';
|
||||
require_once 'Playlist.php';
|
||||
require_once 'StoredFile.php';
|
||||
require_once 'Schedule.php';
|
||||
require_once 'Shows.php';
|
||||
require_once 'User.php';
|
||||
require_once 'RabbitMq.php';
|
||||
require_once 'Preference.php';
|
||||
//require_once APPLICATION_PATH.'/controllers/plugins/RabbitMqPlugin.php';
|
||||
|
||||
// Initialize Propel with the runtime configuration
|
||||
Propel::init(__DIR__."/../../../application/configs/airtime-conf.php");
|
||||
|
||||
$playlistName = "pypo_playlist_test";
|
||||
$secondsFromNow = 30;
|
||||
|
||||
echo " ************************************************************** \n";
|
||||
echo " This script schedules a playlist to play $secondsFromNow minute(s) from now.\n";
|
||||
echo " This is a utility to help you debug the scheduler.\n";
|
||||
echo " ************************************************************** \n";
|
||||
echo "\n";
|
||||
echo "Deleting playlists with the name '$playlistName'...";
|
||||
// Delete any old playlists
|
||||
$pl2 = Playlist::findPlaylistByName($playlistName);
|
||||
foreach ($pl2 as $playlist) {
|
||||
//var_dump($playlist);
|
||||
$playlist->delete();
|
||||
}
|
||||
echo "done.\n";
|
||||
|
||||
// Create a new playlist
|
||||
echo "Creating new playlist '$playlistName'...";
|
||||
$pl = new Playlist();
|
||||
$pl->create($playlistName);
|
||||
|
||||
|
||||
$mediaFile = Application_Model_StoredFile::findByOriginalName("Peter_Rudenko_-_Opening.mp3");
|
||||
if (is_null($mediaFile)) {
|
||||
echo "Adding test audio clip to the database.\n";
|
||||
$v = array("filepath" => __DIR__."/../../../audio_samples/vorbis.com/Hydrate-Kenny_Beltrey.ogg");
|
||||
$mediaFile = Application_Model_StoredFile::Insert($v);
|
||||
}
|
||||
$pl->addAudioClip($mediaFile->getId());
|
||||
echo "done.\n";
|
||||
|
||||
|
||||
//$pl2 = Playlist::findPlaylistByName("pypo_playlist_test");
|
||||
//var_dump($pl2);
|
||||
|
||||
// Get current time
|
||||
// In the format YYYY-MM-DD HH:MM:SS.nnnnnn
|
||||
$startTime = date("Y-m-d H:i:s");
|
||||
$endTime = date("Y-m-d H:i:s", time()+(60*60));
|
||||
|
||||
echo "Removing everything from the scheduler between $startTime and $endTime...";
|
||||
|
||||
|
||||
// Check for succces
|
||||
$scheduleClear = Schedule::isScheduleEmptyInRange($startTime, "01:00:00");
|
||||
if (!$scheduleClear) {
|
||||
echo "\nERROR: Schedule could not be cleared.\n\n";
|
||||
var_dump(Schedule::getItems($startTime, $endTime));
|
||||
exit;
|
||||
}
|
||||
echo "done.\n";
|
||||
|
||||
// Schedule the playlist for two minutes from now
|
||||
echo "Scheduling new playlist...\n";
|
||||
//$playTime = date("Y-m-d H:i:s", time()+(60*$minutesFromNow));
|
||||
$playTime = date("Y-m-d H:i:s", time()+($secondsFromNow));
|
||||
|
||||
//$scheduleGroup = new ScheduleGroup();
|
||||
//$scheduleGroup->add($playTime, null, $pl->getId());
|
||||
|
||||
//$show = new Application_Model_ShowInstance($showInstanceId);
|
||||
//$show->scheduleShow(array($pl->getId()));
|
||||
|
||||
//$show->setShowStart();
|
||||
//$show->setShowEnd();
|
||||
|
||||
echo " SUCCESS: Playlist scheduled at $playTime\n\n";
|
|
@ -1,59 +0,0 @@
|
|||
[loggers]
|
||||
keys=root
|
||||
|
||||
[handlers]
|
||||
keys=consoleHandler,fileHandlerERROR,fileHandlerDEBUG,nullHandler
|
||||
|
||||
[formatters]
|
||||
keys=simpleFormatter
|
||||
|
||||
[logger_root]
|
||||
level=DEBUG
|
||||
handlers=consoleHandler,fileHandlerERROR,fileHandlerDEBUG
|
||||
|
||||
[logger_libs]
|
||||
handlers=nullHandler
|
||||
level=CRITICAL
|
||||
qualname="process"
|
||||
propagate=0
|
||||
|
||||
[handler_consoleHandler]
|
||||
class=StreamHandler
|
||||
level=CRITICAL
|
||||
formatter=simpleFormatter
|
||||
args=(sys.stdout,)
|
||||
|
||||
[handler_fileHandlerERROR]
|
||||
class=FileHandler
|
||||
level=CRITICAL
|
||||
formatter=simpleFormatter
|
||||
args=("./error-unit-test.log",)
|
||||
|
||||
[handler_fileHandlerDEBUG]
|
||||
class=FileHandler
|
||||
level=CRITICAL
|
||||
formatter=simpleFormatter
|
||||
args=("./debug-unit-test.log",)
|
||||
|
||||
[handler_nullHandler]
|
||||
class=FileHandler
|
||||
level=CRITICAL
|
||||
formatter=simpleFormatter
|
||||
args=("./log-null-unit-test.log",)
|
||||
|
||||
|
||||
[formatter_simpleFormatter]
|
||||
format=%(asctime)s %(levelname)s - [%(filename)s : %(funcName)s() : line %(lineno)d] - %(message)s
|
||||
datefmt=
|
||||
|
||||
|
||||
## multitail color sheme
|
||||
## pyml / python
|
||||
# colorscheme:pyml:www.obp.net
|
||||
# cs_re:blue:\[[^ ]*\]
|
||||
# cs_re:red:CRITICAL:*
|
||||
# cs_re:red,black,blink:ERROR:*
|
||||
# cs_re:blue:NOTICE:*
|
||||
# cs_re:cyan:INFO:*
|
||||
# cs_re:green:DEBUG:*
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
import time
|
||||
import os
|
||||
import traceback
|
||||
from optparse import *
|
||||
import sys
|
||||
import time
|
||||
import datetime
|
||||
import logging
|
||||
import logging.config
|
||||
import shutil
|
||||
import urllib
|
||||
import urllib2
|
||||
import pickle
|
||||
import telnetlib
|
||||
import random
|
||||
import string
|
||||
import operator
|
||||
import inspect
|
||||
|
||||
# additional modules (should be checked)
|
||||
from configobj import ConfigObj
|
||||
|
||||
# custom imports
|
||||
#from util import *
|
||||
from api_client import AirtimeApiClient
|
||||
|
||||
import unittest
|
||||
|
||||
# configure logging
|
||||
#logging.config.fileConfig("logging-api-validator.cfg")
|
||||
|
||||
try:
|
||||
config = ConfigObj('/etc/airtime/pypo.cfg')
|
||||
except Exception, e:
|
||||
print 'Error loading config file: ', e
|
||||
sys.exit()
|
||||
|
||||
|
||||
class TestApiFunctions(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.api_client = AirtimeApiClient()
|
||||
|
||||
def test_is_server_compatible(self):
|
||||
self.assertTrue(self.api_client.is_server_compatible(False))
|
||||
|
||||
def test_get_schedule(self):
|
||||
status, response = self.api_client.get_schedule()
|
||||
self.assertTrue(response.has_key("status"))
|
||||
self.assertTrue(response.has_key("playlists"))
|
||||
self.assertTrue(response.has_key("check"))
|
||||
self.assertTrue(status == 1)
|
||||
|
||||
def test_get_media(self):
|
||||
self.assertTrue(True)
|
||||
|
||||
def test_notify_scheduled_item_start_playing(self):
|
||||
arr = dict()
|
||||
arr["x"] = dict()
|
||||
arr["x"]["schedule_id"]=1
|
||||
|
||||
response = self.api_client.notify_scheduled_item_start_playing("x", arr)
|
||||
self.assertTrue(response.has_key("status"))
|
||||
self.assertTrue(response.has_key("message"))
|
||||
|
||||
def test_notify_media_item_start_playing(self):
|
||||
response = self.api_client.notify_media_item_start_playing('{"schedule_id":1}', 5)
|
||||
return response =
|
||||
self.assertTrue(response.has_key("status"))
|
||||
self.assertTrue(response.has_key("message"))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Binary file not shown.
|
@ -10,4 +10,3 @@ wsgiref==0.1.2
|
|||
configobj==4.7.2
|
||||
mutagen==1.20
|
||||
docopt==0.4.2
|
||||
gevent==0.13.7
|
||||
|
|
|
@ -159,6 +159,7 @@ def WatchAddAction(option, opt, value, parser):
|
|||
path = currentDir+path
|
||||
path = apc.encode_to(path, 'utf-8')
|
||||
if(os.path.isdir(path)):
|
||||
os.chmod(path, 0765)
|
||||
res = api_client.add_watched_dir(path)
|
||||
if(res is None):
|
||||
exit("Unable to connect to the server.")
|
||||
|
|
Loading…
Reference in New Issue