diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-08-06 07:23:42 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-08-06 07:23:42 +0000 |
commit | 0949ff48904b06438fc4215854d7fa3ba884474e (patch) | |
tree | 1ada94218223d74853d17023a919eddf16fac23c /lib/class/album.class.php | |
parent | 0b4194ebf11e2ce8b59563c57a4eeca8c80a70e8 (diff) | |
download | ampache-0949ff48904b06438fc4215854d7fa3ba884474e.tar.gz ampache-0949ff48904b06438fc4215854d7fa3ba884474e.tar.bz2 ampache-0949ff48904b06438fc4215854d7fa3ba884474e.zip |
fixed find missing tracks, tweaked openstrands class again to account for lack of [[CCDATA tag on some xml responses
Diffstat (limited to 'lib/class/album.class.php')
-rw-r--r-- | lib/class/album.class.php | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/lib/class/album.class.php b/lib/class/album.class.php index b72633e3..b47e6b03 100644 --- a/lib/class/album.class.php +++ b/lib/class/album.class.php @@ -29,6 +29,7 @@ class Album { /* Variables from DB */ public $id; public $name; + public $full_name; // Prefix + Name, genereated by format(); public $year; public $prefix; @@ -48,7 +49,7 @@ class Album { * pull the album or thumb art by default or * get any of the counts. */ - function __construct($album_id = 0) { + public function __construct($album_id='') { if (!$album_id) { return false; } @@ -64,13 +65,32 @@ class Album { } // Little bit of formating here - $this->f_name = trim($info['prefix'] . ' ' . $info['name']); + $this->full_name = trim($info['prefix'] . ' ' . $info['name']); return true; } //constructor /** + * construct_from_array + * This is often used by the metadata class, it fills out an album object from a + * named array, _fake is set to true + */ + public static function construct_from_array($data) { + + $album = new Album(0); + foreach ($data as $key=>$value) { + $album->$key = $value; + } + + // Make sure that we tell em it's fake + $album->_fake = true; + + return $album; + + } // construct_from_array + + /** * _get_info * This is a private function that pulls the album * from the database @@ -157,6 +177,23 @@ class Album { } // has_art /** + * has_track + * This checks to see if this album has a track of the specified title + */ + public function has_track($title) { + + $title = Dba::escape($title); + + $sql = "SELECT `id` FROM `song` WHERE `album`='$this->id' AND `title`='$title'"; + $db_results = Dba::query($sql); + + $data = Dba::fetch_assoc($db_results); + + return $data; + + } // has_track + + /** * format * This is the format function for this object. It sets cleaned up * albumĀ information with the base required |