Merge branch 'master' of dev.sourcefabric.org:campcaster
Conflicts: .zfproject.xml
This commit is contained in:
commit
def79d7679
189 changed files with 138 additions and 64033 deletions
|
@ -102,7 +102,14 @@ class Playlist {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
public static function findPlaylistByName($p_name)
|
||||
{
|
||||
$res = CcPlaylistQuery::create()->findByDbName($p_name);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch instance of Playlist object.<br>
|
||||
*
|
||||
* @param string $id
|
||||
|
@ -414,7 +421,7 @@ class Playlist {
|
|||
if (is_null($media) || PEAR::isError($media)) {
|
||||
return $media;
|
||||
}
|
||||
|
||||
|
||||
$metadata = $media->getMetadata();
|
||||
$length = $metadata["length"];
|
||||
|
||||
|
@ -425,7 +432,7 @@ class Playlist {
|
|||
// insert at end of playlist.
|
||||
if (is_null($p_position))
|
||||
$p_position = $this->getNextPos();
|
||||
|
||||
|
||||
// insert default values if parameter was empty
|
||||
$p_cuein = !is_null($p_cuein) ? $p_cuein : '00:00:00.000000';
|
||||
$p_cueout = !is_null($p_cueout) ? $p_cueout : $length;
|
||||
|
@ -434,9 +441,9 @@ class Playlist {
|
|||
$sql = "SELECT INTERVAL '{$p_cueout}' - INTERVAL '{$p_cuein}'";
|
||||
$r = $con->query($sql);
|
||||
$p_cliplength = $r->fetchColumn(0);
|
||||
|
||||
|
||||
$res = $this->insertPlaylistElement($this->id, $p_mediaId, $p_position, $p_cliplength, $p_cuein, $p_cueout, $p_fadeIn, $p_fadeOut);
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -629,7 +636,7 @@ class Playlist {
|
|||
$sql = "SELECT INTERVAL '{$oldCueOut}' - INTERVAL '{$cueIn}'";
|
||||
$r = $con->query($sql);
|
||||
$cliplength = $r->fetchColumn(0);
|
||||
|
||||
|
||||
$row->setDbCuein($cueIn);
|
||||
$row->setDBCliplength($cliplength);
|
||||
}
|
||||
|
|
|
@ -401,6 +401,26 @@ class Schedule {
|
|||
return $t[0]."-".$t[1]."-".$t[2]." ".$t[3].":".$t[4].":00";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the input string is in the format YYYY-MM-DD-HH-mm
|
||||
*
|
||||
* @param string $p_time
|
||||
* @return boolean
|
||||
*/
|
||||
public static function ValidPypoTimeFormat($p_time)
|
||||
{
|
||||
$t = explode("-", $p_time);
|
||||
if (count($t) != 5) {
|
||||
return false;
|
||||
}
|
||||
foreach ($t as $part) {
|
||||
if (!is_numeric($part)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a time value as a string (with format HH:MM:SS.mmmmmm) to
|
||||
* millisecs.
|
||||
|
|
|
@ -1697,7 +1697,7 @@ class StoredFile {
|
|||
{
|
||||
global $CC_CONFIG;
|
||||
return "http://".$CC_CONFIG["storageUrlHost"]
|
||||
.$CC_CONFIG["apiPath"]."get_media.php?file="
|
||||
.$CC_CONFIG["apiPath"]."getMedia/file/"
|
||||
.$this->gunid.".".$this->getFileExtension();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,85 +0,0 @@
|
|||
<?php
|
||||
require_once '../../conf.php';
|
||||
require_once '../Playlist.php';
|
||||
require_once '../StoredFile.php';
|
||||
require_once(__DIR__.'/../../3rd_party/php/propel/runtime/lib/Propel.php');
|
||||
// Initialize Propel with the runtime configuration
|
||||
Propel::init(__DIR__."/../propel-db/build/conf/campcaster-conf.php");
|
||||
// Add the generated 'classes' directory to the include path
|
||||
set_include_path(__DIR__."/../propel-db/build/classes" . PATH_SEPARATOR . get_include_path());
|
||||
|
||||
$playlistName = "pypo_playlist_test";
|
||||
$minutesFromNow = 1;
|
||||
|
||||
echo " ************************************************************** \n";
|
||||
echo " This script schedules a playlist to play $minutesFromNow 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);
|
||||
|
||||
// Add a media clip
|
||||
$mediaFile = StoredFile::findByOriginalName("Manolo Camp - Morning Coffee.mp3");
|
||||
if (is_null($mediaFile)) {
|
||||
echo "Adding test audio clip to the database.\n";
|
||||
$v = array("filepath" => __DIR__."/../../audio_samples/OpSound/Manolo Camp - Morning Coffee.mp3");
|
||||
$mediaFile = StoredFile::Insert($v);
|
||||
if (PEAR::isError($mediaFile)) {
|
||||
var_dump($mediaFile);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
$pl->addAudioClip($mediaFile->getId());
|
||||
$mediaFile = 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/OpSound/Peter Rudenko - Opening.mp3");
|
||||
$mediaFile = StoredFile::Insert($v);
|
||||
if (PEAR::isError($mediaFile)) {
|
||||
var_dump($mediaFile);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
$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...";
|
||||
// Scheduler: remove any playlists for the next hour
|
||||
Schedule::RemoveItemsInRange($startTime, $endTime);
|
||||
// Check for succcess
|
||||
$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));
|
||||
$scheduleGroup = new ScheduleGroup();
|
||||
$scheduleGroup->add($playTime, null, $pl->getId());
|
||||
|
||||
echo " SUCCESS: Playlist scheduled at $playTime\n\n";
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue