ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
getid3_cue Class Reference

getID3() by James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g // More...

+ Inheritance diagram for getid3_cue:
+ Collaboration diagram for getid3_cue:

Public Member Functions

 Analyze ()
 
 readCueSheetFilename ($filename)
 
 readCueSheet (&$filedata)
 Parses a cue sheet file. More...
 
 parseCueSheet ($file)
 Parses the cue sheet array. More...
 
 parseComment ($line, $track_on)
 Parses the REM command. More...
 
 parseFile ($line)
 Parses the FILE command. More...
 
 parseFlags ($line, $track_on)
 Parses the FLAG command. More...
 
 parseGarbage ($line, $track_on)
 Collect any unidentified data. More...
 
 parseIndex ($line, $track_on)
 Parses the INDEX command of a TRACK. More...
 
 parseString ($line, $track_on)
 
 parseTrack ($line, $track_on)
 Parses the TRACK command. More...
 
- Public Member Functions inherited from getid3_handler
 __construct (getID3 $getid3, $call_module=null)
 
 Analyze ()
 
 AnalyzeString ($string)
 
 setStringMode ($string)
 
 saveAttachment ($name, $offset, $length, $image_mime=null)
 

Data Fields

 $cuesheet = array()
 

Additional Inherited Members

- Protected Member Functions inherited from getid3_handler
 ftell ()
 
 fread ($bytes)
 
 fseek ($bytes, $whence=SEEK_SET)
 
 feof ()
 
 isDependencyFor ($module)
 
 error ($text)
 
 warning ($text)
 
 notice ($text)
 
- Protected Attributes inherited from getid3_handler
 $getid3
 
 $data_string_flag = false
 
 $data_string = ''
 
 $data_string_position = 0
 
 $data_string_length = 0
 

Detailed Description

getID3() by James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g //

A CueSheet class used to open and parse cuesheets.

Definition at line 34 of file module.misc.cue.php.

Member Function Documentation

◆ Analyze()

getid3_cue::Analyze ( )

Reimplemented from getid3_handler.

Definition at line 38 of file module.misc.cue.php.

38 {
39 $info = &$this->getid3->info;
40
41 $info['fileformat'] = 'cue';
42 $this->readCueSheetFilename($info['filenamepath']);
43 $info['cue'] = $this->cuesheet;
44 return true;
45 }
readCueSheetFilename($filename)
$info
Definition: example_052.php:80

References $cuesheet, $info, and readCueSheetFilename().

+ Here is the call graph for this function:

◆ parseComment()

getid3_cue::parseComment (   $line,
  $track_on 
)

Parses the REM command.

Parameters
string$line- The line in the cue file that contains the TRACK command.
integer$track_on- The track currently processing.

Definition at line 133 of file module.misc.cue.php.

134 {
135 $explodedline = explode(' ', $line, 3);
136 $comment_REM = (isset($explodedline[0]) ? $explodedline[0] : '');
137 $comment_type = (isset($explodedline[1]) ? $explodedline[1] : '');
138 $comment_data = (isset($explodedline[2]) ? $explodedline[2] : '');
139 if (($comment_REM == 'REM') && $comment_type) {
140 $comment_type = strtolower($comment_type);
141 $commment_data = trim($comment_data, ' "');
142 if ($track_on != -1) {
143 $this->cuesheet['tracks'][$track_on]['comments'][$comment_type][] = $comment_data;
144 } else {
145 $this->cuesheet['comments'][$comment_type][] = $comment_data;
146 }
147 }
148 }

Referenced by parseCueSheet().

+ Here is the caller graph for this function:

◆ parseCueSheet()

getid3_cue::parseCueSheet (   $file)

Parses the cue sheet array.

Parameters
array$file- The cuesheet as an array of each line.

Definition at line 79 of file module.misc.cue.php.

