![]() Ideally, it would look at the AppleScript references (and it could) to figure out what type to use. Now, when JaplScript generates dynamic proxies for the returned AppleScript references, it has to figure out what types it has to use. The signature of the getPlaylist() method is as follows: Playlist getPlaylists() Here, in essence, ObstMusic generates an AppleScript snippet that asks Music for all playlists. ![]() Now, what happens in your code? .Playlist songKongPlaylists = app.getPlaylists() It does this by creating dynamic proxies for Java interfaces that have been generated for Music's AppleScript classes. ObstMusic uses JaplScript to talk to Apple's Music app via AppleScript (in an imperfect way). More likely the issue I have to do something more than just cast from Playlist to FolderPlaylist but I cannot find an alternative. Im not using modules so I think references to modules is probably misleading. Java.base/$n(ThreadPoolExecutor.java:635) Java.base/.runWorker(ThreadPoolExecutor.java:1136) 'app') : class jdk.proxy2.$Proxy62 cannotīe cast to class .FolderPlaylistĬom.getPlayListFolder(OSXUpdateMusicWithChanges.java:41)Ĭom.createPlaylist(OSXUpdateMusicWithChanges.java:56)Ĭom.analyseFiles(OSXUpdateItunesWithChanges.java:246)Ĭom.updateItunes(OSXUpdateItunesWithChanges.java:126)Ĭom.call(UpdateItunesWithChanges.java:184)Ĭom.call(UpdateItunesWithChanges.java:33)Īt java.base/.run(FutureTask.java:264) (jdk.proxy2.$Proxy62 is in module jdk.proxy2 of loader 'app' Ĭom. is in unnamed module of loader *** Unable to run itunes update:class jdk.proxy2.$Proxy62 cannot be cast to class .FolderPlaylist 14.53.25:BST:OSXUpdateItunesWithChanges:updateItunes:SEVERE: Return ((FolderPlaylist)songkongPlaylist) įirst time I run it when I have to create a folder playlist, because non exists it works, but if I run again so it finds an existing folder playlist it then fails complaining as follows ((FolderPlaylist)songkongPlaylist).setName("songkong") If(songkongPlaylist instanceof FolderPlaylist) ![]() Object songkongPlaylist = app.make(FolderPlaylist.class) private FolderPlaylist getPlayListFolder()Īpplication app = Application.getInstance() Ĭom. songKongPlaylists = app.getPlaylists() įor(.Playlist next:songKongPlaylists) If none exists then it creates such a folder and then returns it. In this method it looks for a existing folder playlist called songkong, it it finds it then returns it. Trying to use to talk to Apple Music app on macOS with Java, I used to write native AppleScript and then java applescript library but that was removed from Java.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |