Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCF/iTunes Playlists
Function:
Required plugins for this example: MBS MacCF Plugin, MBS Main Plugin, MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCF/iTunes Playlists
This example is the version from Sun, 17th Mar 2012.
Project "iTunes Playlists.rbp"
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
EventHandler Sub Open() dim c as CFObjectMBS c=LoadMusicDictionary if c=nil then MsgBox "Failed to load the file ""iTunes Music Library.xml""." else TheLib=CFDictionaryMBS(c) ShowPlaylists end if End EventHandler
Function LoadMusicDictionary() As CFObjectMBS dim c as CFObjectMBS dim data as CFBinaryDataMBS dim f as FolderItem dim u as CFURLMBS dim b as BinaryStream dim s as string f=MusicDocumentsFolderMBS(-32763) f=f.Child("iTunes") f=f.Child("iTunes Music Library.xml") b=f.OpenAsBinaryFile(false) s=b.Read(B.Length) 'MsgBox str(len(S)) data=NewCFBinaryDataMBSStr(s) c=NewCFObjectMBSFromXML(data) Return c Exception End Function
Sub ShowPlaylists() dim a as CFArrayMBS dim o as CFObjectMBS dim i,c as integer dim d as CFDictionaryMBS dim s as CFStringMBS dim b as CFArrayMBS o=TheLib.Value(NewCFStringMBS("Playlists")) a=CFArrayMBS(o) c=a.Count-1 for i=0 to c o=a.Item(i) d=CFDictionaryMBS(o) // it's a dictionary o=d.Value(NewCFStringMBS("Name")) s=CFStringMBS(o) List.AddRow s.str o=d.Value(NewCFStringMBS("Playlist Items")) if o<>Nil then // items exist? b=CFArrayMBS(o) List.Cell(List.LastIndex,1)=str(b.Count) end if next Exception End Sub
Property Protected TheLib As CFDictionaryMBS
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS MacCF Plugin.





Links
MBS Xojo Chart Plugins