summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-05-25 05:49:22 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-05-25 05:49:22 +0000
commit79316acb81fe9215b09ec41918b9a402560e7bef (patch)
tree9a71adc5d6dd297e3f39976796e380be10f19a4e /lib
parent035b273ff529a34e1d2cb52bd61c653c6bff8250 (diff)
downloadampache-79316acb81fe9215b09ec41918b9a402560e7bef.tar.gz
ampache-79316acb81fe9215b09ec41918b9a402560e7bef.tar.bz2
ampache-79316acb81fe9215b09ec41918b9a402560e7bef.zip
fixed find album art, including a fix from Karl Hungus... seriously I am not making that name up
Diffstat (limited to 'lib')
-rw-r--r--lib/album.lib.php17
-rw-r--r--lib/class/album.class.php18
-rw-r--r--lib/ui.lib.php6
3 files changed, 29 insertions, 12 deletions
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