CC-1672 Implement scheduler class in PHP
Part 1 of this implementation This implementation keeps the playlists separate from the scheduler. The scheduler keeps it's own copy of the list of things to play. Support for adding single audio files to the scheduler is mostly implemented. Adding playlists is not supported yet. Added Scheduler.php class. Added unit tests for Scheduler. Updated install & upgrade file with new table structure. Removed a lot of old defunct unit test stuff from storageServer /var/tests dir.
This commit is contained in:
parent
582969915c
commit
f4d260b02d
|
@ -52,9 +52,19 @@ ALTER TABLE cc_files
|
|||
ALTER TABLE cc_files
|
||||
ADD COLUMN url character varying(1024);
|
||||
|
||||
|
||||
|
||||
ALTER TABLE cc_schedule RENAME playlist TO playlist_id;
|
||||
ALTER TABLE cc_schedule ALTER playlist_id TYPE integer;
|
||||
ALTER TABLE cc_schedule ADD COLUMN group_id integer;
|
||||
ALTER TABLE cc_schedule ADD COLUMN file_id integer;
|
||||
ALTER TABLE cc_schedule
|
||||
ADD COLUMN fade_in time without time zone DEFAULT '00:00:00.000';
|
||||
ALTER TABLE cc_schedule
|
||||
ADD COLUMN fade_out time without time zone DEFAULT '00:00:00.000';
|
||||
ALTER TABLE cc_schedule
|
||||
ADD COLUMN cue_in time without time zone DEFAULT '00:00:00.000';
|
||||
ALTER TABLE cc_schedule
|
||||
ADD COLUMN cue_out time without time zone DEFAULT '00:00:00.000';
|
||||
ALTER TABLE cc_schedule ADD CONSTRAINT unique_id UNIQUE (id);
|
||||
|
||||
CREATE SEQUENCE schedule_group_id_seq;
|
||||
|
||||
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
|
||||
require_once(dirname(__FILE__)."/../../storageServer/var/Schedule.php");
|
||||
/**
|
||||
* @package Campcaster
|
||||
* @subpackage htmlUI
|
||||
|
@ -1006,8 +1008,8 @@ class uiScheduler extends uiCalendar {
|
|||
*/
|
||||
function initXmlRpc()
|
||||
{
|
||||
include_once(dirname(__FILE__).'/ui_schedulerPhpClient.class.php');
|
||||
$this->spc =& SchedulerPhpClient::factory($mdefs, FALSE, FALSE);
|
||||
// include_once(dirname(__FILE__).'/ui_schedulerPhpClient.class.php');
|
||||
// $this->spc =& SchedulerPhpClient::factory($mdefs, FALSE, FALSE);
|
||||
} // fn initXmlRpc
|
||||
|
||||
|
||||
|
@ -1033,36 +1035,41 @@ class uiScheduler extends uiCalendar {
|
|||
$datetime = $formdata['date']['Y']
|
||||
.sprintf('%02d', $formdata['date']['m'])
|
||||
.sprintf('%02d', $formdata['date']['d'])
|
||||
.'T'.sprintf('%02d', $formdata['time']['H'])
|
||||
.' '.sprintf('%02d', $formdata['time']['H'])
|
||||
.':'.sprintf('%02d', $formdata['time']['i'])
|
||||
.':'.sprintf('%02d', $formdata['time']['s']);
|
||||
|
||||
$r = $this->spc->UploadPlaylistMethod($this->Base->sessid, $gunid, $datetime);
|
||||
if ($this->_isError($r)) {
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
$item = new ScheduleItem();
|
||||
$groupId = $item->add($datetime, $gunid);
|
||||
return is_numeric($groupId);
|
||||
// $r = $this->spc->UploadPlaylistMethod($this->Base->sessid, $gunid, $datetime);
|
||||
// if ($this->_isError($r)) {
|
||||
// return FALSE;
|
||||
// }
|
||||
// return TRUE;
|
||||
} // fn uploadPlaylistMethod
|
||||
|
||||
|
||||
/**
|
||||
* Remove a playlist from the scheduler.
|
||||
* Remove an item from the scheduler.
|
||||
*
|
||||
* @param string $id
|
||||
* gunid of the playlist
|
||||
* groupId of the item
|
||||
* @return boolean
|
||||
* TRUE on success, FALSE on failure.
|
||||
*/
|
||||
function removeFromScheduleMethod($id)
|
||||
function removeFromScheduleMethod($p_groupId)
|
||||
{
|
||||
$r = $this->spc->removeFromScheduleMethod($this->Base->sessid, $id);
|
||||
if ($this->_isError($r)) {
|
||||
return FALSE;
|
||||
}
|
||||
if (UI_VERBOSE) {
|
||||
$this->Base->_retMsg('Entry with ScheduleId $1 removed.', $id);
|
||||
}
|
||||
return TRUE;
|
||||
$item = new ScheduleItem($p_groupId);
|
||||
$success = $item->remove();
|
||||
//$r = $this->spc->removeFromScheduleMethod($this->Base->sessid, $id);
|
||||
if (!$success) {
|
||||
return FALSE;
|
||||
}
|
||||
if (UI_VERBOSE) {
|
||||
$this->Base->_retMsg('Entry with ScheduleId $1 removed.', $id);
|
||||
}
|
||||
return TRUE;
|
||||
} // fn removeFromScheduleMethod
|
||||
|
||||
|
||||
|
@ -1077,11 +1084,14 @@ class uiScheduler extends uiCalendar {
|
|||
*/
|
||||
function displayScheduleMethod($from, $to)
|
||||
{
|
||||
$r = $this->spc->displayScheduleMethod($this->Base->sessid, $from, $to);
|
||||
if ($this->_isError($r)) {
|
||||
return FALSE;
|
||||
}
|
||||
return $r;
|
||||
// NOTE: Need to fix times.
|
||||
$items = Schedule::GetItems($from, $to);
|
||||
return $items;
|
||||
// $r = $this->spc->displayScheduleMethod($this->Base->sessid, $from, $to);
|
||||
// if ($this->_isError($r)) {
|
||||
// return FALSE;
|
||||
// }
|
||||
// return $r;
|
||||
} // fn displayScheduleMethod
|
||||
|
||||
|
||||
|
@ -1260,6 +1270,7 @@ class uiScheduler extends uiCalendar {
|
|||
|
||||
public function getSchedulerTime()
|
||||
{
|
||||
return time();
|
||||
static $first, $cached;
|
||||
if (!$first) {
|
||||
$first = time();
|
||||
|
|
|
@ -0,0 +1,199 @@
|
|||
<?php
|
||||
|
||||
class ScheduleItem {
|
||||
|
||||
private $groupId;
|
||||
|
||||
public function __construct($p_groupId = null) {
|
||||
$this->groupId = $p_groupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date to an ID by stripping out all characters
|
||||
* and padding with zeros.
|
||||
*
|
||||
* @param string $p_dateStr
|
||||
*/
|
||||
public static function dateToId($p_dateStr) {
|
||||
$p_dateStr = str_replace(":", "", $p_dateStr);
|
||||
$p_dateStr = str_replace(" ", "", $p_dateStr);
|
||||
$p_dateStr = str_replace(".", "", $p_dateStr);
|
||||
$p_dateStr = str_replace("-", "", $p_dateStr);
|
||||
$p_dateStr = substr($p_dateStr, 0, 17);
|
||||
$p_dateStr = str_pad($p_dateStr, 17, "0");
|
||||
return $p_dateStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the two times together, return the result.
|
||||
*
|
||||
* @param string $p_baseTime
|
||||
* Specified as YYYY-MM-DD HH:MM:SS
|
||||
*
|
||||
* @param string $p_addTime
|
||||
* Specified as HH:MM:SS.nnnnnn
|
||||
*
|
||||
* @return string
|
||||
* The end time, to the nearest second.
|
||||
*/
|
||||
// protected function calculateEndTime($p_startTime, $p_trackTime) {
|
||||
// $p_trackTime = substr($p_startTime, 0, );
|
||||
// $start = new DateTime();
|
||||
// $interval = new DateInterval()
|
||||
//
|
||||
// }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param $p_audioFileId
|
||||
* @param $p_playlistId
|
||||
* @param $p_datetime
|
||||
* @param $p_options
|
||||
* @return int|null
|
||||
* Return null if the item could not be added.
|
||||
*/
|
||||
public function add($p_datetime, $p_audioFileId = null, $p_playlistId = null, $p_options = null) {
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
if (!is_null($p_audioFileId)) {
|
||||
// Schedule a single audio track
|
||||
|
||||
// Load existing track
|
||||
$track = StoredFile::Recall($p_audioFileId);
|
||||
if (is_null($track)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Check if there are any conflicts with existing entries
|
||||
$metadata = $track->getMetadata();
|
||||
$length = trim($metadata["length"]);
|
||||
if (!Schedule::isScheduleEmptyInRange($p_datetime, $length)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Insert into the table
|
||||
$this->groupId = $CC_DBC->GetOne("SELECT nextval('schedule_group_id_seq')");
|
||||
$id = $this->dateToId($p_datetime);
|
||||
$sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"]
|
||||
." (id, playlist_id, starts, ends, group_id, file_id)"
|
||||
." VALUES ($id, 0, TIMESTAMP '$p_datetime', "
|
||||
." (TIMESTAMP '$p_datetime' + INTERVAL '$length'),"
|
||||
." {$this->groupId}, $p_audioFileId)";
|
||||
$CC_DBC->query($sql);
|
||||
return $this->groupId;
|
||||
|
||||
} elseif (!is_null($p_playlistId)){
|
||||
// Schedule a whole playlist
|
||||
}
|
||||
|
||||
// return group ID
|
||||
}
|
||||
|
||||
public function addAfter($p_groupId, $p_audioFileId) {
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
// Get the end time for the given entry
|
||||
$sql = "SELECT ends FROM ".$CC_CONFIG["scheduleTable"]
|
||||
." WHERE group_id=$p_groupId";
|
||||
$startTime = $CC_DBC->GetOne($sql);
|
||||
return $this->add($startTime, $p_audioFileId);
|
||||
}
|
||||
|
||||
public function update() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the group from the schedule.
|
||||
* Note: does not check if it is in the past, you can remove anything.
|
||||
*
|
||||
* @return boolean
|
||||
* TRUE on success, false if there is no group ID defined.
|
||||
*/
|
||||
public function remove() {
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
if (is_null($this->groupId) || !is_numeric($this->groupId)) {
|
||||
return false;
|
||||
}
|
||||
$sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"]
|
||||
." WHERE group_id = ".$this->groupId;
|
||||
return $CC_DBC->query($sql);
|
||||
}
|
||||
|
||||
public function reschedule($toDateTime) {
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
// $sql = "UPDATE ".$CC_CONFIG["scheduleTable"]. " SET id=, starts=,ends="
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Schedule {
|
||||
|
||||
function __construct() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if there is nothing in the schedule for the given times.
|
||||
*
|
||||
* @param string $p_datetime
|
||||
* @param string $p_length
|
||||
*/
|
||||
public static function isScheduleEmptyInRange($p_datetime, $p_length) {
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$sql = "SELECT COUNT(*) FROM ".$CC_CONFIG["scheduleTable"]
|
||||
." WHERE (starts <= '$p_datetime') "
|
||||
." AND (ends >= (TIMESTAMP '$p_datetime' + INTERVAL '$p_length'))";
|
||||
$count = $CC_DBC->GetOne($sql);
|
||||
return ($count == '0');
|
||||
}
|
||||
|
||||
public function onAddTrackToPlaylist($playlistId, $audioTrackId) {
|
||||
|
||||
}
|
||||
|
||||
public function onRemoveTrackFromPlaylist($playlistId, $audioTrackId) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns array indexed numberically of:
|
||||
* "playlistId" (gunid)
|
||||
* "start"
|
||||
* "end"
|
||||
* "id" (DB id)
|
||||
*
|
||||
* @param $fromDateTime
|
||||
* @param $toDateTime
|
||||
*/
|
||||
public static function GetItems($fromDateTime, $toDateTime, $playlistsOnly = true) {
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$sql = "SELECT * FROM ".$CC_CONFIG["scheduleTable"]
|
||||
." WHERE (starts >= TIMESTAMP '$fromDateTime') "
|
||||
." AND (ends <= TIMESTAMP '$toDateTime')";
|
||||
$rows = $CC_DBC->GetAll($sql);
|
||||
foreach ($rows as &$row) {
|
||||
$row["playlistId"] = $row["playlist_id"];
|
||||
$row["start"] = $row["starts"];
|
||||
$row["end"] = $row["ends"];
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
function getSchedulerTime() {
|
||||
|
||||
}
|
||||
|
||||
function getCurrentlyPlaying() {
|
||||
|
||||
}
|
||||
|
||||
function getNextItem($nextCount = 1) {
|
||||
|
||||
}
|
||||
|
||||
function getStatus() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1003,14 +1003,12 @@ class StoredFile {
|
|||
|
||||
|
||||
/**
|
||||
* Get metadata as XML string
|
||||
* Get metadata as array, indexed by the column names in the database.
|
||||
*
|
||||
* @return XML string
|
||||
* @see MetaData
|
||||
* @return array
|
||||
*/
|
||||
public function getMetadata()
|
||||
{
|
||||
//return $this->md->getMetadata();
|
||||
return $this->md;
|
||||
}
|
||||
|
||||
|
|
|
@ -371,11 +371,18 @@ if (!camp_db_table_exists($CC_CONFIG['transTable'])) {
|
|||
if (!camp_db_table_exists($CC_CONFIG['scheduleTable'])) {
|
||||
echo " * Creating database table ".$CC_CONFIG['scheduleTable']."...";
|
||||
$sql = "CREATE TABLE ".$CC_CONFIG['scheduleTable']."("
|
||||
." id BIGINT NOT NULL,"
|
||||
." playlist BIGINT NOT NULL,"
|
||||
." starts TIMESTAMP NOT NULL,"
|
||||
." ends TIMESTAMP NOT NULL,"
|
||||
." PRIMARY KEY(id))";
|
||||
." id bigint NOT NULL,"
|
||||
." playlist_id integer NOT NULL,"
|
||||
." starts timestamp without time zone NOT NULL,"
|
||||
." ends timestamp without time zone NOT NULL,"
|
||||
." group_id integer,"
|
||||
." file_id integer,"
|
||||
." fade_in time without time zone DEFAULT '00:00:00'::time without time zone,"
|
||||
." fade_out time without time zone DEFAULT '00:00:00'::time without time zone,"
|
||||
." cue_in time without time zone DEFAULT '00:00:00'::time without time zone,"
|
||||
." cue_out time without time zone DEFAULT '00:00:00'::time without time zone,"
|
||||
." CONSTRAINT cc_schedule_pkey PRIMARY KEY (id),"
|
||||
." CONSTRAINT unique_id UNIQUE (id))";
|
||||
camp_install_query($sql);
|
||||
} else {
|
||||
echo " * Skipping: database table already exists: ".$CC_CONFIG['scheduleTable']."\n";
|
||||
|
|
|
@ -107,7 +107,7 @@ if (camp_db_table_exists($CC_CONFIG['mdataTable'])) {
|
|||
|
||||
if (camp_db_table_exists($CC_CONFIG['filesTable'])) {
|
||||
echo " * Removing database table ".$CC_CONFIG['filesTable']."...";
|
||||
$sql = "DROP TABLE ".$CC_CONFIG['filesTable'];
|
||||
$sql = "DROP TABLE ".$CC_CONFIG['filesTable']." CASCADE";
|
||||
camp_install_query($sql);
|
||||
$CC_DBC->dropSequence($CC_CONFIG['filesTable']."_id");
|
||||
|
||||
|
@ -151,7 +151,7 @@ if (camp_db_table_exists($CC_CONFIG['subjTable'])) {
|
|||
echo " * Removing database table ".$CC_CONFIG['subjTable']."...";
|
||||
$CC_DBC->dropSequence($CC_CONFIG['subjTable']."_id");
|
||||
|
||||
$sql = "DROP TABLE ".$CC_CONFIG['subjTable'];
|
||||
$sql = "DROP TABLE ".$CC_CONFIG['subjTable']." CASCADE";
|
||||
camp_install_query($sql, false);
|
||||
|
||||
echo "done.\n";
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<audioClip>
|
||||
<metadata
|
||||
xmlns="http://mdlf.org/campcaster/elements/1.0/"
|
||||
xmlns:ls="http://mdlf.org/campcaster/elements/1.0/"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:dcterms="http://purl.org/dc/terms/"
|
||||
xmlns:xml="http://www.w3.org/XML/1998/namespace"
|
||||
>
|
||||
<dc:title>one</dc:title>
|
||||
<dcterms:extent>00:00:11.000000</dcterms:extent>
|
||||
</metadata>
|
||||
</audioClip>
|
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<audioClip>
|
||||
<metadata
|
||||
xmlns="http://mdlf.org/campcaster/elements/1.0/"
|
||||
xmlns:ls="http://mdlf.org/campcaster/elements/1.0/"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:dcterms="http://purl.org/dc/terms/"
|
||||
xmlns:xml="http://www.w3.org/XML/1998/namespace"
|
||||
>
|
||||
<dc:title >two</dc:title>
|
||||
<dcterms:extent >00:00:12.200000</dcterms:extent>
|
||||
</metadata>
|
||||
</audioClip>
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
require_once(dirname(__FILE__).'/../conf.php');
|
||||
require_once('DB.php');
|
||||
require_once('PHPUnit.php');
|
||||
require_once 'BasicStorTests.php';
|
||||
require_once 'SchedulerTests.php';
|
||||
|
||||
$suite = new PHPUnit_TestSuite("BasicStorTest");
|
||||
$suite->addTestSuite("SchedulerTests");
|
||||
$result = PHPUnit::run($suite);
|
||||
|
||||
echo $result->toString();
|
||||
|
||||
?>
|
|
@ -1,7 +1,4 @@
|
|||
<?php
|
||||
require_once(dirname(__FILE__).'/../conf.php');
|
||||
require_once('PHPUnit.php');
|
||||
require_once('DB.php');
|
||||
require_once(dirname(__FILE__).'/../StoredFile.php');
|
||||
require_once(dirname(__FILE__).'/../BasicStor.php');
|
||||
require_once(dirname(__FILE__).'/../GreenBox.php');
|
||||
|
@ -18,9 +15,9 @@ class BasicStorTest extends PHPUnit_TestCase {
|
|||
|
||||
private $greenbox;
|
||||
|
||||
function __construct($name) {
|
||||
parent::__construct($name);
|
||||
}
|
||||
// function __construct($name) {
|
||||
// parent::__construct($name);
|
||||
// }
|
||||
|
||||
function setup() {
|
||||
$this->greenbox = new GreenBox();
|
||||
|
@ -42,6 +39,7 @@ class BasicStorTest extends PHPUnit_TestCase {
|
|||
$this->fail("Metadata has unexpected values:\n".$str);
|
||||
}
|
||||
//var_dump($metadata);
|
||||
//$this->assertTrue(FALSE);
|
||||
}
|
||||
|
||||
function testPutFile() {
|
|
@ -1,24 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<audioClip>
|
||||
<metadata
|
||||
xmlns="http://mdlf.org/campcaster/elements/1.0/"
|
||||
xmlns:ls="http://mdlf.org/campcaster/elements/1.0/"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:dcterms="http://purl.org/dc/terms/"
|
||||
xmlns:xml="http://www.w3.org/XML/1998/namespace"
|
||||
>
|
||||
<dc:title>File Title txt</dc:title>
|
||||
<dcterms:alternative>Alternative File Title ín sőmé %$#@* LÁNGŰAGÉ</dcterms:alternative>
|
||||
<dc:subject>Keywords: qwe, asd, zcx</dc:subject>
|
||||
<dc:description>Abstract txt</dc:description>
|
||||
<dc:date>2004-05-21</dc:date>
|
||||
<ls:genre>Folk</ls:genre>
|
||||
<dc:format>audio/mpeg</dc:format>
|
||||
<dcterms:extent>00:00:03.000000</dcterms:extent>
|
||||
<!-- <dcterms:medium>online</dcterms:medium>-->
|
||||
<dc:identifier>gunid here</dc:identifier>
|
||||
<dcterms:spatial>Spatial Coverage</dcterms:spatial>
|
||||
<dcterms:temporal>Temporal Covarage</dcterms:temporal>
|
||||
<dc:creator>János Kőbor</dc:creator>
|
||||
</metadata>
|
||||
</audioClip>
|
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<audioClip>
|
||||
<metadata
|
||||
xmlns="http://mdlf.org/campcaster/elements/1.0/"
|
||||
xmlns:ls="http://mdlf.org/campcaster/elements/1.0/"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:dcterms="http://purl.org/dc/terms/"
|
||||
xmlns:xml="http://www.w3.org/XML/1998/namespace"
|
||||
>
|
||||
<dc:title>one</dc:title>
|
||||
<dcterms:extent>00:00:11.000000</dcterms:extent>
|
||||
</metadata>
|
||||
</audioClip>
|
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<audioClip>
|
||||
<metadata
|
||||
xmlns="http://mdlf.org/campcaster/elements/1.0/"
|
||||
xmlns:ls="http://mdlf.org/campcaster/elements/1.0/"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:dcterms="http://purl.org/dc/terms/"
|
||||
xmlns:xml="http://www.w3.org/XML/1998/namespace"
|
||||
>
|
||||
<dc:title >two</dc:title>
|
||||
<dcterms:extent >00:00:12.200000</dcterms:extent>
|
||||
</metadata>
|
||||
</audioClip>
|
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<audioClip>
|
||||
<metadata
|
||||
xmlns="http://mdlf.org/campcaster/elements/1.0/"
|
||||
xmlns:ls="http://mdlf.org/campcaster/elements/1.0/"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:dcterms="http://purl.org/dc/terms/"
|
||||
xmlns:xml="http://www.w3.org/XML/1998/namespace"
|
||||
>
|
||||
<dc:title>three</dc:title>
|
||||
<dcterms:extent>00:00:11.500000</dcterms:extent>
|
||||
</metadata>
|
||||
</audioClip>
|
|
@ -1,23 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<audioClip>
|
||||
<metadata
|
||||
xmlns="http://mdlf.org/campcaster/elements/1.0/"
|
||||
xmlns:ls="http://mdlf.org/campcaster/elements/1.0/"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:dcterms="http://purl.org/dc/terms/"
|
||||
xmlns:xml="http://www.w3.org/XML/1998/namespace"
|
||||
>
|
||||
<dc:title >File2 Title txt</dc:title>
|
||||
<dcterms:alternative >Alternative File2 Title txt</dcterms:alternative>
|
||||
<dc:subject >Keywords: qwe, asd, zcx</dc:subject>
|
||||
<dc:description >Abstract txt</dc:description>
|
||||
<dc:date >2004-05-21</dc:date>
|
||||
<dc:format>audio/mpeg</dc:format>
|
||||
<dcterms:extent >00:10:00.000000</dcterms:extent>
|
||||
<!-- <dcterms:medium >online</dcterms:medium>-->
|
||||
<dc:identifier >gunid here</dc:identifier>
|
||||
<dcterms:spatial >Spatial Coverage</dcterms:spatial>
|
||||
<dcterms:temporal >Temporal Covarage</dcterms:temporal>
|
||||
<dc:creator>John X2</dc:creator>
|
||||
</metadata>
|
||||
</audioClip>
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<audioClip>
|
||||
<metadata
|
||||
xmlns="http://mdlf.org/campcaster/elements/1.0/"
|
||||
xmlns:ls="http://mdlf.org/campcaster/elements/1.0/"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:dcterms="http://purl.org/dc/terms/"
|
||||
xmlns:xml="http://www.w3.org/XML/1998/namespace"
|
||||
>
|
||||
<dc:title >Fil Title3 txt</dc:title>
|
||||
<dcterms:alternative >Alternative File Title txt</dcterms:alternative>
|
||||
<dcterms:extent >00:01:00.000000</dcterms:extent>
|
||||
<dc:creator>John Y</dc:creator>
|
||||
</metadata>
|
||||
</audioClip>
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<audioClip>
|
||||
<metadata
|
||||
xmlns="http://mdlf.org/campcaster/elements/1.0/"
|
||||
xmlns:ls="http://mdlf.org/campcaster/elements/1.0/"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:dcterms="http://purl.org/dc/terms/"
|
||||
xmlns:xml="http://www.w3.org/XML/1998/namespace"
|
||||
>
|
||||
<dc:title>File Title4 utf-8</dc:title>
|
||||
<dcterms:alternative>ěščřžýáíé ĚŠČŘŽÝÁÍÉ úůÚŮ ďťňĎŤŇ é</dcterms:alternative>
|
||||
<dcterms:extent>00:00:10.000000</dcterms:extent>
|
||||
<dc:creator>John Y</dc:creator>
|
||||
</metadata>
|
||||
</audioClip>
|
|
@ -1,27 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<playlist id="0000000000000001" playlength="01:30:00.000000"
|
||||
title="My First Playlist">
|
||||
<playlistElement id="0000000000000101" relativeOffset="0" >
|
||||
<audioClip id="0000000000010001" playlength="01:00:00.000000"
|
||||
title="one"/>
|
||||
<fadeInfo fadeIn="02.000000" fadeOut="03.000000"
|
||||
id="15015b4b70a054f1" />
|
||||
</playlistElement>
|
||||
<playlistElement id="0000000000000102" relativeOffset="01:00:00.000000" >
|
||||
<audioClip id="0000000000010002" playlength="00:30:00.000000"
|
||||
title="two"/>
|
||||
<fadeInfo fadeIn="03.000000" fadeOut="00.000000"
|
||||
id="15015b4b70a054f2" />
|
||||
</playlistElement>
|
||||
<metadata
|
||||
xmlns="http://mdlf.org/campcaster/elements/1.0/"
|
||||
xmlns:ls="http://mdlf.org/campcaster/elements/1.0/"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:dcterms="http://purl.org/dc/terms/"
|
||||
xmlns:xml="http://www.w3.org/XML/1998/namespace"
|
||||
>
|
||||
<dc:title>My First Playlist</dc:title>
|
||||
<dc:creator>Me, myself and I</dc:creator>
|
||||
<dcterms:extent>01:30:00.000000</dcterms:extent>
|
||||
</metadata>
|
||||
</playlist>
|
|
@ -1,44 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<playlist id="0000000000000002"
|
||||
title="My Second Playlist"
|
||||
playlength="00:00:29.700000" >
|
||||
<playlistElement id="0000000000000101"
|
||||
relativeOffset="0" >
|
||||
<audioClip id="0000000000010001"
|
||||
playlength="00:00:11"
|
||||
title = "one"
|
||||
uri="file:var/test10001.mp3" />
|
||||
<fadeInfo id="0000000000009901"
|
||||
fadeIn="0"
|
||||
fadeOut="00:00:05" />
|
||||
</playlistElement>
|
||||
<playlistElement id="0000000000000102"
|
||||
relativeOffset="00:00:06" >
|
||||
<audioClip id="0000000000010002"
|
||||
playlength="00:00:12.200000"
|
||||
title = "two"
|
||||
uri="file:var/test10002.mp3" />
|
||||
<fadeInfo id="0000000000009902"
|
||||
fadeIn="00:00:05"
|
||||
fadeOut="0" />
|
||||
</playlistElement>
|
||||
<playlistElement id="0000000000000103"
|
||||
relativeOffset="00:00:18.200000" >
|
||||
<audioClip id="0000000000010003"
|
||||
playlength="00:00:11.500000"
|
||||
title = "three"
|
||||
uri="file:var/test10003.mp3" />
|
||||
<fadeInfo id="0000000000009903"
|
||||
fadeIn="00:00:03"
|
||||
fadeOut="00:00:03" />
|
||||
</playlistElement>
|
||||
<metadata xmlns="http://mdlf.org/campcaster/elements/1.0/"
|
||||
xmlns:ls="http://mdlf.org/campcaster/elements/1.0/"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:dcterms="http://purl.org/dc/terms/"
|
||||
xmlns:xml="http://www.w3.org/XML/1998/namespace" >
|
||||
<dc:title>My Second Playlist</dc:title>
|
||||
<dc:creator>Nobody</dc:creator>
|
||||
<dcterms:extent>00:00:29.700000</dcterms:extent>
|
||||
</metadata>
|
||||
</playlist>
|
|
@ -1,9 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once 'UnitTests.php';
|
||||
|
||||
$suite = new PHPUnit_TestSuite("BasicStorTest");
|
||||
$result = PHPUnit::run($suite);
|
||||
|
||||
echo $result->toString();
|
||||
?>
|
|
@ -1,59 +0,0 @@
|
|||
<?
|
||||
$sampleData = array(
|
||||
array(
|
||||
'type' => 'audioclip',
|
||||
'media' => '../tests/test10001.mp3',
|
||||
'xml' => '../tests/mdata10001.xml',
|
||||
'gunid' => '0000000000010001'
|
||||
),
|
||||
array(
|
||||
'type' => 'audioclip',
|
||||
'media' => '../tests/test10002.mp3',
|
||||
'xml' => '../tests/mdata10002.xml',
|
||||
'gunid' => '0000000000010002'
|
||||
),
|
||||
array(
|
||||
'type' => 'audioclip',
|
||||
'media' => '../tests/test10003.mp3',
|
||||
'xml' => '../tests/mdata10003.xml',
|
||||
'gunid' => '0000000000010003'
|
||||
),
|
||||
array(
|
||||
'type' => 'audioclip',
|
||||
'media' => '../tests/ex1.mp3',
|
||||
'xml' => '../tests/mdata1.xml',
|
||||
'gunid' => '123456789abcdef1'
|
||||
),
|
||||
array(
|
||||
'type' => 'audioclip',
|
||||
'media' => '../tests/ex2.ogg',
|
||||
'xml' => '../tests/mdata2.xml',
|
||||
'gunid' => '123456789abcdef2'
|
||||
),
|
||||
array(
|
||||
'type' => 'audioclip',
|
||||
'media' => '../tests/ex3.wav',
|
||||
'xml' => '../tests/mdata3.xml'
|
||||
),
|
||||
array(
|
||||
'type' => 'playlist',
|
||||
'xml' => '../tests/plist1.xml',
|
||||
'gunid' => '0000000000000001'
|
||||
),
|
||||
array(
|
||||
'type' => 'playlist',
|
||||
'xml' => '../tests/plist2.xml',
|
||||
'gunid' => '0000000000000002'
|
||||
),
|
||||
array(
|
||||
'type' => 'playlist',
|
||||
'xml' => '../tests/plistEmbedded.xml',
|
||||
'gunid' => '0000000000000003'
|
||||
),
|
||||
array(
|
||||
'type' => 'webstream',
|
||||
'xml' => '../tests/wstream1.xml',
|
||||
'gunid' => 'f000000000000001'
|
||||
)
|
||||
);
|
||||
?>
|
|
@ -1,12 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!DOCTYPE testStorage [
|
||||
|
||||
<!ELEMENT testStorage (playlist*) >
|
||||
|
||||
<!ELEMENT playlist EMPTY >
|
||||
<!ATTLIST playlist id NMTOKEN #REQUIRED >
|
||||
<!ATTLIST playlist playlength NMTOKEN #REQUIRED >
|
||||
]>
|
||||
<testStorage>
|
||||
<playlist id="1" playlength="01:30:00.00"/>
|
||||
</testStorage>
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
/*
|
||||
header("Content-type: text/plain");
|
||||
|
||||
require_once('../conf.php');
|
||||
|
@ -28,14 +29,8 @@ if (PEAR::isError($result)) {
|
|||
} else {
|
||||
var_dump($result);
|
||||
}
|
||||
//$client = XML_RPC2_Client::create('http://localhost/~paul/campcaster/storageServer/var/xmlrpc/xrLocStor2.php', array('backend'=>'php', 'prefix' => "Campcaster_Remote."));
|
||||
////var_dump($client);
|
||||
//$result = $client->System_Ping("woo");
|
||||
//var_dump($result);
|
||||
exit;
|
||||
|
||||
|
||||
/* ========== STORE ========== */
|
||||
// ========== STORE ==========
|
||||
|
||||
echo"# Store: ";
|
||||
//$parid = $gb->_getHomeDirIdFromSess($sessid);
|
||||
|
@ -57,7 +52,7 @@ $oid = $storedFile->getId();
|
|||
$comm = "ls -l ".$CC_CONFIG['storageDir']."/a23"; echo `$comm`;
|
||||
echo "$oid\n";
|
||||
|
||||
/* ========== DELETE FROM HUB ========== */
|
||||
// ========== DELETE FROM HUB ==========
|
||||
echo"# loginToArchive: ";
|
||||
$r = $tr->loginToArchive();
|
||||
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()." / ".$r->getUserInfo()."\n"; exit(1); }
|
||||
|
@ -80,7 +75,7 @@ if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()." / ".$r->getUserInfo()."
|
|||
var_export($r); echo"\n";
|
||||
|
||||
|
||||
/* ========== UPLOAD ========== */
|
||||
// ========== UPLOAD ==========
|
||||
echo "# UPLOAD test:\n";
|
||||
echo"# uploadAudioClip2Hub: ";
|
||||
$r = $gb->upload2Hub($gunid);
|
||||
|
@ -91,16 +86,9 @@ $trtok = $r;
|
|||
echo"# logout: "; $r = Alib::Logout($sessid);
|
||||
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."/".$r->getUserInfo()."\n"; exit(1); }
|
||||
echo "$r\n";
|
||||
/*
|
||||
*/
|
||||
#$trtok='280a6f1c18389620';
|
||||
|
||||
for($state='', $nu=1; ($state!='closed' && $state!='failed' && $nu<=12); $nu++, sleep(2)){
|
||||
/*
|
||||
echo"# $nu: Transport: cronMain: "; $r = $tr->cronMain();
|
||||
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."/".$r->getUserInfo()."\n"; exit(1); }
|
||||
var_export($r); echo"\n";
|
||||
*/
|
||||
echo"# getTransportInfo: "; $r = $gb->getTransportInfo($trtok);
|
||||
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."/".$r->getUserInfo()."\n"; exit(1); }
|
||||
$state = $r['state'];
|
||||
|
@ -108,7 +96,7 @@ for($state='', $nu=1; ($state!='closed' && $state!='failed' && $nu<=12); $nu++,
|
|||
}
|
||||
if($state=='failed') exit(1);
|
||||
|
||||
/* === DELETE LOCAL === */
|
||||
// === DELETE LOCAL ===
|
||||
echo "# Login: ".($sessid = Alib::Login('root', 'q'))."\n";
|
||||
echo "# Delete: "; $r = $ls->deleteAudioClip($sessid, $gunid, TRUE);
|
||||
if (PEAR::isError($r)) {
|
||||
|
@ -124,14 +112,8 @@ if (PEAR::isError($r)) {
|
|||
echo "$r\n";
|
||||
$comm = "ls -l ".$CC_CONFIG['storageDir']."/a23";
|
||||
echo `$comm`;
|
||||
/*
|
||||
*/
|
||||
|
||||
#echo"TMPEND\n"; exit;
|
||||
#echo `tail -n 25 ../trans/log`; exit;
|
||||
#$sleeptime=10; echo "sleep $sleeptime\n"; sleep($sleeptime);
|
||||
|
||||
/* === DOWNLOAD === */
|
||||
// === DOWNLOAD ===
|
||||
echo "# DOWNLOAD test:\n";
|
||||
echo"# Login: ".($sessid = Alib::Login('root', 'q'))."\n";
|
||||
|
||||
|
@ -146,11 +128,6 @@ if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."\n"; exit(1); }
|
|||
echo "$r\n";
|
||||
|
||||
for($state='', $nu=1; ($state!='closed' && $state!='failed' && $nu<=12); $nu++, sleep(2)){
|
||||
/*
|
||||
echo"# $nu: Transport: cronMain: "; $r = $tr->cronMain();
|
||||
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."/".$r->getUserInfo()."\n"; exit(1); }
|
||||
var_export($r); echo"\n";
|
||||
*/
|
||||
echo"# getTransportInfo: "; $r = $gb->getTransportInfo($trtok);
|
||||
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."/".$r->getUserInfo()."\n"; exit(1); }
|
||||
$state = $r['state'];
|
||||
|
@ -159,40 +136,8 @@ for($state='', $nu=1; ($state!='closed' && $state!='failed' && $nu<=12); $nu++,
|
|||
if($state=='failed') exit(1);
|
||||
|
||||
$comm = "ls -l ".$CC_CONFIG['storageDir']."/a23"; echo `$comm`;
|
||||
/*
|
||||
*/
|
||||
|
||||
/*
|
||||
echo"# Login: ".($sessid = Alib::Login('root', 'q'))."\n";
|
||||
echo"# Delete: "; $r = $ls->deleteAudioClip($sessid, $gunid, TRUE);
|
||||
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."\n"; exit(1); }
|
||||
echo "$r\n";
|
||||
echo"# logout: "; $r = Alib::Logout($sessid);
|
||||
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."\n"; exit(1); }
|
||||
echo "$r\n";
|
||||
*/
|
||||
|
||||
#echo `tail -n 20 ../trans/log`; exit;
|
||||
|
||||
/*
|
||||
echo"# Transport loginToArchive: "; $r = $tr->loginToArchive();
|
||||
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."\n"; exit(1); }
|
||||
var_export($r['sessid']); echo"\n";
|
||||
|
||||
echo"# Transport logoutFromArchive: "; $r = $tr->logoutFromArchive($r['sessid']);
|
||||
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."\n"; exit(1); }
|
||||
var_export($r['status']); echo"\n";
|
||||
|
||||
echo"# Ping: ";
|
||||
$r = $tr->ping();
|
||||
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."\n"; exit(1); }
|
||||
var_export($r); echo"\n";
|
||||
|
||||
echo"# Delete: "; $r = $gb->deleteAudioClip($sessid, $gunid);
|
||||
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."\n"; exit(1); }
|
||||
echo "$r\n";
|
||||
*/
|
||||
|
||||
if(file_exists("../trans/log")) echo `tail -n 25 ../trans/log`;
|
||||
echo "#Transport test: OK.\n\n"
|
||||
echo "#Transport test: OK.\n\n";
|
||||
*/
|
||||
?>
|
|
@ -1,222 +0,0 @@
|
|||
#!/bin/bash
|
||||
#-------------------------------------------------------------------------------
|
||||
# Copyright (c) 2010 Sourcefabric O.P.S.
|
||||
#
|
||||
# This file is part of the Campcaster project.
|
||||
# http://campcaster.campware.org/
|
||||
#
|
||||
# Campcaster is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Campcaster is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Campcaster; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# This script call locstor.resetStorage XMLRPC method
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
reldir=`dirname $0`/../..
|
||||
WWW_ROOT=`cd $reldir/var/install; php -q getWwwRoot.php` || exit $?
|
||||
echo "#Transport test: URL: $WWW_ROOT"
|
||||
|
||||
#$reldir/var/xmlrpc/xr_cli_test.py -s $WWW_ROOT/xmlrpc/xrLocStor.php \
|
||||
# resetStorage || exit $?
|
||||
|
||||
cd $reldir/var/xmlrpc
|
||||
XR_CLI="php -q xr_cli_test.php -s $WWW_ROOT/xmlrpc/xrLocStor.php"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# storage related functions
|
||||
#-------------------------------------------------------------------------------
|
||||
login() {
|
||||
echo -n "# login: "
|
||||
SESSID=`$XR_CLI login root q` || \
|
||||
{ ERN=$?; echo $SESSID; exit $ERN; }
|
||||
echo "sessid: $SESSID"
|
||||
}
|
||||
|
||||
storeOpenClose() {
|
||||
GUNID=$1 ; shift
|
||||
[[ "x$1" != "x" ]] && MEDIA="$1" || MEDIA="../tests/ex1.mp3"
|
||||
shift
|
||||
[[ "x$1" != "x" ]] && METADATA=`cat "$1"` || METADATA="<?xml version=\"1.0\"?>
|
||||
<audioClip><metadata xmlns=\"http://www.streamonthefly.org/\"
|
||||
xmlns:dc=\"http://purl.org/dc/elements/1.1/\"
|
||||
xmlns:dcterms=\"http://purl.org/dc/terms/\">
|
||||
<dcterms:extent>00:00:11.000000</dcterms:extent>
|
||||
<dc:title>Transport test file 1</dc:title>
|
||||
</metadata></audioClip>"
|
||||
#echo "# store: gunid=$GUNID mediafile=$MEDIA metadata=$METADATA"
|
||||
echo "# store: "
|
||||
MD5=`md5sum $MEDIA`; for i in $MD5; do MD5=$i; break; done
|
||||
RES=`$XR_CLI storeAudioClipOpen "$SESSID" "$GUNID" "$METADATA" "stored_file.mp3" "$MD5"` || \
|
||||
{ ERN=$?; echo $RES; exit $ERN; }
|
||||
unset URL
|
||||
for i in $RES; do if [ -z $URL ] ; then URL=$i; else TOKEN=$i; fi; done
|
||||
echo " URL = $URL"
|
||||
echo " TOKEN = $TOKEN"
|
||||
echo -n "# curl (PUT): "
|
||||
curl -C 0 -T $MEDIA $URL || exit $?
|
||||
echo "status: $?"
|
||||
echo -n "# storeAudioClipClose: "
|
||||
GUNID=`$XR_CLI storeAudioClipClose "$SESSID" "$TOKEN"` || \
|
||||
{ ERN=$?; echo $GUNID; exit $ERN; }
|
||||
echo $GUNID
|
||||
}
|
||||
|
||||
deleteAudioClip() {
|
||||
GUNID=$1 ; shift
|
||||
echo -n "# deleteAudioClip: "
|
||||
$XR_CLI deleteAudioClip $SESSID $GUNID 1
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# transport related functions
|
||||
#-------------------------------------------------------------------------------
|
||||
getTransportInfo() {
|
||||
TRTOK=$1 ; shift
|
||||
echo "# getTransportInfo:"
|
||||
$XR_CLI getTransportInfo $TRTOK
|
||||
echo "# status: $?"
|
||||
}
|
||||
|
||||
upload2Hub() {
|
||||
GUNID=$1 ; shift
|
||||
echo -n "# upload2Hub: ($GUNID)"
|
||||
TRTOK=`$XR_CLI upload2Hub $SESSID $GUNID` || \
|
||||
{ ERN=$?; echo $TRTOK; exit $ERN; }
|
||||
echo $TRTOK
|
||||
}
|
||||
|
||||
downloadFromHub() {
|
||||
GUNID=$1 ; shift
|
||||
echo -n "# downloadFromHub: ($GUNID)"
|
||||
TRTOK=`$XR_CLI downloadFromHub $SESSID $GUNID` || \
|
||||
{ ERN=$?; echo $TRTOK; exit $ERN; }
|
||||
echo $TRTOK
|
||||
}
|
||||
|
||||
uploadFile2Hub() {
|
||||
FILE=$1 ; shift
|
||||
echo -n "# uploadFile2Hub: "
|
||||
TRTOK=`$XR_CLI uploadFile2Hub $SESSID $FILE` || \
|
||||
{ ERN=$?; echo $TRTOK; exit $ERN; }
|
||||
echo $TRTOK
|
||||
}
|
||||
|
||||
getHubInitiatedTransfers() {
|
||||
echo -n "# getHubInitiatedTransfers: "
|
||||
TRTOK=`$XR_CLI getHubInitiatedTransfers $SESSID` || \
|
||||
{ ERN=$?; echo $TRTOK; exit $ERN; }
|
||||
echo $TRTOK
|
||||
}
|
||||
|
||||
startHubInitiatedTransfer() {
|
||||
TRTOK=$1 ; shift
|
||||
echo -n "# startHubInitiatedTransfer: "
|
||||
RES=`$XR_CLI startHubInitiatedTransfer $TRTOK` || \
|
||||
{ ERN=$?; echo $TRTOK; exit $ERN; }
|
||||
echo $RES
|
||||
}
|
||||
|
||||
transportCron() {
|
||||
echo -n "# transportCron: "
|
||||
../cron/transportCron.php
|
||||
echo $?
|
||||
}
|
||||
|
||||
logout() {
|
||||
echo -n "# logout: "
|
||||
$XR_CLI logout $SESSID || exit $?
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# playlist related functions
|
||||
#-------------------------------------------------------------------------------
|
||||
PLID="123456789abcdef8"
|
||||
|
||||
createPlaylistAndEdit() {
|
||||
PLID=$1 ; shift
|
||||
echo -n "# createPlaylist: "
|
||||
$XR_CLI createPlaylist $SESSID $PLID "newPlaylist.xml" || exit $?
|
||||
DATE=`date '+%H:%M:%S'`
|
||||
[[ "x$1" != "x" ]] && PLAYLIST=`cat "$1"` || PLAYLIST="<?xml
|
||||
version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<playlist id=\"123456789abcdea1\"><metadata>
|
||||
<dc:title>XY $DATE</dc:title>
|
||||
<dcterms:extent>00:00:01.000000</dcterms:extent>
|
||||
</metadata>
|
||||
<playlistElement id=\"123456789abcdef1\" relativeOffset=\"0\">
|
||||
<audioClip id=\"123456789abcdefa\"/>
|
||||
</playlistElement>
|
||||
<playlistElement id=\"123456789abcdef2\" relativeOffset=\"12\">
|
||||
<audioClip id=\"123456789abcdefb\"/>
|
||||
</playlistElement>
|
||||
</playlist>"
|
||||
echo -n "# editPlaylist: "
|
||||
RES=`$XR_CLI editPlaylist $SESSID $PLID` || \
|
||||
{ ERN=$?; echo $RES; exit $ERN; }
|
||||
unset URL
|
||||
for i in $RES; do if [ -z $URL ] ; then URL=$i; else TOKEN=$i; fi; done
|
||||
echo $TOKEN
|
||||
# deletePlaylist
|
||||
if [ $DEBUG_I ]; then echo $URL; fi
|
||||
if [ $DEBUG_I ]; then echo -n "Press enter ..."; read KEY; fi
|
||||
if [ $DEBUG_I ]; then echo " Playlist:"; echo $PLAYLIST; fi
|
||||
echo -n "# savePlaylist: "
|
||||
$XR_CLI savePlaylist $SESSID $TOKEN "$PLAYLIST" || exit $?
|
||||
}
|
||||
|
||||
deletePlaylist() {
|
||||
PLID=$1 ; shift
|
||||
echo -n "# deletePlaylist (${PLID}): "
|
||||
$XR_CLI deletePlaylist $SESSID $PLID 1
|
||||
# || exit $?
|
||||
echo "# status: $?"
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# executable part
|
||||
#-------------------------------------------------------------------------------
|
||||
GUNID_="a23456789abcdef3"
|
||||
PLID_=$GUNID_
|
||||
MEDIA_="../tests/ex1.mp3"
|
||||
|
||||
login
|
||||
for i in 0000000000010001 0000000000010002; do echo $i
|
||||
storeOpenClose $i "../tests/$i" "../tests/$i.xml"
|
||||
done
|
||||
|
||||
deletePlaylist $PLID_
|
||||
deletePlaylist $PLID_
|
||||
createPlaylistAndEdit $PLID_ "../tests/0000000000000001.xml"
|
||||
|
||||
upload2Hub $PLID_
|
||||
for i in $(seq 5); do getTransportInfo $TRTOK; sleep 1; done
|
||||
|
||||
#sleep 10
|
||||
for i in 0000000000010001 0000000000010002; do echo $i
|
||||
deleteAudioClip $i
|
||||
done
|
||||
deletePlaylist $PLID_
|
||||
|
||||
echo "STOP - press ENTER"; read key
|
||||
|
||||
downloadFromHub $PLID_
|
||||
for i in $(seq 5); do getTransportInfo $TRTOK; sleep 1; done
|
||||
|
||||
logout
|
||||
|
||||
echo "#Transport test: OK"
|
||||
exit 0
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
/*
|
||||
header("Content-type: text/plain");
|
||||
echo "\n#StorageServer storeWebstream test:\n";
|
||||
|
||||
|
@ -57,4 +58,5 @@ if (PEAR::isError($r)) {
|
|||
echo "$r\n";
|
||||
|
||||
echo "#storeWebstream test: OK.\n\n"
|
||||
*/
|
||||
?>
|
Loading…
Reference in New Issue