diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2009-04-08 02:40:07 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2009-04-08 02:40:07 +0000 |
commit | f804835929eeb09374dcb4fd41a57f56b7cecbb0 (patch) | |
tree | 96470e994c9c31d758da4e3463a146db0318f03c | |
parent | 3a1597d0748ddcca33b663525e07506b728b47ec (diff) | |
download | ampache-f804835929eeb09374dcb4fd41a57f56b7cecbb0.tar.gz ampache-f804835929eeb09374dcb4fd41a57f56b7cecbb0.tar.bz2 ampache-f804835929eeb09374dcb4fd41a57f56b7cecbb0.zip |
some tweaks to make the random play mojo work for streaming, does not work in localplay yet, working on that, nor in democratic play poking that also include asx playlist improvements from jon611
-rwxr-xr-x | docs/CHANGELOG | 2 | ||||
-rw-r--r-- | lib/class/random.class.php | 63 | ||||
-rw-r--r-- | lib/class/stream.class.php | 8 | ||||
-rw-r--r-- | server/ajax.server.php | 4 | ||||
-rw-r--r-- | templates/rightbar.inc.php | 3 |
5 files changed, 71 insertions, 9 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 700eedf9..5a477a62 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,8 @@ -------------------------------------------------------------------------- v.3.5-Beta2 + - Fix ASX playlists so more data shows up in WMP (Thx Jon611) + - Fix dynamic playlist items so they work in stream methods again - Fixed Recently played so that it correctly shows unique songs with the correct data - Fix some issues with filenames with Multi-byte characters diff --git a/lib/class/random.class.php b/lib/class/random.class.php index 0863a60a..912aac95 100644 --- a/lib/class/random.class.php +++ b/lib/class/random.class.php @@ -28,13 +28,18 @@ */ class Random implements media { + public $type; + public $id; + + /** * Constructor * nothing to see here, move along */ - public function __construct() { + public function __construct($id) { - // Rien a faire + $this->type = Random::get_id_type($id); + $this->id = intval($id); } // constructor @@ -91,9 +96,9 @@ class Random implements media { * This generates a random play url based on the passed type * and returns it */ - public static function play_url($type,$sid='',$force_http='') { + public static function play_url($id,$sid='',$force_http='') { - if (!$type = self::validate_type($type)) { + if (!$type = self::get_id_type($id)) { return false; } @@ -420,6 +425,56 @@ class Random implements media { } // get_type_name /** + * get_type_id + * This takes random type and returns the ID + * MOTHER OF PEARL THIS MAKES BABY JESUS CRY + * HACK HACK HACK HACK HACK HACK HACK HACK + */ + public static function get_type_id($type) { + + switch ($type) { + case 'album': + return '1'; + break; + case 'artist': + return '2'; + break; + case 'tag': + return '3'; + break; + default: + return '4'; + break; + } + + } // get_type_id + + /** + * get_id_name + * This takes an ID and returns the 'name' of the random dealie + * HACK HACK HACK HACK HACK HACK HACK + * Can you tell I don't like this code? + */ + public static function get_id_type($id) { + + switch ($id) { + case '1': + return 'album'; + break; + case '2': + return 'artist'; + break; + case '3': + return 'tag'; + break; + default: + return 'default'; + break; + } // end switch + + } // get_id_name + + /** * validiate_type * this validates the random type */ diff --git a/lib/class/stream.class.php b/lib/class/stream.class.php index edffeb11..022e1e55 100644 --- a/lib/class/stream.class.php +++ b/lib/class/stream.class.php @@ -376,7 +376,13 @@ class Stream { echo "<ENTRY>\n"; echo "<TITLE>$name</TITLE>\n"; - echo "<AUTHOR>$author</AUTHOR>\n"; + echo "<AUTHOR>$author</AUTHOR>\n"; + echo "\t\t<COPYRIGHT>".$media->year."</COPYRIGHT>\n"; + echo "\t\t<DURATION VALUE=\"00:00:".$media->time."\" />\n"; + echo "\t\t<PARAM NAME=\"Album\" Value=\"".$media->f_album_full."\" />\n"; + echo "\t\t<PARAM NAME=\"Genre\" Value=\"".$media->get_genre_name()."\" />\n"; + echo "\t\t<PARAM NAME=\"Composer\" Value=\"".$media->f_artist_full."\" />\n"; + echo "\t\t<PARAM NAME=\"Prebuffer\" Value=\"false\" />\n"; echo "<REF HREF = \"". $url . "\" />\n"; echo "</ENTRY>\n"; diff --git a/server/ajax.server.php b/server/ajax.server.php index 801ed330..d92f7c80 100644 --- a/server/ajax.server.php +++ b/server/ajax.server.php @@ -283,8 +283,8 @@ switch ($_REQUEST['action']) { } break; case 'dynamic': - $random_type = Random::validate_type($_REQUEST['random_type']); - $GLOBALS['user']->playlist->add_object('0',$random_type); + $random_id = Random::get_type_id($_REQUEST['random_type']); + $GLOBALS['user']->playlist->add_object($random_id,'random'); break; case 'video': $GLOBALS['user']->playlist->add_object($_REQUEST['id'],'video'); diff --git a/templates/rightbar.inc.php b/templates/rightbar.inc.php index 95af30a0..c64d54c3 100644 --- a/templates/rightbar.inc.php +++ b/templates/rightbar.inc.php @@ -96,8 +96,7 @@ $object = new $type(array_shift($object_data)); $object->format(); } - elseif ($type == Random::validate_type($type)) { - $object = new Random(); + if ($type == 'random') { $object->f_link = Random::get_type_name($type); } ?> |