1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-05 19:41:55 +02:00

fixed opera playback, added playlist mojo to the xml api doodly, konqueror is still broken as is the API and XML-RPC stuff, also updated prototype.js

This commit is contained in:
Karl 'vollmerk' Vollmer 2007-12-22 05:14:14 +00:00
parent 7cbf829be1
commit be699cab75
6 changed files with 1972 additions and 1027 deletions

View file

@ -4,6 +4,10 @@
-------------------------------------------------------------------------- --------------------------------------------------------------------------
v.3.4-Alpha4 v.3.4-Alpha4
- Upgraded to Prototype 1.6
- Added playlists and playlist_songs methods to API
- Fixed a problem with the javascript that was causing Opera to not
get the playlist correctly.
- Migrated to 'new' auth system that unifies xml-rpc,api and normal - Migrated to 'new' auth system that unifies xml-rpc,api and normal
sessions in a single table sessions in a single table
- Fixed some issues with downsampling + seeking and seeking in - Fixed some issues with downsampling + seeking and seeking in

View file

@ -206,6 +206,41 @@ class xmlData {
} // genres } // genres
/**
* playlists
* This takes an array of playlist ids and then returns a nice pretty XML document
*/
public static function playlists($playlists) {
if (count($playlists) > self::$limit) {
$playlists = array_slice($playlists,self::$offset,self::$limit);
}
$string = '';
// Foreach the playlist ids
foreach ($playlists as $playlist_id) {
$playlist = new Playlist($playlist_id);
$playlist->format();
$item_total = $playlist->get_song_count();
// Build this element
$string .= "<playlist id=\"$playlist->id\">\n" .
"\t<name><![CDATA[$playlist->name]]></name>\n" .
"\t<owner><![CDATA[$playlist->f_user]]</owner>\n" .
"\t<items>$item_total</items>\n" .
"</playlist>\n";
} // end foreach
// Build the final and then send her off
$final = self::_header() . $string . self::_footer();
return $final;
} // playlists
/** /**
* songs * songs
* This returns an xml document from an array of song ids spiffy isn't it! * This returns an xml document from an array of song ids spiffy isn't it!

View file

@ -44,42 +44,6 @@ function selectField(element)
element_id.focus(); element_id.focus();
} }
var checkflag = "false";
function check_select(type,name) {
if ( name == undefined){
var name = '';
}
if ( checkflag == "false") {
if ( eval("document.forms."+ type +"s"+ name +".elements[\""+ type +"[]\"].length") == undefined) {
var zz = eval("document.forms."+ type +"s"+ name +".elements[\""+ type +"[]\"]");
zz.checked = true;
}
else {
for (i = 0; i < eval("document.forms."+ type +"s"+ name +".elements[\""+ type +"[]\"].length"); i++) {
var zz = eval("document.forms."+ type +"s"+ name +".elements[\""+ type +"[]\"][i]");
zz.checked = true;
}
}
checkflag = "true";
return "Unselect All";
}
else {
if ( eval("document.forms."+ type +"s"+ name +".elements[\""+ type +"[]\"].length") == undefined) {
var zz = eval("document.forms."+ type +"s"+ name +".elements[\""+ type +"[]\"]");
zz.checked = false;
}
else {
for (i = 0; i < eval("document.forms."+ type +"s"+ name +".elements[\""+ type +"[]\"].length"); i++) {
var zz = eval("document.forms."+ type +"s"+ name +".elements[\""+ type +"[]\"][i]");
zz.checked = false;
}
}
checkflag = "false";
return "Select All";
}
}
// function for the catalog mojo fluf // function for the catalog mojo fluf
function update_txt(value,field) { function update_txt(value,field) {
document.getElementById(field).innerHTML=value; document.getElementById(field).innerHTML=value;
@ -89,7 +53,17 @@ function update_txt(value,field) {
// IE issue fixed by Spocky, we have to use the iframe for Democratic Play & Localplay // IE issue fixed by Spocky, we have to use the iframe for Democratic Play & Localplay
// which don't actually prompt for a new file // which don't actually prompt for a new file
function reload_util(target) { function reload_util(target) {
document.getElementById('util_iframe').src = document.getElementById('util_iframe').src;
if (navigator.appName == 'Opera') {
document.getElementById('util_iframe').contentWindow.location.reload(true);
}
else if (navigator.appName == 'Konqueror') {
alert(document.getElementById('util_iframe').location.url);
document.getElementById('util_iframe').location.url = document.getElementById('util_iframe').location.url
}
else {
document.getElementById('util_iframe').src = document.getElementById('util_iframe').src;
}
} }
// Log them out // Log them out

File diff suppressed because it is too large Load diff

View file

@ -178,6 +178,35 @@ switch ($_REQUEST['action']) {
ob_end_clean(); ob_end_clean();
echo xmlData::songs($songs); echo xmlData::songs($songs);
break; break;
case 'playlists':
Browse::reset_filters();
Browse::set_type('playlist');
Browse::set_sort('name','ASC');
if ($_REQUEST['filter']) {
Browse::set_filter('alpha_match',$_REQUEST['filter']);
}
$playlist_ids = Browse::get_objects();
xmlData::set_offset($_REQUEST['offset']);
ob_end_clean();
echo xmlData::playlists($playlist_ids);
break;
case 'playlist_songs':
$playlist = new Playlist($_REQUEST['filter']);
$items = $playlist->get_items();
foreach ($items as $object) {
if ($object['type'] == 'song') {
$songs[] = $object['object_id'];
}
} // end foreach
xmlData::set_offset($_REQUEST['offset']);
ob_end_clean();
echo xmlData::songs($songs);
break;
default: default:
ob_end_clean(); ob_end_clean();
echo xmlData::error('Invalid Request'); echo xmlData::error('Invalid Request');

View file

@ -20,6 +20,11 @@
*/ */
require_once 'lib/init.php'; require_once 'lib/init.php';
header("Expires: Tuesday, 27 Mar 1984 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: no-cache");
// This is a little bit of a special file, it takes the // This is a little bit of a special file, it takes the
// content of $_SESSION['iframe']['target'] and does a header // content of $_SESSION['iframe']['target'] and does a header
// redirect to that spot! // redirect to that spot!