summaryrefslogtreecommitdiffstats
path: root/lib/duplicates.php
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/duplicates.php
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/duplicates.php')
-rw-r--r--lib/duplicates.php99
1 files changed, 30 insertions, 69 deletions
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
?>