summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--albums.php11
-rwxr-xr-xdocs/CHANGELOG2
-rw-r--r--image.php4
-rw-r--r--lib/album.lib.php17
-rw-r--r--lib/class/album.class.php18
-rw-r--r--lib/ui.lib.php6
-rw-r--r--templates/show_album_art.inc.php4
-rw-r--r--templates/show_big_art.inc.php (renamed from templates/show_big_art.inc)10
-rw-r--r--templates/show_get_albumart.inc.php4
-rw-r--r--templates/sidebar_browse.inc.php15
10 files changed, 56 insertions, 35 deletions
diff --git a/albums.php b/albums.php
index b920737e..ac30e78b 100644
--- a/albums.php
+++ b/albums.php
@@ -109,8 +109,6 @@ switch ($_REQUEST['action']) {
$options['artist'] = $artist;
$options['album_name'] = $album_name;
$options['keyword'] = $artist . " " . $album_name;
- // HACK that makes baby jesus cry...
- $options['skip_id3'] = true;
// Attempt to find the art.
$images = $album->find_art($options,'6');
@@ -127,14 +125,13 @@ switch ($_REQUEST['action']) {
// We don't want to store raw's in here so we need to strip them out into a seperate array
foreach ($images as $index=>$image) {
if (isset($image['raw'])) {
- //unset($images[$index]);
- $images[$index]['raw'] = '';
+ unset($images[$index]['raw']);
}
- } // end foreach
+ } // end foreach
// Store the results for further use
$_SESSION['form']['images'] = $images;
- require_once(conf('prefix') . '/templates/show_album_art.inc.php');
+ require_once Config::get('prefix') . '/templates/show_album_art.inc.php';
}
// Else nothing
else {
@@ -148,7 +145,7 @@ switch ($_REQUEST['action']) {
if (isset($_REQUEST['album_name'])) { $albumname = scrub_in($_REQUEST['album_name']); }
if (isset($_REQUEST['artist_name'])) { $artistname = scrub_in($_REQUEST['artist_name']); }
- require_once(conf('prefix') . '/templates/show_get_albumart.inc.php');
+ require_once Config::get('prefix') . '/templates/show_get_albumart.inc.php';
break;
case 'select_art':
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index 2a250cd9..013d76f1 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,8 @@
--------------------------------------------------------------------------
v.3.4-Alpha1
+ - Fixed Find album art so it can look in the id3/wma art tags
+ correctly (Thx Karl Hungus)
- Updated SQL to latest version
- Moved Album art out of the album table into album_data
- Changed Browsing Method and default playlist method
diff --git a/image.php b/image.php
index 07f15a3e..8bd6d5e3 100644
--- a/image.php
+++ b/image.php
@@ -24,7 +24,7 @@
* and dumps it to the browser as an image mime type.
*
*/
-require('lib/init.php');
+require 'lib/init.php';
/* Decide what size this image is */
switch ($_REQUEST['thumb']) {
@@ -51,7 +51,7 @@ switch ($_REQUEST['thumb']) {
switch ($_REQUEST['type']) {
case 'popup':
- show_template('show_big_art');
+ require_once Config::get('prefix') . '/templates/show_big_art.inc.php';
break;
// If we need to pull the data out of the session
case 'session':
diff --git a/lib/album.lib.php b/lib/album.lib.php
index 94ee1726..ef0c7124 100644
--- a/lib/album.lib.php
+++ b/lib/album.lib.php
@@ -52,6 +52,23 @@ function get_image_from_source($data) {
fclose($handle);
return $image_data;
}
+
+ // Check to see if it is embedded in id3 of a song
+ if (isset($data['song'])) {
+ // If we find a good one, stop looking
+ $getID3 = new getID3();
+ $id3 = $getID3->analyze($data['song']);
+
+ if ($id3['format_name'] == "WMA") {
+ return $id3['asf']['extended_content_description_object']['content_descriptors']['13']['data'];
+ }
+ elseif (isset($id3['id3v2']['APIC'])) {
+ // Foreach incase they have more then one
+ foreach ($id3['id3v2']['APIC'] as $image) {
+ return $image['data'];
+ }
+ }
+ } // if data song
return false;
diff --git a/lib/class/album.class.php b/lib/class/album.class.php
index e909e1e2..be967ded 100644
--- a/lib/class/album.class.php
+++ b/lib/class/album.class.php
@@ -210,7 +210,7 @@ class Album {
public function get_art() {
// Attempt to get the resized art first
- $art = $this->get_resized_db_art();
+ //$art = $this->get_resized_db_art();
if (!is_array($art)) {
$art = $this->get_db_art();
@@ -236,7 +236,7 @@ class Album {
$results = array();
/* Attempt to retrive the album art order */
- $config_value = conf('album_art_order');
+ $config_value = Config::get('album_art_order');
$class_methods = get_class_methods('Album');
/* If it's not set */
@@ -305,12 +305,12 @@ class Album {
if ($id3['format_name'] == "WMA") {
$image = $id3['asf']['extended_content_description_object']['content_descriptors']['13'];
- $data[] = array('raw'=>$image['data'],'mime'=>$image['mime']);
+ $data[] = array('song'=>$song->file,'raw'=>$image['data'],'mime'=>$image['mime']);
}
elseif (isset($id3['id3v2']['APIC'])) {
// Foreach incase they have more then one
foreach ($id3['id3v2']['APIC'] as $image) {
- $data[] = array('raw'=>$image['data'],'mime'=>$image['mime']);
+ $data[] = array('song'=>$song->file,'raw'=>$image['data'],'mime'=>$image['mime']);
}
}
@@ -611,7 +611,7 @@ class Album {
/* Have to disable this for Demo because people suck and try to
* insert PORN :(
*/
- if (conf('demo_mode')) { return false; }
+ if (Config::get('demo_mode')) { return false; }
// Check for PHP:GD and if we have it make sure this image is of some size
if (function_exists('ImageCreateFromString')) {
@@ -622,10 +622,10 @@ class Album {
} // if we have PHP:GD
// Push the image into the database
- $sql = "UPDATE album SET art = '" . sql_escape($image) . "'," .
- " art_mime = '" . sql_escape($mime) . "'" .
- " WHERE id = '$this->id'";
- $db_results = mysql_query($sql, dbh());
+ $sql = "REPLACE INTO `album_data` SET `art` = '" . Dba::escape($image) . "'," .
+ " `art_mime` = '" . Dba::escape($mime) . "'" .
+ ", `album_id` = '$this->id'";
+ $db_results = Dba::query($sql);
return true;
diff --git a/lib/ui.lib.php b/lib/ui.lib.php
index 3a7d3f7e..46642fbe 100644
--- a/lib/ui.lib.php
+++ b/lib/ui.lib.php
@@ -38,14 +38,14 @@
*/
function show_confirmation($title,$text,$next_url,$cancel=0) {
- if (substr_count($next_url,conf('web_path'))) {
+ if (substr_count($next_url,Config::get('web_path'))) {
$path = $next_url;
}
else {
- $path = conf('web_path') . "/$next_url";
+ $path = Config::get('web_path') . "/$next_url";
}
- require (conf('prefix') . "/templates/show_confirmation.inc.php");
+ require Config::get('prefix') . '/templates/show_confirmation.inc.php';
} // show_confirmation
diff --git a/templates/show_album_art.inc.php b/templates/show_album_art.inc.php
index a13f15e1..49e92809 100644
--- a/templates/show_album_art.inc.php
+++ b/templates/show_album_art.inc.php
@@ -32,7 +32,7 @@ while ($i <= $rows) {
$j=0;
while ($j < 4) {
$key = $i*4+$j;
- $image_url = conf('web_path') . '/image.php?type=session&amp;image_index=' . $key;
+ $image_url = Config::get('web_path') . '/image.php?type=session&amp;image_index=' . $key;
if (!isset($images[$key])) { echo "<td>&nbsp;</td>\n"; }
else {
?>
@@ -41,7 +41,7 @@ while ($i <= $rows) {
<img src="<?php echo $image_url; ?>" border="0" height="175" width="175" /><br />
</a>
<p align="center">
- [<a href="<?php echo conf('web_path'); ?>/albums.php?action=select_art&amp;image=<?php echo $key; ?>&amp;album_id=<?php echo urlencode($_REQUEST['album_id']); ?>">Select</a>]
+ [<a href="<?php echo Config::get('web_path'); ?>/albums.php?action=select_art&amp;image=<?php echo $key; ?>&amp;album_id=<?php echo urlencode($_REQUEST['album_id']); ?>">Select</a>]
</p>
</td>
<?php
diff --git a/templates/show_big_art.inc b/templates/show_big_art.inc.php
index f9f84bcc..009a0daa 100644
--- a/templates/show_big_art.inc
+++ b/templates/show_big_art.inc.php
@@ -19,19 +19,19 @@
*/
-$htmllang = str_replace("_","-",conf('lang'));
+$htmllang = str_replace("_","-",Config::get('lang'));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $htmllang; ?>" lang="<?php echo $htmllang; ?>">
<head>
-<link rel="shortcut icon" href="<?php echo conf('web_path'); ?>/favicon.ico" />
-<meta http-equiv="Content-Type" content="text/html; charset=<?php echo conf('site_charset'); ?>" />
-<title><?php echo conf('site_title'); ?> - <?php echo _("Album Art"); ?></title>
+<link rel="shortcut icon" href="<?php echo Config::get('web_path'); ?>/favicon.ico" />
+<meta http-equiv="Content-Type" content="text/html; charset=<?php echo Config::get('site_charset'); ?>" />
+<title><?php echo Config::get('site_title'); ?> - <?php echo _("Album Art"); ?></title>
</head>
<body onLoad="self.resizeTo(document.images[0].width+30, document.images[0].height+70)">
<?php
echo "<a href=\"javascript:window.close()\" title=\"" . _('Click to close window') . "\">";
-echo "<img src=\"" . conf('web_path') . "/image.php?id=" . scrub_out($_GET['id']) . "&amp;sid=" . session_id() . "\" border=\"0\" />";
+echo "<img src=\"" . Config::get('web_path') . "/image.php?id=" . scrub_out($_GET['id']) . "&amp;sid=" . session_id() . "\" border=\"0\" />";
echo "</a>";
?>
</body>
diff --git a/templates/show_get_albumart.inc.php b/templates/show_get_albumart.inc.php
index 3375ae18..7d2bd475 100644
--- a/templates/show_get_albumart.inc.php
+++ b/templates/show_get_albumart.inc.php
@@ -21,7 +21,7 @@
*/
?>
<?php show_box_top(_('Customize Search')); ?>
-<form enctype="multipart/form-data" name="coverart" method="post" action="<?php echo conf('web_path'); ?>/albums.php?action=find_art&album_id=<?php echo $album->id; ?>&artist_name=<?php echo $_REQUEST['artist_name'];?>&album_name=<?php echo $_REQUEST['album_name']; ?>&cover=<?php echo scrub_out($_REQUEST['cover']); ?>" style="Display:inline;">
+<form enctype="multipart/form-data" name="coverart" method="post" action="<?php echo Config::get('web_path'); ?>/albums.php?action=find_art&album_id=<?php echo $album->id; ?>&artist_name=<?php echo $_REQUEST['artist_name'];?>&album_name=<?php echo $_REQUEST['album_name']; ?>&cover=<?php echo scrub_out($_REQUEST['cover']); ?>" style="Display:inline;">
<table>
<tr>
</tr>
@@ -62,7 +62,7 @@
<td>
<input type="hidden" name="action" value="find_art" />
<input type="hidden" name="album_id" value="<?php echo $album->id; ?>" />
- <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo conf('max_upload_size'); ?>" />
+ <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo Config::get('max_upload_size'); ?>" />
<input type="submit" value="<?php echo _('Get Art'); ?>" />
</td>
</tr>
diff --git a/templates/sidebar_browse.inc.php b/templates/sidebar_browse.inc.php
index d7cada27..dc669c3f 100644
--- a/templates/sidebar_browse.inc.php
+++ b/templates/sidebar_browse.inc.php
@@ -1,12 +1,17 @@
<?php $ajax_info = Config::get('ajax_url'); ?>
<h4><?php echo _('Browse By'); ?></h4>
-<form id="browse_type" name="browse_type" action="<?php echo Config::get('web_path'); ?>/browse.php" method="post">
+<?php
+ // Build the selected dealie
+ $text = scrub_in($_REQUEST['action']) . '_ac';
+ ${$text} = ' selected="selected"';
+?>
+<form id="browse_type" name="browse_type" action="<?php echo Config::get('web_path'); ?>/browse.php" method="get">
<select name="action" onchange="document.getElementById('browse_type').submit();" >
<option value="">-- <?php echo _('Type'); ?> --</option>
- <option value="song"><?php echo _('Song Title'); ?></option>
- <option value="album"><?php echo _('Albums'); ?></option>
- <option value="artist"><?php echo _('Artist'); ?></option>
- <option value="genre"><?php echo _('Genre'); ?></option>
+ <option value="song"<?php echo $song_ac; ?>><?php echo _('Song Title'); ?></option>
+ <option value="album"<?php echo $album_ac; ?>><?php echo _('Albums'); ?></option>
+ <option value="artist"<?php echo $artist_ac; ?>><?php echo _('Artist'); ?></option>
+ <option value="genre"<?php echo $genre_ac; ?>><?php echo _('Genre'); ?></option>
</select>
</form>
<hr />