~ubuntu-branches/debian/sid/ampache/sid

« back to all changes in this revision

Viewing changes to modules/getid3/module.audio.mod.php

  • Committer: Package Import Robot
  • Author(s): Charlie Smotherman
  • Date: 2013-08-27 13:19:48 UTC
  • mfrom: (1.2.9)
  • Revision ID: package-import@ubuntu.com-20130827131948-1czew0zxn6u70dtv
Tags: 3.6-rzb2752+dfsg-1
* New upsteam snapshot.  Contains important bug fixes to the installer.
* Correct typo in ampache-common.postrm.
* Remove courtousy copy of php-getid3, during repack.  Closes: #701526
* Update package to use dh_linktree to make the needed sym links to the
  needed system libs that were removed during repack.
* Update debian/rules to reflect upstreams removing/moving of modules.
* Update debian/ampache-common.install to reflect upstreams removal of files.
* Updated to use new apache2.4 API. Closes: #669756
* Updated /debian/po/de.po thx David Prévot for the patch.  Closes:  #691963
* M3U import is now ordered, fixed upstream.  Closes: #684984
* Text input area has been resized so IPv6 addresses will now fit, fixed
  upstream.  Closes:  #716230
* Added ampache-common.preinst to make sure that the courtousy copies of code
  dirs are empty so dh_linktree can do it's magic on upgrades.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
/////////////////////////////////////////////////////////////////
3
 
/// getID3() by James Heinrich <info@getid3.org>               //
4
 
//  available at http://getid3.sourceforge.net                 //
5
 
//            or http://www.getid3.org                         //
6
 
/////////////////////////////////////////////////////////////////
7
 
// See readme.txt for more details                             //
8
 
/////////////////////////////////////////////////////////////////
9
 
//                                                             //
10
 
// module.audio.mod.php                                        //
11
 
// module for analyzing MOD Audio files                        //
12
 
// dependencies: NONE                                          //
13
 
//                                                            ///
14
 
/////////////////////////////////////////////////////////////////
15
 
 
16
 
 
17
 
class getid3_mod extends getid3_handler
18
 
{
19
 
 
20
 
        function Analyze() {
21
 
                $info = &$this->getid3->info;
22
 
                fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
23
 
                $fileheader = fread($this->getid3->fp, 1088);
24
 
                if (preg_match('#^IMPM#', $fileheader)) {
25
 
                        return $this->getITheaderFilepointer();
26
 
                } elseif (preg_match('#^Extended Module#', $fileheader)) {
27
 
                        return $this->getXMheaderFilepointer();
28
 
                } elseif (preg_match('#^.{44}SCRM#', $fileheader)) {
29
 
                        return $this->getS3MheaderFilepointer();
30
 
                } elseif (preg_match('#^.{1080}(M\\.K\\.|M!K!|FLT4|FLT8|[5-9]CHN|[1-3][0-9]CH)#', $fileheader)) {
31
 
                        return $this->getMODheaderFilepointer();
32
 
                }
33
 
                $info['error'][] = 'This is not a known type of MOD file';
34
 
                return false;
35
 
        }
36
 
 
37
 
 
38
 
        function getMODheaderFilepointer() {
39
 
                $info = &$this->getid3->info;
40
 
                fseek($this->getid3->fp, $info['avdataoffset'] + 1080);
41
 
                $FormatID = fread($this->getid3->fp, 4);
42
 
                if (!preg_match('#^(M.K.|[5-9]CHN|[1-3][0-9]CH)$#', $FormatID)) {
43
 
                        $info['error'][] = 'This is not a known type of MOD file';
44
 
                        return false;
45
 
                }
46
 
 
47
 
                $info['fileformat'] = 'mod';
48
 
 
49
 
                $info['error'][] = 'MOD parsing not enabled in this version of getID3() ['.$this->getid3->version().']';
50
 
                return false;
51
 
        }
52
 
 
53
 
        function getXMheaderFilepointer() {
54
 
                $info = &$this->getid3->info;
55
 
                fseek($this->getid3->fp, $info['avdataoffset']);
56
 
                $FormatID = fread($this->getid3->fp, 15);
57
 
                if (!preg_match('#^Extended Module$#', $FormatID)) {
58
 
                        $info['error'][] = 'This is not a known type of XM-MOD file';
59
 
                        return false;
60
 
                }
61
 
 
62
 
                $info['fileformat'] = 'xm';
63
 
 
64
 
                $info['error'][] = 'XM-MOD parsing not enabled in this version of getID3() ['.$this->getid3->version().']';
65
 
                return false;
66
 
        }
67
 
 
68
 
        function getS3MheaderFilepointer() {
69
 
                $info = &$this->getid3->info;
70
 
                fseek($this->getid3->fp, $info['avdataoffset'] + 44);
71
 
                $FormatID = fread($this->getid3->fp, 4);
72
 
                if (!preg_match('#^SCRM$#', $FormatID)) {
73
 
                        $info['error'][] = 'This is not a ScreamTracker MOD file';
74
 
                        return false;
75
 
                }
76
 
 
77
 
                $info['fileformat'] = 's3m';
78
 
 
79
 
                $info['error'][] = 'ScreamTracker parsing not enabled in this version of getID3() ['.$this->getid3->version().']';
80
 
                return false;
81
 
        }
82
 
 
83
 
        function getITheaderFilepointer() {
84
 
                $info = &$this->getid3->info;
85
 
                fseek($this->getid3->fp, $info['avdataoffset']);
86
 
                $FormatID = fread($this->getid3->fp, 4);
87
 
                if (!preg_match('#^IMPM$#', $FormatID)) {
88
 
                        $info['error'][] = 'This is not an ImpulseTracker MOD file';
89
 
                        return false;
90
 
                }
91
 
 
92
 
                $info['fileformat'] = 'it';
93
 
 
94
 
                $info['error'][] = 'ImpulseTracker parsing not enabled in this version of getID3() ['.$this->getid3->version().']';
95
 
                return false;
96
 
        }
97
 
 
98
 
}
99
 
 
100
 
 
101
 
?>
 
 
b'\\ No newline at end of file'