80 {
81 //-1 means still global, all others are track specific
82 $track_on = -1;
83
84 for ($i=0; $i < count($file); $i++)
85 {
86 list($key) = explode(' ', strtolower($file[$i]), 2);
87 switch ($key)
88 {
89 case 'catalog':
90 case 'cdtextfile':
91 case 'isrc':
92 case 'performer':
93 case 'songwriter':
94 case 'title':
95 $this->parseString($file[$i], $track_on);
96 break;
97 case 'file':
98 $currentFile = $this->parseFile($file[$i]);
99 break;
100 case 'flags':
101 $this->parseFlags($file[$i], $track_on);
102 break;
103 case 'index':
104 case 'postgap':
105 case 'pregap':
106 $this->parseIndex($file[$i], $track_on);
107 break;
108 case 'rem':
109 $this->parseComment($file[$i], $track_on);
110 break;
111 case 'track':
112 $track_on++;
113 $this->parseTrack($file[$i], $track_on);
114 if (isset($currentFile)) // if there's a file
115 {
116 $this->cuesheet['tracks'][$track_on]['datafile'] = $currentFile;
117 }
118 break;
119 default:
120 //save discarded junk and place string[] with track it was found in
121 $this->parseGarbage($file[$i], $track_on);
122 break;
123 }
124 }
125 }
print $file
parseComment($line, $track_on)
Parses the REM command.
parseTrack($line, $track_on)
Parses the TRACK command.
parseString($line, $track_on)
parseIndex($line, $track_on)
Parses the INDEX command of a TRACK.
parseFile($line)
Parses the FILE command.
parseGarbage($line, $track_on)
Collect any unidentified data.
parseFlags($line, $track_on)
Parses the FLAG command.

References $file, parseComment(), parseFile(), parseFlags(), parseGarbage(), parseIndex(), parseString(), and parseTrack().

Referenced by readCueSheet().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseFile()

getid3_cue::parseFile (   $line)

Parses the FILE command.

Parameters
string$line- The line in the cue file that contains the FILE command.
Returns
array - Array of FILENAME and TYPE of file..

Definition at line 156 of file module.misc.cue.php.

157 {
158 $line = substr($line, strpos($line, ' ') + 1);
159 $type = strtolower(substr($line, strrpos($line, ' ')));
160
161 //remove type
162 $line = substr($line, 0, strrpos($line, ' ') - 1);
163
164 //if quotes around it, remove them.
165 $line = trim($line, '"');
166
167 return array('filename'=>$line, 'type'=>$type);
168 }

Referenced by parseCueSheet().

+ Here is the caller graph for this function:

◆ parseFlags()

getid3_cue::parseFlags (   $line,
  $track_on 
)

Parses the FLAG command.

Parameters
string$line- The line in the cue file that contains the TRACK command.
integer$track_on- The track currently processing.

Definition at line 176 of file module.misc.cue.php.

177 {
178 if ($track_on != -1)
179 {
180 foreach (explode(' ', strtolower($line)) as $type)
181 {
182 switch ($type)
183 {
184 case 'flags':
185 // first entry in this line
186 $this->cuesheet['tracks'][$track_on]['flags'] = array(
187 '4ch' => false,
188 'data' => false,
189 'dcp' => false,
190 'pre' => false,
191 'scms' => false,
192 );
193 break;
194 case 'data':
195 case 'dcp':
196 case '4ch':
197 case 'pre':
198 case 'scms':
199 $this->cuesheet['tracks'][$track_on]['flags'][$type] = true;
200 break;
201 default:
202 break;
203 }
204 }
205 }
206 }

Referenced by parseCueSheet().

+ Here is the caller graph for this function:

◆ parseGarbage()

getid3_cue::parseGarbage (   $line,
  $track_on 
)

Collect any unidentified data.

Parameters
string$line- The line in the cue file that contains the TRACK command.
integer$track_on- The track currently processing.

Definition at line 214 of file module.misc.cue.php.

215 {
216 if ( strlen($line) > 0 )
217 {
218 if ($track_on == -1)
219 {
220 $this->cuesheet['garbage'][] = $line;
221 }
222 else
223 {
224 $this->cuesheet['tracks'][$track_on]['garbage'][] = $line;
225 }
226 }
227 }

Referenced by parseCueSheet().

+ Here is the caller graph for this function:

◆ parseIndex()

getid3_cue::parseIndex (   $line,
  $track_on 
)

Parses the INDEX command of a TRACK.

Parameters
string$line- The line in the cue file that contains the TRACK command.
integer$track_on- The track currently processing.

Definition at line 235 of file module.misc.cue.php.

