Ticket #285: autotagconvert.patch
| File autotagconvert.patch, 3.1 kB (added by momo-i, 5 months ago) |
|---|
-
catalog.class.php
1074 1074 /* Record the reading of these tags */ 1075 1075 debug_event('tag-read',"Reading Tags from $song->file",'5','ampache-catalog'); 1076 1076 1077 $vainfo = new vainfo($song->file,'', $sort_pattern,$rename_pattern);1077 $vainfo = new vainfo($song->file,'','','',$sort_pattern,$rename_pattern); 1078 1078 $vainfo->get_info(); 1079 1079 1080 1080 /* Find the correct key */ … … 2000 2000 public function insert_local_song($file,$file_info) { 2001 2001 2002 2002 /* Create the vainfo object and get info */ 2003 $vainfo = new vainfo($file,'', $this->sort_pattern,$this->rename_pattern);2003 $vainfo = new vainfo($file,'','','',$this->sort_pattern,$this->rename_pattern); 2004 2004 $vainfo->get_info(); 2005 2005 2006 2006 $key = get_tag_type($vainfo->tags); -
vainfo.class.php
27 27 class vainfo { 28 28 29 29 /* Default Encoding */ 30 var $encoding = ''; 30 var $encoding = 'UTF-8'; 31 var $encoding_id3v1 = ''; 32 var $encoding_id3v2 = ''; 31 33 32 34 /* Loaded Variables */ 33 35 var $filename = ''; … … 36 38 37 39 /* Internal Information */ 38 40 var $_raw = array(); 41 var $_raw2 = array(); 39 42 var $_getID3 = ''; 40 43 var $_iconv = false; 41 44 var $_file_encoding = ''; … … 47 50 * This function just sets up the class, it doesn't 48 51 * actually pull the information 49 52 */ 50 function vainfo($file,$encoding=' ',$dir_pattern,$file_pattern) {53 function vainfo($file,$encoding='UTF-8',$encoding_id3v1='',$encoding_id3v2='',$dir_pattern,$file_pattern) { 51 54 52 55 $this->filename = $file; 53 56 if ($encoding) { … … 63 66 64 67 // Initialize getID3 engine 65 68 $this->_getID3 = new getID3(); 69 70 // get id3tag encodings 71 $this->_raw2 = $this->_getID3->analyze($file); 72 if(function_exsits('mb_detect_encoding')) { 73 if(mb_detect_encoding($this->_raw2['tags']['id3v1']['title']['0'])) { 74 $this->encoding_id3v1 = mb_detect_encoding($this->_raw2['tags']['id3v1']['title']['0']); 75 } 76 else { 77 $this->encoding_id3v1 = $encoding_id3v1; 78 } 79 if(mb_detect_encoding($this->_raw2['tags']['id3v2']['title']['0'])) { 80 $this->encoding_id3v2 = mb_detect_encoding($this->_raw2['tags']['id3v2']['title']['0']); 81 } 82 else { 83 $this->encoding_id3v2 = $encoding_id3v2; 84 } 85 } 86 else { 87 $this->encoding_id3v1 = $encoding_id3v1; 88 $this->encoding_id3v2 = $encoding_id3v2; 89 } 90 66 91 $this->_getID3->option_md5_data = false; 67 92 $this->_getID3->option_md5_data_source = false; 68 93 $this->_getID3->option_tags_html = false; 69 94 $this->_getID3->option_extra_info = false; 70 95 $this->_getID3->option_tag_lyrics3 = false; 71 96 $this->_getID3->encoding = $this->encoding; 97 $this->_getID3->encoding_id3v1 = $this->encoding_id3v1; 98 $this->_getID3->encoding_id3v2 = $this->encoding_id3v2; 72 99 $this->_getID3->option_tags_process = true; 73 100 74 101 /* Check for ICONV */
