MP3_Playlist
[ class tree: MP3_Playlist ] [ index: MP3_Playlist ] [ all elements ]

Class: MP3_Playlist

Source Location: /MP3_Playlist-0.5.2/MP3/Playlist.php

Class Overview


Class MP3_Playlist


Author(s):

Version:

  • Release: 0.5.2

Copyright:

  • 2004-2005 David Costa

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 82]
Class MP3_Playlist

A playlist can be used for both local use and remote streaming.

The m3u playlist format is supported by Winamp, XMMS, Noatunes and several other players.

The Smil playlist format is supported by Real Media Player, Quicktime and others XHTML allows you to display a fully formatted page or just the tables to be included in your own template.

RSS allows you to syndicate the playlist on the fly. The Sqlite function allows you to backup the list in an existing sqlite database or to create a database and the table on the fly.



[ Top ]


Class Variables

$baseUrl =

[line 168]

Url to append on the playlist
  • Access: protected

Type:   string


[ Top ]

$debug =  false

[line 150]

Debug value
  • Access: public

Type:   string


[ Top ]

$drivers = array(
        'm3u'   => array(
            'file'  => 'M3U.php',
            'class' => 'MP3_Playlist_M3U'
        ),'smil'=>array('file'=>'SMIL.php','class'=>'MP3_Playlist_SMIL'),'xml'=>array('file'=>'XML.php','class'=>'MP3_Playlist_XML'),'xhtml'=>array('file'=>'XHTML.php','class'=>'MP3_Playlist_XHTML'),'rss'=>array('file'=>'RSS.php','class'=>'MP3_Playlist_RSS'),'sqlite'=>array('file'=>'SQLite.php','class'=>'MP3_Playlist_SQLite'))

[line 117]

  • Access: public

Type:   mixed


[ Top ]

$isMerged =  false

[line 193]

protected variable to check if the method Mergelist is called
  • Access: protected

Type:   string


[ Top ]

$list = array()

[line 174]

List of songs in an array, formatted after parsing
  • Access: protected

Type:   array


[ Top ]

$merged = array()

[line 187]

List of files including append directory, location and ID3 tags for XML

and other manipulation

  • Access: protected

Type:   array


[ Top ]

$mp3 =

[line 180]

MP3_ID Object
  • Access: protected

Type:   string


[ Top ]

$outputDirectory =

[line 162]

Output directory, where the playlist is saved
  • Access: protected

Type:   string


[ Top ]

$parseDirectory =

[line 156]

Directory to Parse
  • Access: protected

Type:   string


[ Top ]

$playlist =  null

[line 199]

Driver object instance.
  • Access: protected

Type:   object


[ Top ]



Method Detail

debug   [line 261]

void debug( string $message)

Output debug message.
  • Access: protected

Parameters:

string   $message   —  Message.

[ Top ]

__construct (Constructor)   [line 218]

TRUE|PEAR_Error __construct( string $dir, string $outdir, string $baseurl, [bool $debug = false])

Instantiate a new MP3_Playlist object.

Expects a reading directory, the output directory where the playlist will be saved and the directory or URL to be used within the playlist.


Parameters:

string   $dir   —  The directory to scan
string   $outdir   —  The directory where to save the playlist file
string   $baseurl   —  The base url to append on the playlist file
bool   $debug   —  (optional) Whether print debug message or not, default FALSE

[ Top ]

fixPath   [line 278]

string fixPath( string $dir)

Convert Windows directory separator to Unix style and fix ending slash.
  • Return: result.
  • Access: public

Parameters:

string   $dir   —  Directory.

[ Top ]

generateURL   [line 301]

string generateURL( string $absPath)

Generates the URL from absolute path.
  • Return: URL.
  • Access: protected

Parameters:

string   $absPath   —  Absolute path.

[ Top ]

getList   [line 460]

array getList( )

Get list of songs in an array, formatted after parsing.
  • Access: public

[ Top ]

getMerged   [line 475]

arrayf getMerged( )

Get list of files including append directory, location and ID3 tags for XML and other manipulation.

[ Top ]

make   [line 517]

bool make( string $type, [array $params = array()], [bool $shuffle = false])

Generates the playlist according to selected format.

Available types include:

 MP3_Playlist::TYPE_M3U       M3U playlist
 MP3_Playlist::TYPE_SMILL     SMILL playlist
 MP3_Playlist::TYPE_XML       XML format
 MP3_Playlist::TYPE_XHTML     XHTML output
 MP3_Playlist::TYPE_RSS       RSS output
 MP3_Playlist::TYPE_SQLITE    Save to SQLite database


Parameters:

string   $type   —  Format type, use one of constants
array   $params   —  (optional) Parameters, an associative array contains values depend on the format.
bool   $shuffle   —  (optional) Whether to shuffle the list or not. This parameter only affect on formats M3U, SMILL and XHTML

[ Top ]

mergeList   [line 394]

bool mergeList( )

Merges the values from the parsed known elements like file location and append URL with the ID3 tags

Sets the value to Not Available if null in the ID3 tag. Trims results to avoid error in the XML and XHTML display.

  • Return: TRUE
  • See: MP3_Id::read()
  • Throws: PEAR_Exception
  • Access: protected

[ Top ]

parse   [line 337]

bool parse( [bool $dir = false])

Parses the MP3 directory defined in the constructor

Appends to the files the append directory of MP3 files including whitespace (necessary for streaming if the append path is a URL) adds the basic list to the List and Merged Array List is used for basic playlist writing while Merged will be used for XML and a more complete output including the ID3 tags.


Parameters:

bool   $dir   —  (optional) Directory to parse, this param use for recursive purpose, default FALSE.

[ Top ]

save   [line 545]

bool save( [string $filename = 'playlist'])

Save the generated playlist into file.

Parameters:

string   $filename   —  (optional) A filename for save (without file extension).

[ Top ]

send   [line 567]

bool send( [string $filename = 'playlist'])

Send the generated playlist to browser directly.

Parameters:

string   $filename   —  (optional) A filename for send (without file extension).

[ Top ]

show   [line 586]

string show( )

Show the generated playlist result

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:39:05 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.