236 {
237 $type = strtolower(substr($line, 0, strpos($line, ' ')));
238 $line = substr($line, strpos($line, ' ') + 1);
239
240 if ($type == 'index')
241 {
242 //read the index number
243 $number = intval(substr($line, 0, strpos($line, ' ')));
244 $line = substr($line, strpos($line, ' ') + 1);
245 }
246
247 //extract the minutes, seconds, and frames
248 $explodedline = explode(':', $line);
249 $minutes = (isset($explodedline[0]) ? $explodedline[0] : '');
250 $seconds = (isset($explodedline[1]) ? $explodedline[1] : '');
251 $frames = (isset($explodedline[2]) ? $explodedline[2] : '');
252
253 switch ($type) {
254 case 'index':
255 $this->cuesheet['tracks'][$track_on][$type][$number] = array('minutes'=>intval($minutes), 'seconds'=>intval($seconds), 'frames'=>intval($frames));
256 break;
257 case 'pregap':
258 case 'postgap':
259 $this->cuesheet['tracks'][$track_on][$type] = array('minutes'=>intval($minutes), 'seconds'=>intval($seconds), 'frames'=>intval($frames));
260 break;
261 }
262 }

Referenced by parseCueSheet().

+ Here is the caller graph for this function:

◆ parseString()

getid3_cue::parseString (   $line,
  $track_on 
)

Definition at line 264 of file module.misc.cue.php.

265 {
266 $category = strtolower(substr($line, 0, strpos($line, ' ')));
267 $line = substr($line, strpos($line, ' ') + 1);
268
269 //get rid of the quotes
270 $line = trim($line, '"');
271
272 switch ($category)
273 {
274 case 'catalog':
275 case 'cdtextfile':
276 case 'isrc':
277 case 'performer':
278 case 'songwriter':
279 case 'title':
280 if ($track_on == -1)
281 {
282 $this->cuesheet[$category] = $line;
283 }
284 else
285 {
286 $this->cuesheet['tracks'][$track_on][$category] = $line;
287 }
288 break;
289 default:
290 break;
291 }
292 }

Referenced by parseCueSheet().

+ Here is the caller graph for this function:

◆ parseTrack()

getid3_cue::parseTrack (   $line,
  $track_on 
)

Parses the TRACK command.

Parameters
string$line- The line in the cue file that contains the TRACK command.
integer$track_on- The track currently processing.

Definition at line 300 of file module.misc.cue.php.

301 {
302 $line = substr($line, strpos($line, ' ') + 1);
303 $track = ltrim(substr($line, 0, strpos($line, ' ')), '0');
304
305 //find the data type.
306 $datatype = strtolower(substr($line, strpos($line, ' ') + 1));
307
308 $this->cuesheet['tracks'][$track_on] = array('track_number'=>$track, 'datatype'=>$datatype);
309 }

Referenced by parseCueSheet().

+ Here is the caller graph for this function:

◆ readCueSheet()

getid3_cue::readCueSheet ( $filedata)

Parses a cue sheet file.

Parameters
string$filename- The filename for the cue sheet to open.

Definition at line 59 of file module.misc.cue.php.

60 {
61 $cue_lines = array();
62 foreach (explode("\n", str_replace("\r", null, $filedata)) as $line)
63 {
64 if ( (strlen($line) > 0) && ($line[0] != '#'))
65 {
66 $cue_lines[] = trim($line);
67 }
68 }
69 $this->parseCueSheet($cue_lines);
70
71 return $this->cuesheet;
72 }
parseCueSheet($file)
Parses the cue sheet array.

References $cuesheet, and parseCueSheet().

Referenced by readCueSheetFilename().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readCueSheetFilename()

getid3_cue::readCueSheetFilename (   $filename)

Definition at line 49 of file module.misc.cue.php.

50 {
51 $filedata = file_get_contents($filename);
52 return $this->readCueSheet($filedata);
53 }
$filename
Definition: buildRTE.php:89
readCueSheet(&$filedata)
Parses a cue sheet file.

References $filename, and readCueSheet().

Referenced by Analyze().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $cuesheet

getid3_cue::$cuesheet = array()

Definition at line 36 of file module.misc.cue.php.

Referenced by Analyze(), and readCueSheet().


The documentation for this class was generated from the following file: