3 /////////////////////////////////////////////////////////////////
4 /// getID3() by James Heinrich <info@getid3.org> //
5 // available at https://github.com/JamesHeinrich/getID3 //
6 // or https://www.getid3.org //
7 // or http://getid3.sourceforge.net //
8 // see readme.txt for more details //
9 /////////////////////////////////////////////////////////////////
11 // module.archive.rar.php //
12 // module for analyzing RAR files //
13 // dependencies: NONE //
15 /////////////////////////////////////////////////////////////////
18 class getid3_rar
extends getid3_handler
23 public $option_use_rar_extension = false;
28 public function Analyze() {
29 $info = &$this->getid3
->info
;
31 $info['fileformat'] = 'rar';
33 if ($this->option_use_rar_extension
=== true) {
34 if (function_exists('rar_open')) {
35 if ($rp = rar_open($info['filenamepath'])) {
36 $info['rar']['files'] = array();
37 $entries = rar_list($rp);
38 foreach ($entries as $entry) {
39 $info['rar']['files'] = getid3_lib
::array_merge_clobber($info['rar']['files'], getid3_lib
::CreateDeepArray($entry->getName(), '/', $entry->getUnpackedSize()));
44 $this->error('failed to rar_open('.$info['filename'].')');
47 $this->error('RAR support does not appear to be available in this PHP installation');
50 $this->error('PHP-RAR processing has been disabled (set $getid3_rar->option_use_rar_extension=true to enable)');