SageTV Platform
V9.0

sage.api
Class PlaylistAPI

java.lang.Object
  extended by sage.api.PlaylistAPI

public class PlaylistAPI
extends java.lang.Object

Calls for creating, editing, removing and querying playlists in the system


Constructor Summary
PlaylistAPI()
           
 
Method Summary
 sage.Playlist AddPlaylist(java.lang.String Name)
          Creates a new Playlist object
 void AddToPlaylist(sage.Playlist Playlist, java.lang.Object NewItem)
          Adds the specified item to this Playlist.
 boolean DoesPlaylistHaveVideo(sage.Playlist Playlist)
          Returns true if the specified Playlist contains any video files, false otherwise
 java.lang.String GetName(sage.Playlist Playlist)
          Gets the name of the specified Playlist
 sage.Playlist GetNowPlayingList()
          Returns the 'Now Playing' playlist.
 int GetNumberOfPlaylistItems(sage.Playlist Playlist)
          Gets the number of items in the specified Playlist
 java.lang.Object GetPlaylistItemAt(sage.Playlist Playlist, int Index)
          Gets the item in this Playlist at the specified index
 java.lang.Object[] GetPlaylistItems(sage.Playlist Playlist)
          Gets the list of items in the specified Playlist
 java.lang.String GetPlaylistItemTypeAt(sage.Playlist Playlist, int Index)
          Gets the type of item in the Playlist at the specified index
 java.util.Properties GetPlaylistProperties(sage.Playlist Playlist)
          Returns a java.util.Properties object that has all of the user-set properties for this Playlist in it.
 java.lang.String GetPlaylistProperty(sage.Playlist Playlist, java.lang.String PropertyName)
          Returns a property value for a specified Playlist.
 sage.Playlist[] GetPlaylists()
          Gets a list of all of the Playlists in the database
 void InsertIntoPlaylist(sage.Playlist Playlist, int InsertIndex, java.lang.Object NewItem)
          Inserts a new item into the specified Playlist at the specified position.
 boolean IsPlaylistObject(java.lang.Object Playlist)
          Returns true if the passed in argument is a Playlist object
 void MovePlaylistItemDown(sage.Playlist Playlist, int Index)
          Swaps the position of the item at the specified index in the Playlist with the item at the position (Index + 1)
 void MovePlaylistItemUp(sage.Playlist Playlist, int Index)
          Swaps the position of the item at the specified index in the Playlist with the item at the position (Index - 1)
 void RemovePlaylist(sage.Playlist Playlist)
          Removes a specified Playlist from the databse completely.
 void RemovePlaylistItem(sage.Playlist Playlist, java.lang.Object Item)
          Removes the specified item from the Playlist.
 void RemovePlaylistItemAt(sage.Playlist Playlist, int ItemIndex)
          Removes the specified item at the specified index from the Playlist.
 void SetName(sage.Playlist Playlist, java.lang.String Name)
          Sets the name for this Playlist
 void SetPlaylistProperty(sage.Playlist Playlist, java.lang.String PropertyName, java.lang.String PropertyValue)
          Sets a property for this Playlist.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlaylistAPI

public PlaylistAPI()
Method Detail

AddToPlaylist

public void AddToPlaylist(sage.Playlist Playlist,
                          java.lang.Object NewItem)
Adds the specified item to this Playlist. The item may be either an Airing, Album, MediaFile or another Playlist.

Parameters:
Playlist - the Playlist object to add the new item to
NewItem - the new item to add to the Playlist; must be an Airing, Album, MediaFile or Playlist

GetName

public java.lang.String GetName(sage.Playlist Playlist)
Gets the name of the specified Playlist

Parameters:
Playlist - the Playlist object
Returns:
the name of the specified Playlist

GetNumberOfPlaylistItems

public int GetNumberOfPlaylistItems(sage.Playlist Playlist)
Gets the number of items in the specified Playlist

Parameters:
Playlist - the Playlist object
Returns:
the number of items in the specified Playlist

GetPlaylistItemAt

public java.lang.Object GetPlaylistItemAt(sage.Playlist Playlist,
                                          int Index)
Gets the item in this Playlist at the specified index

Parameters:
Playlist - the Playlist object
Index - the 0-based index into the playlist to get the item from
Returns:
the item at the specified index in the Playlist; this will be an Airing, Album, Playlist or null

GetPlaylistItemTypeAt

public java.lang.String GetPlaylistItemTypeAt(sage.Playlist Playlist,
                                              int Index)
Gets the type of item in the Playlist at the specified index

Parameters:
Playlist - the Playlist object
Index - the 0-based index into the Playlist to get the item type for
Returns:
the type of item at the specified index in the Playlist; one of "Airing", "Album", "Playlist" or "" ("Airing" is used for MediaFile items), "MediaFile" will be returned for temporary MediaFile objects that are not in the database

GetPlaylistItems

public java.lang.Object[] GetPlaylistItems(sage.Playlist Playlist)
Gets the list of items in the specified Playlist

