diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-01-21 03:02:23 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-01-21 03:02:23 +0000 |
commit | 4957be23099939f26aef84954c012488653111d0 (patch) | |
tree | d73850d62318ab19c76483d67512398e52ffd2fc | |
parent | 8e1e11bdb72832ce5297471f21e2b15cf2b95c55 (diff) | |
download | ampache-4957be23099939f26aef84954c012488653111d0.tar.gz ampache-4957be23099939f26aef84954c012488653111d0.tar.bz2 ampache-4957be23099939f26aef84954c012488653111d0.zip |
fixed a problem with catalog builds in windows and fixed a bug I created when I was playing with the album art
-rw-r--r-- | admin/catalog.php | 2 | ||||
-rwxr-xr-x | docs/CHANGELOG | 1 | ||||
-rw-r--r-- | lib/class/catalog.class.php | 54 | ||||
-rw-r--r-- | lib/class/update.class.php | 2 | ||||
-rwxr-xr-x | modules/id3/vainfo.class.php | 2 | ||||
-rw-r--r-- | templates/show_add_catalog.inc.php | 18 |
6 files changed, 49 insertions, 30 deletions
diff --git a/admin/catalog.php b/admin/catalog.php index 9c3c9b1b..a855f116 100644 --- a/admin/catalog.php +++ b/admin/catalog.php @@ -257,7 +257,7 @@ switch ($_REQUEST['action']) { foreach ($catalogs as $data) { echo "<div class=\"confirmation-box\"><b>" . _('Starting Album Art Search') . ". . .</b><br /><br />\n"; echo _('Searched') . ": <span id=\"count_art_" . $data->id . "\">" . _('None') . "</span><br />"; - $data->get_album_art(); + $data->get_album_art(0,1); echo "<b>" . _('Album Art Search Finished') . ". . .</b></div>\n"; } $url = conf('web_path') . '/admin/index.php'; diff --git a/docs/CHANGELOG b/docs/CHANGELOG index cb5ab55d..e4a94d8e 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,7 @@ -------------------------------------------------------------------------- v.3.3.3 + - Fixed a issue with Catalog builds in Windows - Fixed a bug with admins ability to set the preferences of a specific user - Fixed logic on force http that was causing it not to work under diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php index 1f4f308b..301605c4 100644 --- a/lib/class/catalog.class.php +++ b/lib/class/catalog.class.php @@ -445,21 +445,48 @@ class Catalog { } // get_albums /** + * get_catalog_album_ids + * This returns an array of ids of albums that have songs in this + * catalog + * //FIXME:: :( + */ + function get_catalog_album_ids() { + + $id = sql_escape($this->id); + $results = array(); + + $sql = "SELECT DISTINCT(song.album) FROM song WHERE song.catalog='$id'"; + $db_results = mysql_query($sql,dbh()); + + while ($r = mysql_fetch_assoc($db_results)) { + $results[] = $r['album']; + } + + return $results; + + } // get_catalog_album_ids + + /** *get_album_art *This runs through all of the needs art albums and trys *to find the art for them from the mp3s */ - function get_album_art($catalog_id=0,$methods=array()) { + function get_album_art($catalog_id=0,$all='') { // Just so they get a page flush(); if (!$catalog_id) { $catalog_id = $this->id; } - // Get all of the needs art albums in this catalog - $albums = $this->_art_albums; + + if (!empty($all)) { + $albums = $this->get_catalog_album_ids(); + } + else { + $albums = array_keys($this->_art_albums); + } // Run through them an get the art! - foreach ($albums as $album_id=>$true) { + foreach ($albums as $album_id) { // Create the object $album = new Album($album_id); @@ -586,7 +613,7 @@ class Catalog { /* Set it as an empty array */ $files = array(); - $path = stripslashes($path); + $path = $path; /* Open up the directory */ $handle = @opendir($path); @@ -598,11 +625,18 @@ class Catalog { echo "<font class=\"error\">Error: Unable to change to $path directory</font><br />\n"; } + // Determine the slash type and go from there + if (strstr($path,"/")) { + $slash_type = '/'; + } + else { + $slash_type = '\\'; + } + /* Recurse through this dir and create the files array */ while ( FALSE !== ($file = @readdir($handle)) ) { - $full_file = stripslashes($path . "/" . $file); - $full_file = str_replace("//","/",$full_file); + $full_file = $path . $slash_type . $file; /* Incase this is the second time through, unset it before checking */ unset($failed_check); @@ -809,7 +843,7 @@ class Catalog { echo "<br />\n<b>" . _('Starting Album Art Search') . ". . .</b><br />\n"; echo _('Searched') . ": <span id=\"count_art_" . $this->id . "\">" . _('None') . "</span>"; flush(); - $this->get_album_art(0,$art); + $this->get_album_art(); } // if we want to gather album art /* Do a little stats mojo here */ @@ -1207,7 +1241,7 @@ class Catalog { while ($results = mysql_fetch_object($db_results)) { /* Remove slashes while we are checking for its existance */ - $results->file = stripslashes($results->file); + $results->file = $results->file; /* Stupid little cutesie thing */ $this->count++; @@ -1219,7 +1253,7 @@ class Catalog { } //echos song count /* Also check the file information */ - $file_info = @filesize($results->file); + $file_info = filesize($results->file); /* If it errors somethings splated, or the files empty */ if (!file_exists($results->file) OR $file_info < 1) { diff --git a/lib/class/update.class.php b/lib/class/update.class.php index 9f9bbd7d..f6a05274 100644 --- a/lib/class/update.class.php +++ b/lib/class/update.class.php @@ -338,7 +338,7 @@ class Update { $version[] = array('version' => '333002','description' => $update_string); - $update_string = '- Removed Last Upload Preference'; + $update_string = '- Removed Last Upload Preference<br />'; $version[] = array('version' => '333003','description' => $update_string); diff --git a/modules/id3/vainfo.class.php b/modules/id3/vainfo.class.php index 0c3d1434..cdf793ab 100755 --- a/modules/id3/vainfo.class.php +++ b/modules/id3/vainfo.class.php @@ -50,7 +50,7 @@ class vainfo { */ function vainfo($file,$encoding='',$dir_pattern,$file_pattern) { - $this->filename = stripslashes($file); + $this->filename = $file; if ($encoding) { $this->encoding = $encoding; } diff --git a/templates/show_add_catalog.inc.php b/templates/show_add_catalog.inc.php index a58d3a37..58feb238 100644 --- a/templates/show_add_catalog.inc.php +++ b/templates/show_add_catalog.inc.php @@ -76,23 +76,7 @@ $default_sort = "%a/%A"; <tr> <td valign="top"><?php echo _("Gather Album Art"); ?>:</td> - <td><input type="checkbox" onclick="flipField('artextra1');flipField('artextra2');flipField('artextra3');" name="gather_art" value="1" /><br /> - <table border="0" width="100%" cellpadding="0" cellspacing="0"> - <tr class="even"> - <td><?php echo _('ID3V2 Tags'); ?>:</td> - <td><input id="artextra1" disabled="disabled" type="checkbox" name="art_id3v2" value="1" /></td> - </tr> - <tr class="even"> - <td><?php echo _('Amazon'); ?>:</td> - <td><input id="artextra2" disabled="disabled" type="checkbox" name="art_amazon" value="1" /></td> - </tr> - <tr class="even"> - <td><?php echo _('File Folder'); ?>:</td> - <td><input id="artextra3" disabled="disabled" type="checkbox" name="art_folder" value="1" /></td> - </tr> - </table> - <br /> - </td> + <td><input type="checkbox" name="gather_art" value="1" /></td> </tr> <tr> <td valign="top"><?php echo _('Build Playlists from m3u Files'); ?>:</td> |