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

Class: File_XSPF

Source Location: /File_XSPF-0.3.1/File/XSPF.php

Class Overview


This is the main class for this package.


Author(s):

Methods


Inherited Variables

Inherited Methods


Class Details

[line 64]
This is the main class for this package.

This class serves as the central point for all other classes in this package, and provides the majority of manipulative methods for outputting the XSPF playlist.



[ Top ]


Method Detail

addAttribution   [line 406]

void addAttribution( object $attribution, [boolean $append = true])

Add an identifier or location tag to the playlist attribution.

This method adds a identifier or location tag to the playlist attribution. The first parameter must be an instance of either the File_XSPF_Identifier or File_XSPF_Location classes.

The third parameter, $append, affects the output of the order of the children of the attribution element. According to the specification, the children of the attribution element should be in chronological order, so this parameter is included to make the job somewhat more simplistic.


Parameters:

object   $attribution     File_XSPF_Identifier|File_XSPF_Location
boolean   $append     true to append, or false to prepend.

[ Top ]

addExtension   [line 427]

void addExtension( File_XSPF_Extension $extension)

Add an extension element to the playlist.

This method adds an extension element to the playlist. This function will only accept instances of the File_XSPF_Extension class, which is documented elsewhere.

  • Access: public

Parameters:

File_XSPF_Extension   $extension     an instance of File_XSPF_Extension

[ Top ]

addLink   [line 446]

void addLink( File_XSPF_Link $link)

Add a link element to the playlist.

This method adds a link element to the playlist. The $link parameter must be a instance of the File_XSPF_Link class or the method will fail.

  • Access: public

Parameters:

File_XSPF_Link   $link     an instance of File_XSPF_Link

[ Top ]

addMeta   [line 465]

void addMeta( File_XSPF_Meta $meta)

Add a meta element to the playlist.

This method adds a meta element to the playlist. The $meta parameter must be an instance of the File_XSPF_Meta class or the method will fail.

  • Access: public

Parameters:

File_XSPF_Meta   $meta     an instance of File_XSPF_Meta.

[ Top ]

addTrack   [line 485]

void addTrack( File_XSPF_Track $track)

Add a track element to the playlist.

This method adds a track element to the playlist. Complimentary documentation exists for the File_XSPF_Track class, and should be the focus of the majority of attention for users building a XSPF playlist.

  • Access: public

Parameters:

File_XSPF_Track   $track     an instance of File_XSPF_Track.

[ Top ]

File_XSPF (Constructor)   [line 334]

File_XSPF File_XSPF( )

Creates a new File_XSPF object.
  • Access: public

[ Top ]

getAnnotation   [line 501]

string getAnnotation( )

Get the annotation for this playlist.

This method returns the contents of the annotation element, which is the human-readable comment of this playlist.

  • Return: the annotation data for this playlist.
  • Access: public

[ Top ]

getAttribution   [line 518]

File_XSPF_Identifier|File_XSPF_Location getAttribution( [int $offset = 0])

Get an array of attribution elements.

This method returns an array of attribution elements.


Parameters:

int   $offset     the offset of the attribution to retrieve.

[ Top ]

getAttributions   [line 536]

array getAttributions( [unknown $filter = null])

Get an array of attribution elements.

This method returns a list of attribution elements, which is either an instance of File_XSPF_Identifier or File_XSPF_Location.

  • Access: public

Parameters:

unknown   $filter     Undocumented

[ Top ]

getCreator   [line 565]

string getCreator( )

Get the author of this playlist.

This method returns the contents of the creator element, which represents the author of this playlist.

  • Return: the creator of this playlist as a human-readable string.
  • Access: public

[ Top ]

getDate   [line 580]

string getDate( )

Get the date of creation for this playlist.

This method returns the date on which this playlist was created (not last modified), formatted as a XML schema dateTime, which is the same as the 'r' parameter for date() in PHP5.

  • Return: a XML schema dateTime formatted date.
  • Access: public

[ Top ]

getDuration   [line 594]

int getDuration( )

