diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2009-03-01 00:10:49 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2009-03-01 00:10:49 +0000 |
commit | 6777ec1e2ec97ab6986bf6657ed64283e0ad461c (patch) | |
tree | 7a6e024cf08f55c9126c22303b057525b4f96ec2 /lib/class | |
parent | a3ff87240e1f1ad271ec611ed296fd978e22e702 (diff) | |
download | ampache-6777ec1e2ec97ab6986bf6657ed64283e0ad461c.tar.gz ampache-6777ec1e2ec97ab6986bf6657ed64283e0ad461c.tar.bz2 ampache-6777ec1e2ec97ab6986bf6657ed64283e0ad461c.zip |
first work on next db update, correct play_url() removing redundent path, fix democratic play clear
Diffstat (limited to 'lib/class')
-rw-r--r-- | lib/class/democratic.class.php | 9 | ||||
-rw-r--r-- | lib/class/song.class.php | 2 | ||||
-rw-r--r-- | lib/class/stream.class.php | 14 | ||||
-rw-r--r-- | lib/class/update.class.php | 61 | ||||
-rw-r--r-- | lib/class/xmldata.class.php | 4 |
5 files changed, 75 insertions, 15 deletions
diff --git a/lib/class/democratic.class.php b/lib/class/democratic.class.php index 9e72251a..3088effa 100644 --- a/lib/class/democratic.class.php +++ b/lib/class/democratic.class.php @@ -336,9 +336,9 @@ class Democratic extends tmpPlaylist { public function vote($items) { /* Itterate through the objects if no vote, add to playlist and vote */ - foreach ($items as $type=>$object_id) { - //FIXME: This is a hack until we fix everything else - if (intval($type) == $type) { $type = 'song'; } + foreach ($items as $element) { + $type = array_shift($element); + $object_id = array_shift($element); if (!$this->has_vote($object_id,$type)) { $this->add_vote($object_id,$type); } @@ -541,8 +541,7 @@ class Democratic extends tmpPlaylist { self::prune_tracks(); // Clean the votes - self::clean_votes(); - + self::clear_votes(); return true; diff --git a/lib/class/song.class.php b/lib/class/song.class.php index 3e1a124c..519abda1 100644 --- a/lib/class/song.class.php +++ b/lib/class/song.class.php @@ -867,7 +867,7 @@ class Song extends database_object implements media { $song_name = rawurlencode($song->f_artist_full . " - " . $song->title . "." . $type); - $url = Stream::get_base_url() . "/play/index.php?oid=$song_id&uid=$user_id$session_string$ds_string&name=/$song_name"; + $url = Stream::get_base_url() . "oid=$song_id&uid=$user_id$session_string$ds_string&name=/$song_name"; return $url; diff --git a/lib/class/stream.class.php b/lib/class/stream.class.php index ec8308e5..9bfb4d78 100644 --- a/lib/class/stream.class.php +++ b/lib/class/stream.class.php @@ -236,7 +236,7 @@ class Stream { public function create_simple_m3u() { header("Cache-control: public"); - header("Content-Disposition: filename=playlist.m3u"); + header("Content-Disposition: filename=ampache_playlist.m3u"); header("Content-Type: audio/x-mpegurl;"); // Flip for the poping! @@ -434,7 +434,7 @@ class Stream { } // type $xml = array(); - $xml['track']['location'] = call_user_func($type,'play_url',$media->id) . $flash_hack; + $xml['track']['location'] = call_user_func(array($type,'play_url'),$media->id) . $flash_hack; $xml['track']['identifier'] = $xml['track']['location']; $xml['track']['duration'] = $length * 1000; @@ -445,7 +445,7 @@ class Stream { xmlData::set_type('xspf'); header("Cache-control: public"); - header("Content-Disposition: filename=ampache-playlist.xspf"); + header("Content-Disposition: filename=ampache_playlist.xspf"); header("Content-Type: application/xspf+xml; charset=utf-8"); echo xmlData::header(); echo $result; @@ -569,11 +569,11 @@ class Stream { public function create_ram() { header("Cache-control: public"); - header("Content-Disposition: filename=playlist.ram"); + header("Content-Disposition: filename=ampache_playlist.ram"); header("Content-Type: audio/x-pn-realaudio ram;"); - foreach ($this->media as $song_id) { - $song = new Song($song_id); - echo $song->get_url(); + foreach ($this->media as $element) { + $type = array_shift($element); + echo $url = call_user_func(array($type,'play_url'),array_shift($element)) . "\n"; } // foreach songs } // create_ram diff --git a/lib/class/update.class.php b/lib/class/update.class.php index 156a972c..7778c673 100644 --- a/lib/class/update.class.php +++ b/lib/class/update.class.php @@ -1606,10 +1606,71 @@ class Update { $sql = "INSERT INTO `user_preference` VALUES (1,69,'0')"; $db_results = Dba::write($sql); + $sql = "SELECT `id` FROM `user`"; + $db_results = Dba::query($sql); + + User::fix_preferences('-1'); + + while ($r = Dba::fetch_assoc($db_results)) { + User::fix_preferences($r['id']); + } // while we're fixing the useres stuff + self::set_version('db_version','350006'); return true; + } // update_350006 + /** + * update_350007 + * This update adds in the random rules tables, and also increases the size of the blobs + * on the album and artist data. Also add track to tmp_playlist_data + */ + public static function update_350007() { + + // We need to clear the thumbs as they will need to be re-generated + $sql = "UPDATE `album_data` SET `thumb`=NULL"; + $db_results = Dba::write($sql); + + $sql = "UPDATE `artist_data` SET `thumb`=NULL"; + $db_results = Dba::write($sql); + + // Change the db thumb sizes + $sql = "ALTER TABLE `album_data` CHANGE `thumb` `thumb` MEDIUMBLOB NULL"; + $db_results = Dba::write($sql); + + $sql = "ALTER TABLE `artist_data` CHANGE `thumb` `thumb` MEDIUMBLOB NULL"; + $db_results = Dba::write($sql); + + // Remove dead column + $sql = "ALTER TABLE `playlist_data` DROP `dynamic_song`"; + $db_results = Dba::write($sql); + + $sql = "ALTER TABLE `playlist` DROP `genre`"; + $db_results = Dba::write($sql); + + // Add track item to tmp_playlist_data so we can order this stuff manually + $sql = "ALTER TABLE `tmp_playlist_data` ADD `track` INT ( 11 ) UNSIGNED NULL"; + $db_results = Dba::write($sql); + + $sql = "DROP TABLE `genre`"; + $db_results = Dba::write($sql); + + // Clean up the catalog and add last_clean to it + $sql = "ALTER TABLE `catalog` ADD `last_clean` INT ( 11 ) UNSIGNED NULL AFTER `last_update`"; + $db_results = Dba::write($sql); + + $sql = "ALTER TABLE `catalog` DROP `add_path`"; + $db_results = Dba::write($sql); + + + + self::set_version('db_version','350007'); + + return true; + + } // update_350007 + + } // end update class ?> diff --git a/lib/class/xmldata.class.php b/lib/class/xmldata.class.php index 894ab541..2fb18f19 100644 --- a/lib/class/xmldata.class.php +++ b/lib/class/xmldata.class.php @@ -345,7 +345,7 @@ class xmlData { switch (self::$type) { case 'xspf': $header = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" . - "<!-- XML Generated by Ampache v." . Config::get('version') . " -->"; + "<!-- XML Generated by Ampache v." . Config::get('version') . " -->\n"; "<playlist version = \"1\" xmlns=\"http://xspf.org/ns/0/\">\n ". "<title>Ampache XSPF Playlist</title>\n" . "<creator>" . Config::get('site_title') . "</creator>\n" . @@ -355,7 +355,7 @@ class xmlData { break; case 'itunes': $header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" . - "<!-- XML Generated by Ampache v." . Config::get('version') . " -->"; + "<!-- XML Generated by Ampache v." . Config::get('version') . " -->\n"; "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"\n" . "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" . "<plist version=\"1.0\">\n" . |