Parameters:
Playlist - the Playlist object
Returns:
a list of the items in the specified Playlist

InsertIntoPlaylist

public void InsertIntoPlaylist(sage.Playlist Playlist,
                               int InsertIndex,
                               java.lang.Object NewItem)
Inserts a new item into the specified Playlist at the specified position.

Parameters:
Playlist - the Playlist object to add the new item to
InsertIndex - the 0-based index that the new item should be inserted at
NewItem - the new item to insert into the Playlist; must be an Airing, Album, MediaFile or Playlist

MovePlaylistItemUp

public void MovePlaylistItemUp(sage.Playlist Playlist,
                               int Index)
Swaps the position of the item at the specified index in the Playlist with the item at the position (Index - 1)

Parameters:
Playlist - the Playlist object
Index - the position of the item to move up one in the playlist

MovePlaylistItemDown

public void MovePlaylistItemDown(sage.Playlist Playlist,
                                 int Index)
Swaps the position of the item at the specified index in the Playlist with the item at the position (Index + 1)

Parameters:
Playlist - the Playlist object
Index - the position of the item to move down one in the playlist

RemovePlaylistItem

public void RemovePlaylistItem(sage.Playlist Playlist,
                               java.lang.Object Item)
Removes the specified item from the Playlist. If this item appears in the Playlist more than once, only the first occurrence will be removed.

Parameters:
Playlist - the Playlist object
Item - the item to remove from the Playlist, must be an Airing, MediaFile, Album or Playlist

RemovePlaylistItemAt

public void RemovePlaylistItemAt(sage.Playlist Playlist,
                                 int ItemIndex)
Removes the specified item at the specified index from the Playlist.

Parameters:
Playlist - the Playlist object
ItemIndex - the index of the item to remove from the Playlist

SetName

public void SetName(sage.Playlist Playlist,
                    java.lang.String Name)
Sets the name for this Playlist

Parameters:
Playlist - the Playlist objecxt
Name - the name to set for this Plyalist

IsPlaylistObject

public boolean IsPlaylistObject(java.lang.Object Playlist)
Returns true if the passed in argument is a Playlist object

Parameters:
Playlist - the object to test to see if it is a Playlist object
Returns:
true if the passed in argument is a Playlist object, false otherwise

GetPlaylists

public sage.Playlist[] GetPlaylists()
Gets a list of all of the Playlists in the database

Returns:
a list of all of the Playlists in the database

RemovePlaylist

public void RemovePlaylist(sage.Playlist Playlist)
Removes a specified Playlist from the databse completely. The files in the Playlist will NOT be removed.

Parameters:
Playlist - the Playlist object to remove

DoesPlaylistHaveVideo

public boolean DoesPlaylistHaveVideo(sage.Playlist Playlist)
Returns true if the specified Playlist contains any video files, false otherwise

Parameters:
Playlist - the Playlist object
Returns:
true if the specified Playlist contains any video files, false otherwise
Since:
5.1

AddPlaylist

public sage.Playlist AddPlaylist(java.lang.String Name)
Creates a new Playlist object

Parameters:
Name - the name for the new Playlist
Returns:
the newly created Playlist

GetNowPlayingList

public sage.Playlist GetNowPlayingList()
Returns the 'Now Playing' playlist. This can be used as a local, client-specific playlist which songs can be added to and then played as a temporary set of songs. i.e. usually playlists are shared between all of the clients that are connected to a SageTV system, but this one is NOT shared

Returns:
the Playlist object to use as the 'Now Playing' list
Since:
5.1

GetPlaylistProperty

public java.lang.String GetPlaylistProperty(sage.Playlist Playlist,
                                            java.lang.String PropertyName)
Returns a property value for a specified Playlist. This must have been set using SetPlaylistProperty. Returns the empty string when the property is undefined.

Parameters:
Playlist - the Playlist object
PropertyName - the name of the property
Returns:
the property value for the specified Playlist, or the empty string if it is not defined
Since:
7.0

SetPlaylistProperty

public void SetPlaylistProperty(sage.Playlist Playlist,
                                java.lang.String PropertyName,
                                java.lang.String PropertyValue)
Sets a property for this Playlist. This can be any name/value combination (but the name cannot be null). If the value is null; then the specified property will be removed from this Playlist. This only impacts the return values from GetPlaylistProperty and has no other side effects.

Parameters:
Playlist - the Playlist object
PropertyName - the name of the property
PropertyValue - the value of the property
Since:
7.0

GetPlaylistProperties

public java.util.Properties GetPlaylistProperties(sage.Playlist Playlist)
Returns a java.util.Properties object that has all of the user-set properties for this Playlist in it.

Parameters:
Playlist - the Playlist object
Returns:
a java.util.Properties object that has all of the user-set properties for this Playlist in it; this is a copy of the original one so it is safe to modify it
Since:
7.1

SageTV Platform
V9.0

SageTV is a trademark or registered trademark of Google, Inc. in the US and other countries.
Copyright 2000-2015 The SageTV Authors. All Rights Reserved.