Get the duration of this playlist in seconds.

This method returns the length of this playlist in seconds. These times are taken from the duration elements of the playlist track elements.

  • Return: the length in seconds of this playlist.
  • Access: public

[ Top ]

getIdentifier   [line 613]

string getIdentifier( )

Get an identifier for this playlist.

This method returns a canonical ID for this playlist as a URN. An example might be an SHA1 hash of the tracklisting, e.g. sha1://0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33

  • Return: a valid URN for identifing this playlist.
  • Access: public

[ Top ]

getImage   [line 628]

string getImage( )

Get the image URL for this playlist.

This method returns the URL of the image used to represent this playlist. This image should be used if individual tracks belonging to this playlist do not have their own image.

  • Return: the URL of the image for this playlist.
  • Access: public

[ Top ]

getInfo   [line 643]

string getInfo( )

Get the URL of a web page containing information about this playlist.

This method returns the URL of a web page, allowing the user to find out more information about the author of the playlist, and find other playlists.

  • Return: a URL containing information about this playlist.
  • Access: public

[ Top ]

getLicense   [line 662]

string getLicense( )

Get the license for this playlist.

This method returns the URL of the license under which this playlist has been or will be released, such as http://www.gnu.org/copyleft/lesser.html for the LGPL. If the specified license contains a requirement for attribution, users should use the getAttribution method to retrieve an array of attributions.


[ Top ]

getLink   [line 677]

array getLink( )

Get an array of link elements for this playlist.

This method returns a list of link elements, which contain non-XSPF web resources, which still relate to this playlist.


[ Top ]

getLocation   [line 692]

string getLocation( )

Get the source URL for this playlist.

This methods returns the URL where this playlist may be found, such as the path to an FTP or HTTP server, or perhaps the path to a file on the users local machine.

  • Return: the URL where this playlist may be found.
  • Access: public

[ Top ]

getMeta   [line 708]

array getMeta( )

Get an array of non-XSPF metadata.

This method returns an array of meta elements associated with this playlist. Meta elements contain metadata not covered by the XSPF specification without breaking XSPF validation.


[ Top ]

getTitle   [line 722]

string getTitle( )

Get the human-readable title of this playlist.

This method returns the human-readable title of this playlist, which may be a simple reference to what the playlist contains, e.g. "Favourites".

  • Return: the human-readable title of this playlist.
  • Access: public

[ Top ]

getTracks   [line 738]

array getTracks( )

Get an array of tracks for this playlist.

This method returns an array of File_XSPF_Track objects belonging to this playlist, which directly represent individual tracks on this playlist.

  • Return: an array of File_XSPF_Track instances.
  • See: File_XSPF_Track
  • Access: public

[ Top ]

parse   [line 375]

mixed parse( string $text)

Parses an XSPF text stream.

This method parses an XSPF text stream into the current File_XSPF instance. If successful, this function returns true, otherwise it will return an instance of PEAR_Error.

  • Access: public

Parameters:

string   $text     Text stream

[ Top ]

parseFile   [line 350]

bool|PEAR_Error parseFile( string $path)

Parses an existing XSPF file.

This method parses an existing XSPF file into the current File_XSPF instance. If successful, this function returns true, otherwise it will return an instance of PEAR_Error.

  • Access: public

Parameters:

string   $path     Path to file

[ Top ]

setAnnotation   [line 754]

boolean setAnnotation( string $annotation)

Set an annotation for this playlist.

This method sets an annotation, or human-readable description of this playlist, e.g. "All the Radiohead tracks in my vast collection."

  • Access: public

Parameters:

string   $annotation     a human-readable playlist description.

[ Top ]

setCreator   [line 776]

void setCreator( string $creator)

Set the creator of this playlist.

The method sets the creator element of this playlist, which is the human-readable name of the author of the resource, such as a person's name, or a company, or a group.

  • Access: public

Parameters:

string   $creator     the name of the creator of this playlist.

[ Top ]

setDate   [line 793]

void setDate( mixed $date)

Set the creation date of this playlist.

This method sets the creation date (not last-modified date) of this playlist. If the $date parameter contains only digits, this method will assume it is a timestamp, and format it accordingly.

  • Access: public

Parameters:

mixed   $date     either an XML schema dateTime or UNIX timestamp.

[ Top ]

setIdentifier   [line 817]

bool setIdentifier( string $identifier)

Set the identifier for this playlist.

This method sets an identifier for this playlist, such as a SHA1 hash of the track listing. The $identifier must be a valid URN.

  • Access: public

Parameters:

string   $identifier     the URN of a resource to identify this playlist.

[ Top ]

setImage   [line 839]

bool setImage( string $image)

Set the image URL for this playlist.

This method sets the image URL for this playlist, which provides a fallback image if individual tracks do not themselves have image URLs set.

  • Access: public

Parameters:

string   $image     the URL to an image resource.

[ Top ]

setInfo   [line 860]

bool setInfo( string $info)

Set the URL of web page for this playlist.

This method sets the URL of a web page containing information about this playlist, and possibly links to other playlists by the same author.

  • Access: public

Parameters:

string   $info     the URL of a web page to describe this playlist.

[ Top ]

setLicense   [line 884]

bool setLicense( string $license)

Set the license for this playlist.

This method sets the URL of the license under which this playlist was released. If the license requires attribution, such as some Creative Commons licenses, such attributions can be added using the addAttribution method.


Parameters:

string   $license     The URL of the license for this playlist.

[ Top ]

setLocation   [line 907]

bool setLocation( string $location)

Set the source URL of this playlist.

This method sets the source URL of this playlist. For example, if one offered one's playlists for syndication over the Internet, one might add a URL to direct users to the original, such as http://www.example.org/list.xspf.

  • Access: public

Parameters:

string   $location     the source URL of this playlist.

[ Top ]

setTitle   [line 928]

void setTitle( string $title)

Set the title of this playlist.

This method sets the human-readable title of this playlist. For example one might call a playlist 'Favourites', or the name of a band.

  • Access: public

Parameters:

string   $title     the human-readable title of this playlist.

[ Top ]

toFile   [line 994]

mixed toFile( string $filename)

Save this playlist to a file.

This method outputs this playlist to a file, or any other location that can be written to by fopen and fwrite. If the file write is successful, this function will return true, otherwise it will return an instance of a PEAR_Error object.

  • Return: either true for success, or an instance of PEAR_Error.
  • Throws: PEAR_Error
  • Access: public

Parameters:

string   $filename     the file to which to write this XSPF playlist.

[ Top ]

toM3U   [line 1025]

mixed toM3U( string $filename)

Save this playlist as an M3U playlist.

This method saves the current XSPF playlist in M3U format, providing a one-way conversion to the popular flat file playlist. Reverse conversion is considered to be beyond the scope of this package.

  • Return: either true for success or an instance of PEAR_Error
  • Throws: PEAR_Error
  • Access: public

Parameters:

string   $filename     the file to which to write the M3U playlist.

[ Top ]

toSMIL   [line 1063]

mixed toSMIL( string $filename)

Save this playlist as SMIL format.

This method saves this XSPF playlist as a SMIL file, which can be used as a playlist. This is a one-way conversion, as reading SMIL files is considered beyond the scope of this application.

  • Return: either true if successful, or an instance of PEAR_Error
  • Throws: PEAR_Error
  • Access: public

Parameters:

string   $filename     the file to which to write the SMIL playlist.

[ Top ]

toStream   [line 1109]

void toStream( )

Output this playlist as a stream.

This method outputs this playlist as a HTTP stream with a content type of 'application/xspf+xml', which could be passed off by a user agent to a XSPF-aware application.

  • Access: public

[ Top ]

toString   [line 1123]

string toString( )

Output this playlist as a string.

This method outputs this playlist as a string using the XML_Tree package.

  • Return: this playlist as a valid XML string.
  • Access: public

[ Top ]


Documentation generated on Sat, 31 Mar 2012 17:30:08 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.