summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-06-14 23:57:21 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-06-14 23:57:21 +0000
commit7db599b70d03cc288fcf499bebd9afb2485c930d (patch)
tree556e85f9baf10f2b1e845eec9cc098f22d2115cd
parentfed2041c7b15e30fd126d6b1290ba255d3ec5d1d (diff)
downloadampache-7db599b70d03cc288fcf499bebd9afb2485c930d.tar.gz
ampache-7db599b70d03cc288fcf499bebd9afb2485c930d.tar.bz2
ampache-7db599b70d03cc288fcf499bebd9afb2485c930d.zip
new vainfo which should solve the ogg with id3 tags issue and potentially break other things yeah!
-rw-r--r--config/ampache.cfg.php.dist24
-rwxr-xr-xdocs/CHANGELOG4
-rw-r--r--lib/class/catalog.class.php31
-rw-r--r--lib/general.lib.php101
-rw-r--r--lib/log.lib.php7
-rwxr-xr-xmodules/id3/audioinfo.class.php465
-rwxr-xr-xmodules/id3/vainfo.class.php114
-rw-r--r--modules/init.php4
8 files changed, 176 insertions, 574 deletions
diff --git a/config/ampache.cfg.php.dist b/config/ampache.cfg.php.dist
index 4a80082b..12a0cd16 100644
--- a/config/ampache.cfg.php.dist
+++ b/config/ampache.cfg.php.dist
@@ -50,12 +50,6 @@ local_length = 900
# DEAFULT: 900
remember_length = 900
-# This is the DOMAIN for the cookie that stores your session key
-# this must be set to the domain of your host or you will not be
-# able to log in make sure you including the leading .
-# DEFAULT: ""
-#sess_domain = .yourwebsite.com
-
# Name of the Session/Cookie that will sent to the browser
# default should be fine
# DEFAULT: ampache
@@ -112,14 +106,16 @@ require_session = "true"
# VALUES: any whole number (in bytes per second)
#throttle_download = 10
-# This sets which ID3 tag takes precedence.
-# we've found for those of you who don't have
-# good v2 tags it's sometimes nice to keep the v1
-# until you've fixed v2
-# POSSIBLE VALUES: id3v1 id3v2
+# This determines the tag order for all cataloged
+# music. If none of the listed tags are found then
+# ampache will default to the first tag format
+# that was found.
+# POSSIBLE VALUES: id3v1 id3v2 file vorbiscomment
+# quicktime ape
# DEFAULT: id3v2,id3v1
-id3tag_order = "id3v2"
-id3tag_order = "id3v1"
+tag_order = "id3v2"
+tag_order = "id3v1"
+tag_order = "file"
# Un comment if don't want ampache to follow symlinks
# DEFAULT: false
@@ -240,7 +236,7 @@ debug_level = 5
# this will only happen if debug is turned on. Do not
# include trailing slash. You will need to make sure that
# your HTTP server has write access to the specified directory
-# DEFAULT: /var/log/ampache
+# DEFAULT: NULL
#log_path = "/var/log/ampache"
# Max Upload Size
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index c4f0b5f6..5b36f684 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,10 @@
--------------------------------------------------------------------------
v.3.3.2-Beta3
+ - Added new getid3() wrapper (vainfo) should resolve the
+ id3 tags in oggs issue that some people were having
+ and makes file only tag basis possible. requires
+ and update to your ampache.cfg.php
- Fixed Transcoding logic issue and added preset line for
transcoding flac files in .dist file (Defaulted to Off)
- Upgraded to Getid3() 1.7.6
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php
index aec7432b..e4262ddb 100644
--- a/lib/class/catalog.class.php
+++ b/lib/class/catalog.class.php
@@ -871,20 +871,17 @@ class Catalog {
*/
function update_song_from_tags($song) {
-
+ /* Record the reading of these tags */
debug_event('tag-read',"Reading Tags from $song->file",'5','ampache-catalog');
- $info = new Audioinfo();
- $results = $info->Info($song->file);
+ $vainfo = new vainfo($song->file,'',$this->sort_pattern,$this->rename_pattern);
+ $vainfo->get_info();
/* Find the correct key */
- $key = get_tag_type($results);
-
- /* Fill Missing Information */
- $results = $song->fill_info($results,$this->sort_pattern . "/" . $this->rename_pattern, $this->id, $key);
+ $key = get_tag_type($vainfo->tags);
/* Clean up the tags */
- $results = clean_tag_info($results,$key,$song->file);
+ $results = clean_tag_info($vainfo->tags,$key,$song->file);
/* Setup the vars */
$new_song = new Song();
@@ -903,7 +900,7 @@ class Catalog {
$genre = $results['genre'];
/* Clean up Old Vars */
- unset($results,$key,$info);
+ unset($vainfo,$key);
/*
* We have the artist/genre/album name need to check it in the tables
@@ -1977,19 +1974,15 @@ class Catalog {
*/
function insert_local_song($file,$file_info) {
- /* Create the Audioinfo object and get info */
- $audio_info = new Audioinfo();
+ /* Create the vainfo object and get info */
+ $vainfo = new vainfo($file,'',$this->sort_pattern,$this->rename_pattern);
+ $vainfo->get_info();
$song_obj = new Song();
- $results = $audio_info->Info($file);
- $results['file'] = $file;
-
- $key = get_tag_type($results);
- /* Fill Empty info from filename/path */
- $results = $song_obj->fill_info($results,$this->sort_pattern . "/" . $this->rename_pattern,$this->id,$key);
+ $key = get_tag_type($vainfo->tags);
/* Clean Up the tags */
- $results = clean_tag_info($results,$key,$file);
+ $results = clean_tag_info($vainfo->tags,$key,$file);
/* Set the vars here... so we don't have to do the '" . $blah['asd'] . "' */
$title = sql_escape($results['title']);
@@ -2023,7 +2016,7 @@ class Catalog {
if (!$db_results) {
debug_event('insert',"Unable to insert $file -- $sql",'5','ampache-catalog');
- echo "<span style=\"color: #F00;\">Error Adding $file </span><br />$sql<br />";
+ echo "<span style=\"color: #F00;\">Error Adding $file </span><hr />$sql<hr />";
flush();
}
diff --git a/lib/general.lib.php b/lib/general.lib.php
index 1ad4a908..085f33af 100644
--- a/lib/general.lib.php
+++ b/lib/general.lib.php
@@ -335,70 +335,54 @@ function extend_session($sid) {
} // extend_session
-/*!
- @function get_tag_type
- @discussion finds out what tag the audioinfo
- results returned
-*/
+/**
+ * get_tag_type
+ * This takes the result set, and the the tag_order
+ * As defined by your config file and trys to figure out
+ * which tag type it should use, if your tag_order
+ * doesn't match anything then it just takes the first one
+ * it finds in the results.
+ */
function get_tag_type($results) {
- // Check and see if we are dealing with an ogg
- // If so order will be a little different
- if ($results['ogg']) {
- $order[0] = 'ogg';
- } // end if ogg
- elseif ($results['rm'] OR $results['format_name'] == 'Real') {
- $order[0] = 'real';
- }
- elseif ($results['flac']) {
- $order[0] = 'flac';
- }
- elseif ($results['asf']) {
- $order[0] = 'asf';
- }
- elseif ($results['m4a']) {
- $order[0] = 'm4a';
- }
- elseif ($results['mpc']) {
- $order[0] = 'mpc';
- }
- else {
- $order = conf('id3tag_order');
- } // end else
-
- if (!is_array($order)) {
- $order = array($order);
- }
-
- // set the $key to the first found tag style (according to their prefs)
+ /* Pull In the config option */
+ $order = conf('tag_order');
+
+ if (!is_array($order)) {
+ $order = array($order);
+ }
+
+ /* Foreach through the defined key order
+ * the first one we find is the first one we use
+ */
foreach($order as $key) {
if ($results[$key]) {
+ $returned_key = $key;
break;
}
}
- return $key;
+ /* If we didn't find anything then default it to the
+ * first in the results set
+ */
+ if (!isset($returned_key)) {
+ $keys = array_keys($results);
+ $returned_key = $keys['0'];
+ }
+
+ return $returned_key;
} // get_tag_type
-/*!
- @function clean_tag_info
- @discussion cleans up the tag information
-*/
+/**
+ * clean_tag_info
+ * This function takes the array from vainfo along with the
+ * key we've decided on and the filename and returns it in a
+ * sanatized format that ampache can actually use
+ */
function clean_tag_info($results,$key,$filename) {
- if ($key == 'real') {
- $results['real'] = $results['tags']['real'];
- }
-
- /* Flatten any arrayed results */
- foreach ($results[$key] as $field=>$data) {
- if (is_array($data)) {
- $results[$key][$field] = array_pop($data);
- }
- }
-
$info = array();
$clean_array = array("\n","\t","\r","\0");
@@ -407,13 +391,18 @@ function clean_tag_info($results,$key,$filename) {
$info['file'] = $filename;
$info['title'] = stripslashes(trim($results[$key]['title']));
$info['year'] = intval($results[$key]['year']);
- $info['comment'] = sql_escape(str_replace($clean_array,$wipe_array,$results[$key]['comment']));
- $info['bitrate'] = intval($results['avg_bit_rate']);
- $info['rate'] = intval($results['sample_rate']);
- $info['mode'] = $results['bitrate_mode'];
- $info['size'] = filesize($filename);
- $info['time'] = intval($results['playing_time']);
$info['track'] = intval($results[$key]['track']);
+ $info['comment'] = sql_escape(str_replace($clean_array,$wipe_array,$results[$key]['comment']));
+
+ /* This are pulled from the info array */
+ $info['bitrate'] = intval($results['info']['bitrate']);
+ $info['rate'] = intval($results['info']['sample_rate']);
+ $info['mode'] = $results['info']['bitrate_mode'];
+ $info['size'] = $results['info']['filesize'];
+ $info['mime'] = $results['info']['mime'];
+ $into['encoding'] = $results['info']['encoding'];
+ $info['time'] = intval($results['info']['playing_time']);
+ $info['channels'] = intval($results['info']['channels']);
/* These are used to generate the correct ID's later */
$info['artist'] = trim($results[$key]['artist']);
diff --git a/lib/log.lib.php b/lib/log.lib.php
index a82338f0..ed19984c 100644
--- a/lib/log.lib.php
+++ b/lib/log.lib.php
@@ -81,8 +81,11 @@ function ampache_error_handler($errno, $errstr, $errfile, $errline) {
break;
} // end switch
- /* Don't log var: Deprecated we know shutup! */
- if (strstr($errstr,"var: Deprecated. Please use the public/private/protected modifiers")) {
+ /* Don't log var: Deprecated we know shutup!
+ * Yea now getid3() spews errors I love it :(
+ */
+ if (strstr($errstr,"var: Deprecated. Please use the public/private/protected modifiers") OR
+ strstr($errstr,"getimagesize() [")) {
return false;
}
diff --git a/modules/id3/audioinfo.class.php b/modules/id3/audioinfo.class.php
deleted file mode 100755
index 30a29cbc..00000000
--- a/modules/id3/audioinfo.class.php
+++ /dev/null
@@ -1,465 +0,0 @@
-<?php
-
-// +----------------------------------------------------------------------+
-// | PHP version 4.1.0 |
-// +----------------------------------------------------------------------+
-// | Placed in public domain by Allan Hansen, 2002. Share and enjoy! |
-// +----------------------------------------------------------------------+
-// | /demo/demo.audioinfo.class.php |
-// | |
-// | Example wrapper class to extract information from audio files |
-// | through getID3(). |
-// | |
-// | getID3() returns a lot of information. Much of this information is |
-// | not needed for the end-application. It is also possible that some |
-// | users want to extract specific info. Modifying getID3() files is a |
-// | bad idea, as modifications needs to be done to future versions of |
-// | getID3(). |
-// | |
-// | Modify this wrapper class instead. This example extracts certain |
-// | fields only and adds a new root value - encoder_options if possible. |
-// | It also checks for mp3 files with wave headers. |
-// +----------------------------------------------------------------------+
-// | Example code: |
-// | $au = new AudioInfo(); |
-// | print_r($au->Info('file.flac'); |
-// +----------------------------------------------------------------------+
-// | Authors: Allan Hansen <ahØartemis*dk> |
-// +----------------------------------------------------------------------+
-//
-
-
-
-/**
-* getID3() settings
-*/
-
-require_once(conf('prefix') . "/modules/id3/getid3/getid3.php");
-
-
-
-
-/**
-* Class for extracting information from audio files with getID3().
-*/
-
-class AudioInfo {
-
- /**
- * Private variables
- */
- var $result = NULL;
- var $info = NULL;
-
-
-
-
- /**
- * Constructor
- */
-
- function AudioInfo() {
-
- // Initialize getID3 engine
- $this->getID3 = new getID3;
- $this->getID3->option_md5_data = false;
- $this->getID3->option_md5_data_source = false;
- $this->getID3->encoding = 'UTF-8';
- }
-
-
-
-
- /**
- * Extract information - only public function
- *
- * @access public
- * @param string file Audio file to extract info from.
- */
-
- function Info($file) {
-
- // Analyze file
- $this->info = $this->getID3->analyze($file);
-
- // Exit here on error
- if (isset($this->info['error'])) {
- return array ('error' => $this->info['error']);
- }
-
- // Init wrapper object
- $this->result = array ();
- $this->result['format_name'] = @$this->info['fileformat'].'/'.@$this->info['audio']['dataformat'].(isset($this->info['video']['dataformat']) ? '/'.@$this->info['video']['dataformat'] : '');
- $this->result['encoder_version'] = @$this->info['audio']['encoder'];
- $this->result['encoder_options'] = NULL;
- $this->result['bitrate_mode'] = @$this->info['audio']['bitrate_mode'];
- $this->result['channels'] = @$this->info['audio']['channels'];
- $this->result['sample_rate'] = @$this->info['audio']['sample_rate'];
- $this->result['bits_per_sample'] = @$this->info['audio']['bits_per_sample'];
- $this->result['playing_time'] = @$this->info['playtime_seconds'];
- $this->result['avg_bit_rate'] = @$this->info['audio']['bitrate'];
- $this->result['tags'] = @$this->info['tags'];
- $this->result['comments'] = @$this->info['comments'];
- $this->result['warning'] = @$this->info['warning'];
- $this->result['md5'] = @$this->info['md5_data'];
- //$this->result['full'] = @$this->info;
-
- // The vollmer way
- if($this->info['fileformat'] === 'mp3' || $this->info['audio']['dataformat'] === "mp3")
- {
- if (isset($this->info['tags']['id3v1'])) { $this->info['id3v1']['comments'] = $this->info['tags']['id3v1']; }
- if (isset($this->info['tags']['id3v2'])) { $this->info['id3v2']['comments'] = $this->info['tags']['id3v2']; }
-
- if ($this->info['id3v1']) {
- if (function_exists('iconv')) {
- $this->result['id3v1']['title'] = iconv("UTF-8", "ISO-8859-1", $this->info['id3v1']['comments']['title'][0]);
- $this->result['id3v1']['artist'] = iconv("UTF-8", "ISO-8859-1", $this->info['id3v1']['comments']['artist'][0]);
- $this->result['id3v1']['album'] = iconv("UTF-8", "ISO-8859-1", $this->info['id3v1']['comments']['album'][0]);
- $this->result['id3v1']['comment'] = iconv("UTF-8", "ISO-8859-1", $this->info['id3v1']['comments']['comment'][0]);
- $this->result['id3v1']['genre'] = iconv("UTF-8", "ISO-8859-1", $this->info['id3v1']['comments']['genre'][0]);
- }
- else {
- $this->result['id3v1']['title'] = $this->info['id3v1']['comments']['title'][0];
- $this->result['id3v1']['artist'] = $this->info['id3v1']['comments']['artist'][0];
- $this->result['id3v1']['album'] = $this->info['id3v1']['comments']['album'][0];
- $this->result['id3v1']['comment'] = $this->info['id3v1']['comments']['comment'][0];
- $this->result['id3v1']['genre'] = $this->info['id3v1']['comments']['genre'][0];
- } // no iconv
- $this->result['id3v1']['year'] = $this->info['id3v1']['comments']['year'][0];
- $this->result['id3v1']['track'] = $this->info['id3v1']['comments']['track'][0];
-
- }
- if ($this->info['id3v2']) {
- if (function_exists('iconv')) {
- $this->result['id3v2']['title'] = iconv("UTF-8", "ISO-8859-1", $this->info['id3v2']['comments']['title'][0]);
- $this->result['id3v2']['artist'] = iconv("UTF-8", "ISO-8859-1", $this->info['id3v2']['comments']['artist'][0]);
- $this->result['id3v2']['album'] = iconv("UTF-8", "ISO-8859-1", $this->info['id3v2']['comments']['album'][0]);
- $this->result['id3v2']['comment'] = iconv("UTF-8", "ISO-8859-1", $this->info['id3v2']['comments']['comment'][0]);
- }
- else {
- $this->result['id3v2']['title'] = $this->info['id3v2']['comments']['title'][0];
- $this->result['id3v2']['artist'] = $this->info['id3v2']['comments']['artist'][0];
- $this->result['id3v2']['album'] = $this->info['id3v2']['comments']['album'][0];
- $this->result['id3v2']['comment'] = $this->info['id3v2']['comments']['comment'][0];
-
- }
- $this->result['id3v2']['year'] = $this->info['id3v2']['comments']['year'][0];
- $this->result['id3v2']['genre'] = $this->info['id3v2']['comments']['genre'][0];
- $this->result['id3v2']['track'] = $this->info['id3v2']['comments']['track'][0];
- $this->result['id3v2']['genreid'] = $this->info['id3v2']['comments']['genreid'][0];
- }
- }
- elseif($this->info['fileformat'] === 'ogg') {
- if (function_exists('iconv')) {
- $this->result['ogg']['title'] = iconv("UTF-8",conf('site_charset') . "//TRANSLIT", $this->info['ogg']['comments']['title'][0]);
- $this->result['ogg']['artist'] = iconv("UTF-8",conf('site_charset') . "//TRANSLIT", $this->info['ogg']['comments']['artist'][0]);
- $this->result['ogg']['album'] = iconv("UTF-8",conf('site_charset') . "//TRANSLIT", $this->info['ogg']['comments']['album'][0]);
- $this->result['ogg']['author'] = iconv("UTF-8",conf('site_charset') . "//TRANSLIT", $this->info['ogg']['comments']['author'][0]);
- $this->result['ogg']['genre'] = iconv("UTF-8",conf('site_charset') . "//TRANSLIT", $this->info['ogg']['comments']['genre'][0]);
- }
- else {
- $this->result['ogg']['title'] = $this->info['ogg']['comments']['title'][0];
- $this->result['ogg']['artist'] = $this->info['ogg']['comments']['artist'][0];
- $this->result['ogg']['album'] = $this->info['ogg']['comments']['album'][0];
- $this->result['ogg']['author'] = $this->info['ogg']['comments']['author'][0];
- $this->result['ogg']['genre'] = $this->info['ogg']['comments']['genre'][0];
- }
-
- $this->result['ogg']['year'] = $this->info['ogg']['comments']['date'][0];
- $this->result['ogg']['track'] = $this->info['ogg']['comments']['tracknumber'][0];
-
- } // if ogg
- /* If it's a WMA */
- elseif($this->info['fileformat'] === 'asf') {
- if (function_exists('iconv')) {
- $this->result['asf']['title'] = iconv("UTF-8","ISO-8859-1", $this->info['tags']['asf']['title'][0]);
- $this->result['asf']['artist'] = iconv("UTF-8","ISO-8859-1", $this->info['tags']['asf']['artist'][0]);
- $this->result['asf']['album'] = iconv("UTF-8","ISO-8859-1", $this->info['tags']['asf']['album'][0]);
- $this->result['asf']['comment'] = iconv("UTF-8","ISO-8859-1", $this->info['tags']['asf']['comment'][0]);
- } // if iconv
- else {
- $this->result['asf']['title'] = $this->info['tags']['asf']['title'][0];
- $this->result['asf']['artist'] = $this->info['tags']['asf']['artist'][0];
- $this->result['asf']['album'] = $this->info['tags']['asf']['album'][0];
- $this->result['asf']['comment'] = $this->info['tags']['asf']['comment'][0];
- }
- $this->result['asf']['track'] = $this->info['tags']['asf']['track'][0];
- $this->result['asf']['year'] = $this->info['tags']['asf']['year'][0];
- } // if wma
- /* If it's a flac */
- elseif($this->info['fileformat'] === 'flac') {
- if (function_exists('iconv')) {
- $this->result['flac']['title'] = iconv("UTF-8","ISO-8859-1", $this->info['tags']['vorbiscomment']['title'][0]);
- $this->result['flac']['artist'] = iconv("UTF-8","ISO-8859-1", $this->info['tags']['vorbiscomment']['artist'][0]);
- $this->result['flac']['album'] = iconv("UTF-8","ISO-8859-1", $this->info['tags']['vorbiscomment']['album'][0]);
- $this->result['flac']['comment'] = iconv("UTF-8","ISO-8859-1", $this->info['comments'][0]);
- }
- else {
- $this->result['flac']['title'] = $this->info['tags']['vorbiscomment']['title'][0];
- $this->result['flac']['artist'] = $this->info['tags']['vorbiscomment']['artist'][0];
- $this->result['flac']['album'] = $this->info['tags']['vorbiscomment']['album'][0];
- $this->result['flac']['comment'] = $this->info['comments'][0];
- }
- $this->result['flac']['track'] = $this->info['tags']['vorbiscomment']['tracknumber'][0];
- $this->result['flac']['year'] = $this->info['tags']['vorbiscomment']['date'][0];
- $this->result['flac']['genre'] = $this->info['tags']['vorbiscomment']['genre'][0];
- } // if flac
-
- elseif($this->info['fileformat'] === 'mp4') {
-
- if (function_exists('iconv')) {
- $this->result['m4a']['title'] = iconv("UTF-8","ISO-8859-1", $this->info['tags']['quicktime']['title'][0]);
- $this->result['m4a']['artist'] = iconv("UTF-8","ISO-8859-1", $this->info['tags']['quicktime']['artist'][0]);
- $this->result['m4a']['album'] = iconv("UTF-8","ISO-8859-1", $this->info['tags']['quicktime']['album'][0]);
- $this->result['m4a']['comment'] = iconv("UTF-8","ISO-8859-1", $this->info['tags']['quicktime']['comment'][0]);
- }
- else {
- $this->result['m4a']['title'] = $this->info['tags']['quicktime']['title'][0];
- $this->result['m4a']['artist'] = $this->info['tags']['quicktime']['artist'][0];
- $this->result['m4a']['album'] = $this->info['tags']['quicktime']['album'][0];
- $this->result['m4a']['comment'] = $this->info['tags']['quicktime']['comment'][0];
- }
-
- $this->result['m4a']['year'] = $this->info['tags']['quicktime']['creation_date'][0];
-
-
- } // if m4a
-
-
- elseif($this->info['fileformat'] === 'mpc') {
-
- if (function_exists('iconv')) {
- $this->result['mpc']['title'] = iconv("UTF-8","ISO-8859-1", $this->info['tags']['ape']['title'][0]);
- $this->result['mpc']['artist'] = iconv("UTF-8","ISO-8859-1", $this->info['tags']['ape']['artist'][0]);
- $this->result['mpc']['album'] = iconv("UTF-8","ISO-8859-1", $this->info['tags']['ape']['album'][0]);
- $this->result['mpc']['comment'] = iconv("UTF-8","ISO-8859-1", $this->info['tags']['ape']['comment'][0]);
- }
- else {
- $this->result['mpc']['title'] = $this->info['tags']['ape']['title'][0];
- $this->result['mpc']['artist'] = $this->info['tags']['ape']['artist'][0];
- $this->result['mpc']['album'] = $this->info['tags']['ape']['album'][0];
- $this->result['mpc']['comment'] = $this->info['tags']['ape']['comment'][0];
- }
-
- $this->result['mpc']['year'] = $this->info['tags']['ape']['year'][0];
- $this->result['mpc']['track'] = $this->info['tags']['ape']['track'][0];
- $this->result['mpc']['genre'] = $this->info['tags']['ape']['genre'][0];
-
- } // if mpc
-
-
- // Post getID3() data handling based on file format
- $method = @$this->info['fileformat'].'Info';
- if (@$this->info['fileformat'] && method_exists($this, $method)) {
- $this->$method();
- }
-
- return $this->result;
- }
-
-
-
-
-
- /**
- * post-getID3() data handling for AAC files.
- *
- * @access private
- */
-
- function aacInfo() {
- $this->result['format_name'] = 'AAC';
- }
-
-
-
-
- /**
- * post-getID3() data handling for Wave files.
- *
- * @access private
- */
-
- function riffInfo() {
- if ($this->info['audio']['dataformat'] == 'wav') {
-
- $this->result['format_name'] = 'Wave';
-
- } else if (ereg('^mp[1-3]$', $this->info['audio']['dataformat'])) {
-
- $this->result['format_name'] = strtoupper($this->info['audio']['dataformat']);
-
- } else {
-
- $this->result['format_name'] = 'riff/'.$this->info['audio']['dataformat'];
-
- }
- }
-
-
-
-
- /**
- * * post-getID3() data handling for FLAC files.
- *
- * @access private
- */
-
- function flacInfo() {
- $this->result['format_name'] = 'FLAC';
- }
-
-
-
-
-
- /**
- * post-getID3() data handling for Monkey's Audio files.
- *
- * @access private
- */
-
- function macInfo() {
- $this->result['format_name'] = 'Monkey\'s Audio';
- }
-
-
-
-
-
- /**
- * post-getID3() data handling for Lossless Audio files.
- *
- * @access private
- */
-
- function laInfo() {
- $this->result['format_name'] = 'La';
- }
-
-
-
-
-
- /**
- * post-getID3() data handling for Ogg Vorbis files.
- *
- * @access private
- */
-
- function oggInfo() {
- if ($this->info['audio']['dataformat'] == 'vorbis') {
-
- $this->result['format_name'] = 'Ogg Vorbis';
-
- } else if ($this->info['audio']['dataformat'] == 'flac') {
-
- $this->result['format_name'] = 'Ogg FLAC';
-
- } else if ($this->info['audio']['dataformat'] == 'speex') {
-
- $this->result['format_name'] = 'Ogg Speex';
-
- } else {
-
- $this->result['format_name'] = 'Ogg '.$this->info['audio']['dataformat'];
-
- }
- }
-
-
-
-
- /**
- * post-getID3() data handling for Musepack files.
- *
- * @access private
- */
-
- function mpcInfo() {
- $this->result['format_name'] = 'Musepack';
- }
-
-
-
-
- /**
- * post-getID3() data handling for MPEG files.
- *
- * @access private
- */
-
- function mp3Info() {
- $this->result['format_name'] = 'MP3';
- }
-
-
-
-
- /**
- * post-getID3() data handling for MPEG files.
- *
- * @access private
- */
-
- function mp2Info() {
- $this->result['format_name'] = 'MP2';
- }
-
-
-
-
-
- /**
- * post-getID3() data handling for MPEG files.
- *
- * @access private
- */
-
- function mp1Info() {
- $this->result['format_name'] = 'MP1';
- }
-
-
-
-
- /**
- * post-getID3() data handling for WMA files.
- *
- * @access private
- */
-
- function asfInfo() {
- $this->result['format_name'] = strtoupper($this->info['audio']['dataformat']);
- }
-
-
-
- /**
- * post-getID3() data handling for Real files.
- *
- * @access private
- */
-
- function realInfo() {
- $this->result['format_name'] = 'Real';
- }
-
-
-
-
-
- /**
- * post-getID3() data handling for VQF files.
- *
- * @access private
- */
-
- function vqfInfo() {
- $this->result['format_name'] = 'VQF';
- }
-
-}
-
-
-?>
diff --git a/modules/id3/vainfo.class.php b/modules/id3/vainfo.class.php
index 46cc8943..92cdeb0c 100755
--- a/modules/id3/vainfo.class.php
+++ b/modules/id3/vainfo.class.php
@@ -1,9 +1,24 @@
<?php
-/**
- * Load the Getid3 Library
- */
-require_once(conf('prefix') . '/modules/id3/getid3/getid3.php');
+/*
+
+ Copyright (c) 2001 - 2006 Ampache.org
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
/**
* vainfo
@@ -23,21 +38,30 @@ class vainfo {
/* Internal Information */
- var $_raw = array();
- var $_getID3 = '';
- var $_iconv = false;
+ var $_raw = array();
+ var $_getID3 = '';
+ var $_iconv = false;
+ var $_file_pattern = '';
+ var $_dir_pattern = '';
/**
* Constructor
* This function just sets up the class, it doesn't
* actually pull the information
*/
- function vainfo($file,$encoding='') {
+ function vainfo($file,$encoding='',$dir_pattern,$file_pattern) {
$this->filename = stripslashes($file);
if ($encoding) {
$this->encoding = $encoding;
}
+ else {
+ $this->encoding = conf('site_charset');
+ }
+
+ /* These are needed for the filename mojo */
+ $this->_file_pattern = $file_pattern;
+ $this->_dir_pattern = $dir_pattern;
// Initialize getID3 engine
$this->_getID3 = new getID3();
@@ -70,14 +94,14 @@ class vainfo {
$this->type = $this->_get_type();
/* Get the general information about this file */
- $this->info = $this->_get_info();
+ $info = $this->_get_info();
/* Gets the Tags */
$this->tags = $this->_get_tags();
+ $this->tags['info'] = $info;
unset($this->_raw);
-
-print_r($this);
+
} // get_info
/**
@@ -145,6 +169,9 @@ print_r($this);
} // end foreach
+ /* Gather Tag information from the filenames */
+ $results['file'] = $this->_parse_filename($this->filename);
+
return $results;
} // _get_tags
@@ -205,6 +232,9 @@ print_r($this);
case 'flac':
return 'flac';
break;
+ case 'vorbis':
+ return 'ogg';
+ break;
default:
/* Log the fact that we couldn't figure it out */
debug_event('vainfo','Unable to determine file type from ' . $type . ' on file ' . $this->filename,'5');
@@ -233,6 +263,9 @@ print_r($this);
case 'tracknumber':
$array['track'] = $this->_clean_tag($data['0']);
break;
+ case 'date':
+ $array['year'] = $this->_clean_tag($data['0']);
+ break;
} // end switch
$array[$tag] = $this->_clean_tag($data['0']);
@@ -251,7 +284,19 @@ print_r($this);
*/
function _parse_id3v1($tags) {
+ $array = array();
+
+ /* Go through all the tags */
+ foreach ($tags as $tag=>$data) {
+ /* This is our baseline for naming
+ * so no translation needed
+ */
+ $array[$tag] = $this->_clean_tag($data['0']);
+
+ } // end foreach
+
+ return $array;
} // _parse_id3v1
@@ -262,9 +307,20 @@ print_r($this);
* pretty little format
*/
function _parse_id3v2($tags) {
+
+ $array = array();
+ /* Go through the tags */
+ foreach ($tags as $tag=>$data) {
+
+ /* This is our baseline for naming so
+ * no translation is needed
+ */
+ $array[$tag] = $this->_clean_tag($data['0']);
+
+ } // end foreach
-
+ return $array;
} // _parse_id3v2
@@ -292,15 +348,41 @@ print_r($this);
} // _parse_quicktime
+
+ /**
+ * _parse_filename
+ * This function uses the passed file and dir patterns
+ * To pull out extra tag information and populate it into
+ * it's own array
+ */
+ function _parse_filename($filename) {
+
+ /* Currently Broken */
+ return array();
+
+ $pattern = $this->_dir_pattern . $this->_file_pattern;
+ preg_match_all("/\%\w/",$pattern,$elements);
+
+ $preg_pattern = preg_replace("/\%\w/","(.+)",$pattern);
+ $preg_pattern .= "\..+$";
+ preg_match($preg_pattern,$filename,$matches);
+
+
+ } // _parse_filename
+
/**
* _clean_tag
* This function cleans up the tag that it's passed using Iconv
- * if we've got it
+ * if we've got it. It also takes an optional encoding param
+ * for the cases where we know what the tags source encoding
+ * is, and or if it's different then the encoding recorded
+ * in the file
*/
- function _clean_tag($tag) {
+ function _clean_tag($tag,$encoding='') {
- if ($this->_iconv) {
-
+
+ if ($this->_iconv AND $this->encoding != $encoding) {
+ $tag = iconv('UTF-8','ISO-8859-1',$tag);
}
return $tag;
diff --git a/modules/init.php b/modules/init.php
index 8ea8f64d..96b99a21 100644
--- a/modules/init.php
+++ b/modules/init.php
@@ -80,7 +80,7 @@ if (!$results['allow_stream_playback']) {
/** This is the version.... fluf nothing more... **/
-$results['version'] = '3.3.2-Beta3 (Build 007)';
+$results['version'] = '3.3.2-Beta3 (Build 008)';
$results['raw_web_path'] = $results['web_path'];
$results['web_path'] = $http_type . $_SERVER['HTTP_HOST'] . $results['web_path'];
@@ -154,7 +154,7 @@ require_once(conf('prefix') . '/lib/upload.php');
require_once(conf('prefix') . '/modules/lib.php');
require_once(conf('prefix') . '/modules/admin.php');
require_once(conf('prefix') . '/modules/catalog.php');
-require_once(conf('prefix') . '/modules/id3/audioinfo.class.php');
+require_once(conf('prefix') . "/modules/id3/getid3/getid3.php");
require_once(conf('prefix') . '/modules/id3/vainfo.class.php');
require_once(conf('prefix') . '/modules/amazon/Snoopy.class.php');
require_once(conf('prefix') . '/modules/amazon/AmazonSearchEngine.class.php');