mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-04 18:29:40 +02:00
When updating an remote catalog it will try to grab the images from the remote machine to the local database.
This commit is contained in:
parent
efa0fda4ff
commit
e415574302
3 changed files with 162 additions and 25 deletions
|
@ -68,6 +68,8 @@ class xmlRpcServer {
|
|||
return new XML_RPC_Response($encoded_array);
|
||||
} // get_catalogs
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* get_songs
|
||||
* This is a basic function to return all of the song data in a serialized format. It takes a start and end point
|
||||
|
@ -80,15 +82,15 @@ class xmlRpcServer {
|
|||
set_time_limit(0);
|
||||
|
||||
|
||||
// Pull out the key
|
||||
$variable = $xmlrpc_object->getParam(0);
|
||||
$key = $variable->scalarval();
|
||||
// Pull out the key
|
||||
$variable = $xmlrpc_object->getParam(0);
|
||||
$key = $variable->scalarval();
|
||||
|
||||
// Check it and make sure we're super green
|
||||
if (!vauth::session_exists('xml-rpc',$key)) {
|
||||
debug_event('XMLSERVER','Error ' . $_SERVER['REMOTE_ADDR'] . ' with key ' . $key . ' does not match any ACLs','1');
|
||||
return new XML_RPC_Response(0,'503','Key/IP Mis-match Access Denied');
|
||||
}
|
||||
// Check it and make sure we're super green
|
||||
if (!vauth::session_exists('xml-rpc',$key)) {
|
||||
debug_event('XMLSERVER','Error ' . $_SERVER['REMOTE_ADDR'] . ' with key ' . $key . ' does not match any ACLs','1');
|
||||
return new XML_RPC_Response(0,'503','Key/IP Mis-match Access Denied');
|
||||
}
|
||||
|
||||
// Now pull out the start and end
|
||||
$start = intval($xmlrpc_object->params['1']->me['int']);
|
||||
|
@ -125,21 +127,61 @@ class xmlRpcServer {
|
|||
|
||||
} // get_songs
|
||||
|
||||
/**
|
||||
* get_album_images
|
||||
* Returns the images information of the albums
|
||||
*/
|
||||
public static function get_album_images($xmlrpc_object) {
|
||||
// We're going to be here a while
|
||||
set_time_limit(0);
|
||||
|
||||
// Pull out the key
|
||||
$variable = $xmlrpc_object->getParam(0);
|
||||
$key = $variable->scalarval();
|
||||
|
||||
// Check it and make sure we're super green
|
||||
if (!vauth::session_exists('xml-rpc',$key)) {
|
||||
debug_event('XMLSERVER','Error ' . $_SERVER['REMOTE_ADDR'] . ' with key ' . $key . ' does not match any ACLs','1');
|
||||
return new XML_RPC_Response(0,'503','Key/IP Mis-match Access Denied');
|
||||
}
|
||||
|
||||
// Get Albums first
|
||||
$sql = "SELECT `album`.`id` FROM `album` ";
|
||||
$db_results = Dba::query($sql);
|
||||
|
||||
while ($row = Dba::fetch_assoc($db_results)) {
|
||||
// Load the current album
|
||||
$album = new Album($row['id']);
|
||||
$art = $album->get_db_art();
|
||||
|
||||
// Only return album ids with art
|
||||
if (count($art) != 0) {
|
||||
$output = serialize($album);
|
||||
$results[] = $output;
|
||||
}
|
||||
}
|
||||
|
||||
$encoded_array = XML_RPC_encode($results);
|
||||
debug_event('XMLSERVER','Encoded ' . count($results) . 'albums with art','5');
|
||||
|
||||
return new XML_RPC_Response($encoded_array);
|
||||
}
|
||||
|
||||
/**
|
||||
* create_stream_session
|
||||
* This creates a new stream session and returns the SID in question, this requires a TOKEN as generated by the handshake
|
||||
*/
|
||||
public static function create_stream_session($xmlrpc_object) {
|
||||
|
||||
// Pull out the key
|
||||
$variable = $xmlrpc_object->getParam(0);
|
||||
$key = $variable->scalarval();
|
||||
// Pull out the key
|
||||
$variable = $xmlrpc_object->getParam(0);
|
||||
$key = $variable->scalarval();
|
||||
|
||||
// Check it and make sure we're super green
|
||||
if (!vauth::session_exists('xml-rpc',$key)) {
|
||||
debug_event('XMLSERVER','Error ' . $_SERVER['REMOTE_ADDR'] . ' with key ' . $key . ' does not match any ACLs','1');
|
||||
return new XML_RPC_Response(0,'503','Key/IP Mis-match Access Denied');
|
||||
}
|
||||
// Check it and make sure we're super green
|
||||
if (!vauth::session_exists('xml-rpc',$key)) {
|
||||
debug_event('XMLSERVER','Error ' . $_SERVER['REMOTE_ADDR'] . ' with key ' . $key . ' does not match any ACLs','1');
|
||||
return new XML_RPC_Response(0,'503','Key/IP Mis-match Access Denied');
|
||||
}
|
||||
|
||||
if (!Stream::insert_session($key,'-1')) {
|
||||
debug_event('XMLSERVER','Failed to create stream session','1');
|
||||
|
@ -155,12 +197,7 @@ class xmlRpcServer {
|
|||
* used in all further communication
|
||||
*/
|
||||
public static function handshake($xmlrpc_object) {
|
||||
/*
|
||||
ob_start();
|
||||
print_r ($xmlrpc_object);
|
||||
$got = ob_get_clean();
|
||||
debug_event('XMLSERVER','handshake: ' . $got,'1');
|
||||
*/
|
||||
debug_event('XMLSERVER','handshake: ' . print_r ($xmlrpc_object, true),'5');
|
||||
|
||||
// Pull out the params
|
||||
$encoded_key = $xmlrpc_object->params['0']->me['string'];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue