无法使用 Java Applescript 库包装器 com.tagtraum.obstmusic 在播放列表文件夹中创建 Apple Music 用户播放列表

Unable to create Apple Music user playlist within playlist folder using Java Applescript library wrapper com.tagtraum.obstmusic

尝试在 Java 上使用 https://github.com/japlscript/obstmusic 与 Mac 上的 Apple Music 应用对话,我曾经编写原生 applescript,然后 java applescript 库,但已从 Java.

在这种情况下,当我 运行 代码

时,我无法在文件夹播放列表中创建用户播放列表
    public void createPlaylist() throws Exception
    {
        FolderPlaylist songkongPlaylistFolder = getPlayListFolder();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd kk:mm");
        String playlistname = "SongKong:" + sdf.format(new Date());
        Application app = Application.getInstance();

        Map<String, Reference> properties = new HashMap<>();
        Object userPlaylist = app.make(TypeClass.fromClass(UserPlaylist.class), songkongPlaylistFolder, properties);
        ((UserPlaylist)userPlaylist).setName(playlistname);
    }

我遇到异常

04/04/2022 14.52.44:BST:OSXUpdateItunesWithChanges:updateItunes:SEVERE: *** Unable to run itunes update:{ NSAppleScriptErrorAppName = Music;
NSAppleScriptErrorBriefMessage = "Can’t make some data into the expected type."; NSAppleScriptErrorMessage = "Music got an error: Can’t make some data into the expected type.";
NSAppleScriptErrorNumber = "-1700"; NSAppleScriptErrorRange = "NSRange: {23, 93}"; } com.tagtraum.japlscript.execution.JaplScriptException: {
NSAppleScriptErrorAppName = Music; NSAppleScriptErrorBriefMessage = "Can’t make some data into the expected type."; NSAppleScriptErrorMessage = "Music got an error: Can’t make some data into the expected type."; NSAppleScriptErrorNumber = "-1700";
NSAppleScriptErrorRange = "NSRange: {23, 93}"; } at com.tagtraum.japlscript.execution.CocoaScriptExecutor.execute(Native Method) at com.tagtraum.japlscript.execution.CocoaScriptExecutor.executeImpl(CocoaScriptExecutor.java:28) at com.tagtraum.japlscript.execution.ScriptExecutor.execute(ScriptExecutor.java:102) at com.tagtraum.japlscript.ObjectInvocationHandler.executeAppleScript(ObjectInvocationHandler.java:476) at com.tagtraum.japlscript.ObjectInvocationHandler.executeAppleScript(ObjectInvocationHandler.java:468) at com.tagtraum.japlscript.ObjectInvocationHandler.executeAppleScript(ObjectInvocationHandler.java:464) at com.tagtraum.japlscript.ObjectInvocationHandler.invokeCommand(ObjectInvocationHandler.java:280) at com.tagtraum.japlscript.ObjectInvocationHandler.invoke(ObjectInvocationHandler.java:191) at jdk.proxy2/jdk.proxy2.$Proxy59.make(Unknown Source) at com.jthink.songkong.ituneshelper.OSXUpdateMusicWithChanges.createPlaylist(OSXUpdateMusicWithChanges.java:62) at com.jthink.songkong.ituneshelper.OSXUpdateItunesWithChanges.analyseFiles(OSXUpdateItunesWithChanges.java:246) at com.jthink.songkong.ituneshelper.OSXUpdateItunesWithChanges.updateItunes(OSXUpdateItunesWithChanges.java:126) at com.jthink.songkong.ituneshelper.UpdateItunesWithChanges.call(UpdateItunesWithChanges.java:184) at com.jthink.songkong.ituneshelper.UpdateItunesWithChanges.call(UpdateItunesWithChanges.java:33) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)

我认为问题在于我如何调用 app.make() 但我不知道如何调用。

发现它深埋在基础项目的 README.md 文件中 https://github.com/japlscript/japlscript

Reference reference = app.make(UserPlaylist.CLASS, songkongPlaylistFolder, null);
UserPlaylist userPlaylist = reference.cast(UserPlaylist.class);
userPlaylist.setName(playlistname);