Fixed some API stuff to return the right values for pypo.

Created a test script to schedule a test file one minute after running it.
Moved the database connection initialization to conf.php instead of in
ui_conf.php.
Changed some includes to rely on the pear path instead of specifying it
directly in the include.  This will make it easier to use the system
defaults (for Ubuntu/Debian for example).
This commit is contained in:
paul.baranowski 2010-11-23 19:21:05 -05:00
parent ef8b8dc54d
commit 8e7e0226e6
11 changed files with 289 additions and 68 deletions

View file

@ -57,16 +57,23 @@ class Playlist {
private $categories = array("dc:title" => "DbName", "dc:creator" => "DbCreator", "dc:description" => "DbDescription", "dcterms:extent" => "length");
/**
* @param string $p_gunid
*/
public function __construct($p_gunid=NULL)
{
}
public static function Insert($p_values)
/**
* @param array $p_name
* The name of the playlist
*/
private static function Insert($p_name = null)
{
// Create the StoredPlaylist object
$storedPlaylist = new Playlist();
$storedPlaylist->name = isset($p_values['filename']) ? $p_values['filename'] : date("H:i:s");
$storedPlaylist->name = !empty($p_name) ? $p_name : date("H:i:s");
$storedPlaylist->mtime = new DateTime("now");
$pl = new CcPlaylist();
@ -325,8 +332,9 @@ class Playlist {
->findPK($this->id)
->computeLastPosition();
if(is_null($res))
return 0;
if(is_null($res)) {
return 0;
}
return $res + 1;
}
@ -355,8 +363,9 @@ class Playlist {
->findPK($this->id)
->computeLength();
if(is_null($res))
return '00:00:00.000000';
if(is_null($res)) {
return '00:00:00.000000';
}
return $res;
}
@ -370,12 +379,19 @@ class Playlist {
*/
public function create($fname=NULL)
{
$values = array("filename" => $fname);
$pl_id = Playlist::Insert($values);
$pl_id = Playlist::Insert($fname);
$this->id = $pl_id;
return $this->id;
}
public static function findPlaylistByName($p_name)
{
$res = CcPlaylistQuery::create()->findByDbName($p_name);
return $res;
}
/**
* Lock playlist for edit
*