diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-06-22 00:54:20 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-06-22 00:54:20 +0000 |
commit | bba84d172a89e5621c29f2e4359d87bb09f346ff (patch) | |
tree | 83b9f02bbcb15d7df0bd3b9b40b800fa8b4984b3 | |
parent | 0f5c3ddf3aa9e75289af56536806c220fec5d776 (diff) | |
download | ampache-bba84d172a89e5621c29f2e4359d87bb09f346ff.tar.gz ampache-bba84d172a89e5621c29f2e4359d87bb09f346ff.tar.bz2 ampache-bba84d172a89e5621c29f2e4359d87bb09f346ff.zip |
last commit before beta3 release
-rwxr-xr-x | docs/CHANGELOG | 3 | ||||
-rw-r--r-- | lib/general.lib.php | 25 | ||||
-rw-r--r-- | lib/init.php | 2 | ||||
-rwxr-xr-x | modules/id3/vainfo.class.php | 22 |
4 files changed, 46 insertions, 6 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 651e168c..dac099f5 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,9 @@ -------------------------------------------------------------------------- v.3.3.2-Beta3 + - Fixed file-based parsing so that it can now be given priority + over the tags in the files using tag_order in the config + file - Fixed Nowplaying, now div based layout and AJAX refreshed based on config files refresh_limit - Moved /modules/init.php to /lib/init.php diff --git a/lib/general.lib.php b/lib/general.lib.php index 085f33af..b8e8d1e8 100644 --- a/lib/general.lib.php +++ b/lib/general.lib.php @@ -932,4 +932,29 @@ return sprintf ("%d:%02d", $seconds/60, $seconds % 60); } //format_time +/** + * translate_pattern_code + * This just contains a key'd array which it checks against to give you the 'tag' name + * that said pattern code corrasponds to, it returns false if nothing is found + */ +function translate_pattern_code($code) { + + $code_array = array('%A'=>'album', + '%a'=>'artist', + '%c'=>'comment', + '%g'=>'genre', + '%T'=>'track', + '%t'=>'title', + '%y'=>'year', + '%o'=>'zz_other'); + + if (isset($code_array[$code])) { + return $code_array[$code]; + } + + + return false; + +} // translate_pattern_code + ?> diff --git a/lib/init.php b/lib/init.php index 8a97f5c9..45d71625 100644 --- a/lib/init.php +++ b/lib/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 009)'; +$results['version'] = '3.3.2-Beta3'; $results['raw_web_path'] = $results['web_path']; $results['web_path'] = $http_type . $_SERVER['HTTP_HOST'] . $results['web_path']; diff --git a/modules/id3/vainfo.class.php b/modules/id3/vainfo.class.php index 94366c20..81b96446 100755 --- a/modules/id3/vainfo.class.php +++ b/modules/id3/vainfo.class.php @@ -383,16 +383,28 @@ class vainfo { */ function _parse_filename($filename) { - /* Currently Broken */ - return array(); + $results = array(); $pattern = $this->_dir_pattern . $this->_file_pattern; preg_match_all("/\%\w/",$pattern,$elements); - - $preg_pattern = preg_replace("/\%\w/","(.+)",$pattern); - $preg_pattern .= "\..+$"; + + $preg_pattern = preg_quote($pattern); + $preg_pattern = preg_replace("/\%\w/","(.+)",$preg_pattern); + $preg_pattern = str_replace("/","\/",$preg_pattern); + $preg_pattern = "/" . $preg_pattern . "\..+$/"; preg_match($preg_pattern,$filename,$matches); + /* Cut out the Full line, we don't need that */ + array_shift($matches); + /* Foreach through what we've found */ + foreach ($matches as $key=>$value) { + $new_key = translate_pattern_code($elements['0'][$key]); + if ($new_key) { + $results[$new_key] = $value; + } + } // end foreach matches + + return $results; } // _parse_filename |