From edcf34c986d14fb6583eb29958bf88140cd97b5b Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Sat, 30 Sep 2006 04:15:11 +0000 Subject: fixed up xmlrpc hopefully (needs testing) and fixed duplicates, cleaned up burgundy a little more --- lib/class/catalog.class.php | 18 ++++++--- lib/duplicates.php | 99 ++++++++++++++------------------------------- 2 files changed, 43 insertions(+), 74 deletions(-) (limited to 'lib') 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 "

" . _("Completed updating remote catalog(s)") . ".


\n"; + echo "

" . _('Completed updating remote catalog(s)') . ".


\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...
"; + echo _('Added') . " $total...
"; 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 "

$error_msg

"; } diff --git a/lib/duplicates.php b/lib/duplicates.php index 3fe56ed1..71b786f0 100644 --- a/lib/duplicates.php +++ b/lib/duplicates.php @@ -21,20 +21,15 @@ */ -/*! - @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 -?> - -
- - - - - - - - - -
: - " . _("Title") . "
"; - - if ($search_type=="artist_title") - $checked = "checked=\"checked\""; - else - $checked = ""; - echo "" . _("Artist and Title") . "
"; - if ($search_type=="artist_album_title"OR $search_type=="") - $checked = "checked=\"checked\""; - else - $checked = ""; - echo "" . _("Artist, Album and Title") . "
"; - ?> -
- - -
-
- - -- cgit