ISDBApplication::PlaylistByTitle: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (Edited description and code example) |
||
Line 8: | Line 8: | ||
===Property description=== | ===Property description=== | ||
Retrieves [[SDBPlaylist]] object of the given playlist name. | Retrieves [[SDBPlaylist]] object of the given playlist name. If multiple playlists with the same name exist, ''PlaylistByTitle'' will return the first one it finds in the database. | ||
When an empty string ("") is specified, the root (virtual) playlist node is returned. Then you can use its [[ISDBPlaylist::ChildPlaylists|ChildPlaylists]] property to get all the first-level playlists. | |||
'''WARNING:''' Also if no playlist with the specified ''Title'' exists, the root (virtual) playlist will be returned. Be aware of this fact, especially if you are planning to remove a playlist. Making an error could remove the root, and so all playlists. | |||
===Example code=== | ===Example code=== | ||
<source lang="vb">Set Playlist = SDB.PlaylistByTitle( "") | <source lang="vb">Dim Playlist : Set Playlist = SDB.PlaylistByTitle("") ' Playlist represents the root (virtual) playlist | ||
Set list = | Dim List : Set List = Playlist.ChildPlaylists ' List represents a list of all first-level playlists | ||
Dim i, itm | |||
For i = 0 To List.Count - 1 ' For all (first-level) playlists in List... | |||
Set itm = List.Item(i) ' ... print out the number of child playlists and tracks | |||
fout.WriteLine itm.Title & " (" & CStr(itm.ChildPlaylists.Count) & "/" & CStr(itm.Tracks.Count) & ")" | |||
Next | |||
' in this case, fout represents a TextStream object (not shown here)</source> | |||
[[Category:Scripting|{{PAGENAME}}]] | [[Category:Scripting|{{PAGENAME}}]] |
Revision as of 19:28, 7 May 2007
CoClass SDBApplication, Interface ISDBApplication
Property Get PlaylistByTitle(Title As String) As ISDBPlaylist
Parameters
Name | Type | Description |
---|---|---|
Title | String | Name of the playlist to get (use "" to get root of all playlists) |
Property description
Retrieves SDBPlaylist object of the given playlist name. If multiple playlists with the same name exist, PlaylistByTitle will return the first one it finds in the database.
When an empty string ("") is specified, the root (virtual) playlist node is returned. Then you can use its ChildPlaylists property to get all the first-level playlists.
WARNING: Also if no playlist with the specified Title exists, the root (virtual) playlist will be returned. Be aware of this fact, especially if you are planning to remove a playlist. Making an error could remove the root, and so all playlists.
Example code
Dim Playlist : Set Playlist = SDB.PlaylistByTitle("") ' Playlist represents the root (virtual) playlist
Dim List : Set List = Playlist.ChildPlaylists ' List represents a list of all first-level playlists
Dim i, itm
For i = 0 To List.Count - 1 ' For all (first-level) playlists in List...
Set itm = List.Item(i) ' ... print out the number of child playlists and tracks
fout.WriteLine itm.Title & " (" & CStr(itm.ChildPlaylists.Count) & "/" & CStr(itm.Tracks.Count) & ")"
Next
' in this case, fout represents a TextStream object (not shown here)