summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-09-30 04:15:11 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-09-30 04:15:11 +0000
commitedcf34c986d14fb6583eb29958bf88140cd97b5b (patch)
treedde8c48e1ca303426a87459057913fc030b66869 /lib
parent6b7284fab7f49f54f4d72db6c690bbea7f7b7af7 (diff)
downloadampache-edcf34c986d14fb6583eb29958bf88140cd97b5b.tar.gz
ampache-edcf34c986d14fb6583eb29958bf88140cd97b5b.tar.bz2
ampache-edcf34c986d14fb6583eb29958bf88140cd97b5b.zip
fixed up xmlrpc hopefully (needs testing) and fixed duplicates, cleaned up burgundy a little more
Diffstat (limited to 'lib')
-rw-r--r--lib/class/catalog.class.php18
-rw-r--r--lib/duplicates.php99
2 files changed, 43 insertions, 74 deletions
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php
index 55d45717..56afe800 100644
--- a/lib/class/catalog.class.php
+++ b/lib/class/catalog.class.php
@@ -1032,7 +1032,11 @@ class Catalog {
$client = new xmlrpc_client("/$path/server/xmlrpc.server.php", $server, 80);
}
- $f = new xmlrpcmsg('remote_catalog_query', array(new xmlrpcval( conf('web_path'), "string")) );
+ /* encode the variables we need to send over */
+ $encoded_key = new xmlrpcval($this->key,"string");
+ $encoded_path = new xmlrpcval(conf('web_path'),"string");
+
+ $f = new xmlrpcmsg('remote_catalog_query', array($encoded_key,$encoded_path));
if (conf('debug')) { $client->setDebug(1); }
@@ -1070,7 +1074,7 @@ class Catalog {
$this->get_remote_song($client,$start,$step);
}
- echo "<p>" . _("Completed updating remote catalog(s)") . ".</p><hr />\n";
+ echo "<p>" . _('Completed updating remote catalog(s)') . ".</p><hr />\n";
flush();
return true;
@@ -1087,7 +1091,11 @@ class Catalog {
*/
function get_remote_song($client,$start,$end) {
- $query_array = array(new xmlrpcval($start, "int"),new xmlrpcval($end,"int"));
+ $encoded_start = new xmlrpcval($start,"int");
+ $encoded_end = new xmlrpcval($end,"int");
+ $encoded_key = new xmlrpcval($this->key,"string");
+
+ $query_array = array($encoded_key,$encoded_start,$encoded_end);
$f = new xmlrpcmsg('remote_song_query',$query_array);
/* Depending upon the size of the target catalog this can be a very slow/long process */
@@ -1101,11 +1109,11 @@ class Catalog {
$data = php_xmlrpc_decode($value);
$this->update_remote_catalog($data,$this->path);
$total = $start + $end;
- echo "Added $total...<br />";
+ echo _('Added') . " $total...<br />";
flush();
}
else {
- $error_msg = _("Error connecting to") . " " . $server . " " . _("Code") . ": " . $response->faultCode() . " " . _("Reason") . ": " . $response->faultString();
+ $error_msg = _('Error connecting to') . " " . $server . " " . _("Code") . ": " . $response->faultCode() . " " . _("Reason") . ": " . $response->faultString();
debug_event('xmlrpc-client',$error_msg,'1','ampache-catalog');
echo "<p class=\"error\">$error_msg</p>";
}
diff --git a/lib/duplicates.php b/lib/duplicates.php
index 3fe56ed1..71b786f0 100644
--- a/lib/duplicates.php
+++ b/lib/duplicates.php
@@ -22,19 +22,14 @@
/*!
- @header Contains the functions for handling duplicate songs
-*/
-
-
-/*!
@function get_duplicate_songs
@discussion
*/
function get_duplicate_songs($search_type) {
- $sql = "SELECT song.id as song,artist.name,album.name,title,count(title) as ctitle".
- " FROM song,artist,album ".
- " WHERE song.artist=artist.id AND song.album=album.id AND song.title<>'' ".
- " GROUP BY title";
+ $sql = "SELECT song.id as song,artist.name,album.name,title,count(title) as ctitle".
+ " FROM song,artist,album ".
+ " WHERE song.artist=artist.id AND song.album=album.id AND song.title<>'' ".
+ " GROUP BY title";
if ($search_type=="artist_title"||$search_type=="artist_album_title")
$sql = $sql.",artist";
if ($search_type=="artist_album_title")
@@ -42,14 +37,16 @@ function get_duplicate_songs($search_type) {
$sql = $sql." HAVING count(title) > 1";
$sql = $sql." ORDER BY ctitle";
- $result = mysql_query($sql, dbh());
+ $result = mysql_query($sql, dbh());
+
+ $arr = array();
- $arr = array();
+ while ($flag = mysql_fetch_array($result)) {
+ $arr[] = $flag;
+ } // end while
+
+ return $arr;
- while ($flag = mysql_fetch_array($result)) {
- $arr[] = $flag;
- } // end while
- return $arr;
} // get_duplicate_songs
/*!
@@ -57,25 +54,28 @@ function get_duplicate_songs($search_type) {
@discussion
*/
function get_duplicate_info($song,$search_type) {
- $artist = get_artist_name($song->artist);
- $sql = "SELECT song.id as songid,song.title as song,file,bitrate,size,time,album.name AS album,album.id as albumid, artist.name AS artist,artist.id as artistid".
- " FROM song,artist,album ".
- " WHERE song.artist=artist.id AND song.album=album.id ".
- " AND song.title= '".str_replace("'","''",$song->title)."'";
+ $artist = $song->get_artist_name();
+ $sql = "SELECT song.id as songid,song.title as song,file,bitrate,size,time,album.name AS album,album.id as albumid, artist.name AS artist,artist.id as artistid".
+ " FROM song,artist,album ".
+ " WHERE song.artist=artist.id AND song.album=album.id ".
+ " AND song.title= '".str_replace("'","''",$song->title)."'";
- if ($search_type=="artist_title"||$search_type=="artist_album_title")
+ if ($search_type == "artist_title" || $search_type == "artist_album_title") {
$sql = $sql." AND artist.id = '".$song->artist."'";
- if ($search_type=="artist_album_title")
+ }
+ if ($search_type == "artist_album_title" ) {
$sql = $sql." AND album.id = '".$song->album."'";
+ }
+
+ $result = mysql_query($sql, dbh());
- $result = mysql_query($sql, dbh());
+ $arr = array();
- $arr = array();
+ while ($flag = mysql_fetch_array($result)) {
+ $arr[] = $flag;
+ } // end while
- while ($flag = mysql_fetch_array($result)) {
- $arr[] = $flag;
- } // end while
- return $arr;
+ return $arr;
} // get_duplicate_info
@@ -84,7 +84,7 @@ function get_duplicate_info($song,$search_type) {
@discussion
*/
function show_duplicate_songs($flags,$search_type) {
- require_once(conf('prefix').'/templates/list_duplicates.inc');
+ require_once(conf('prefix').'/templates/show_list_duplicates.inc.php');
} // show_duplicate_songs
/*!
@@ -92,45 +92,6 @@ function show_duplicate_songs($flags,$search_type) {
@discussion
*/
function show_duplicate_searchbox($search_type) {
-// OMFG KillingVollmer++ needs to be fixed in a desperate way
-?>
-<?php show_box_top(_('Find Duplicates')); ?>
-<form name="songs" action="<?php echo conf('web_path'); ?>/admin/duplicates.php" method="post" enctype="multipart/form-data" >
-<table cellspacing="0" cellpadding="3" border="0" width="450">
- <tr>
- <td valign="top"><?php echo _('Search Type'); ?>:</td>
- <td>
- <?php
-
- if ($search_type=="title")
- $checked = "checked=\"checked\"";
- else
- $checked = "";
- echo "<input type=\"radio\" name=\"search_type\" value=\"title\" ".$checked." />" . _("Title") . "<br />";
-
- if ($search_type=="artist_title")
- $checked = "checked=\"checked\"";
- else
- $checked = "";
- echo "<input type=\"radio\" name=\"search_type\" value=\"artist_title\" ".$checked." />" . _("Artist and Title") . "<br />";
- if ($search_type=="artist_album_title"OR $search_type=="")
- $checked = "checked=\"checked\"";
- else
- $checked = "";
- echo "<input type=\"radio\" name=\"search_type\" value=\"artist_album_title\"".$checked." />" . _("Artist, Album and Title") . "<br />";
- ?>
- </td>
- </tr>
- <tr>
- <td></td>
- <td>
- <input type="hidden" name="action" value="search" />
- <input type="submit" value="<?php echo _('Search'); ?>" />
- </td>
- </tr>
-</table>
-</form>
-<?php show_box_bottom(); ?>
-<?php
+ require_once(conf('prefix') . '/templates/show_duplicates.inc.php');
} // show_duplicate_searchbox
?>