View Issue Details

IDProjectCategoryView StatusLast Update
0019281MMW 5Generalpublic2022-08-06 20:04
Reporterzvezdan Assigned To 
PriorityhighSeverityminorReproducibilityalways
Status closedResolutionno change required 
Fixed in Version5.0.4 
Summary0019281: "Incorrect interface type requested" error with PlaylistEntries.add method
DescriptionThis is an edited issue. The original post was my mistake.

I am getting the "Incorrect interface type requested" error message having frozen program with the PlaylistEntries.add method. I think I am doing everything correctly, although your API is not very informative about that method.

Fortunately, I am not using this method in my scripts, but app.player.addTracksAsync. However, it should work as specified.
Steps To Reproduce1. open DevTools / Console;
2. select a track in the main tracklist;
3. paste this in DevTools:
var selTracks = window.uitools.getSelectedTracklist(), oPlayingList = app.player.getSongList(), oSelTrack; selTracks.whenLoaded().then(function () {selTracks.locked(function () {oSelTrack = selTracks.getValue(0)}); oPlayingList.modifyAsync(function () {oPlayingList.add(oSelTrack)});})
4. press Enter -> you will get the mentioned error message that freezes the program.
TagsNo tags attached.
Attached Files
persistent.json (14,023 bytes)   
{
    "current_tab_history": {
        "position": 1,
        "items": [
            {
                "title": "Proba",
                "icon": "folder",
                "timeStamp": 1658771853876,
                "tag": {},
                "nodePath": "root/collection:-1/location:-1/dbfolder:3275/dbfolder:3276/dbfolder:3277/dbfolder:3278/dbfolder:3279/dbfolder:3300",
                "nodePathSources": [
                    {
                        "handlerID": "root",
                        "persistentID": "root",
                        "dataSource": null
                    },
                    {
                        "handlerID": "collection",
                        "persistentID": "collection:-1",
                        "dataSource": {
                            "objectType": "collection",
                            "persistentInfo": {
                                "id": -1
                            }
                        }
                    },
                    {
                        "handlerID": "location",
                        "persistentID": "location:-1",
                        "dataSource": {
                            "objectType": "collection",
                            "persistentInfo": {
                                "id": -1
                            }
                        }
                    },
                    {
                        "handlerID": "dbfolder",
                        "persistentID": "dbfolder:3275",
                        "dataSource": {
                            "objectType": "dbfolder",
                            "persistentInfo": {
                                "id": 3275
                            }
                        }
                    },
                    {
                        "handlerID": "dbfolder",
                        "persistentID": "dbfolder:3276",
                        "dataSource": {
                            "objectType": "dbfolder",
                            "persistentInfo": {
                                "id": 3276
                            }
                        }
                    },
                    {
                        "handlerID": "dbfolder",
                        "persistentID": "dbfolder:3277",
                        "dataSource": {
                            "objectType": "dbfolder",
                            "persistentInfo": {
                                "id": 3277
                            }
                        }
                    },
                    {
                        "handlerID": "dbfolder",
                        "persistentID": "dbfolder:3278",
                        "dataSource": {
                            "objectType": "dbfolder",
                            "persistentInfo": {
                                "id": 3278
                            }
                        }
                    },
                    {
                        "handlerID": "dbfolder",
                        "persistentID": "dbfolder:3279",
                        "dataSource": {
                            "objectType": "dbfolder",
                            "persistentInfo": {
                                "id": 3279
                            }
                        }
                    },
                    {
                        "handlerID": "dbfolder",
                        "persistentID": "dbfolder:3300",
                        "dataSource": {
                            "objectType": "dbfolder",
                            "persistentInfo": {
                                "id": 3300
                            }
                        }
                    }
                ],
                "treePath": "root/collection:-1/location:-1/dbfolder:3275/dbfolder:3276/dbfolder:3277/dbfolder:3278/dbfolder:3279/dbfolder:3300",
                "controlsState": {
                    "viewPanel": {
                        "subNodesState": {
                            "viewControl_MiddlePanel": {
                                "subNodesState": {
                                    "viewControl_Scroller": {
                                        "subNodesState": {
                                            "viewControl_folder_listView": {
                                                "focusedIndex": 0,
                                                "itemCount": 4,
                                                "scrollOffset": 0,
                                                "popupShown": false,
                                                "sortString": "path DESC"
                                            }
                                        },
                                        "scrollTop": 0
                                    }
                                }
                            }
                        }
                    },
                    "viewFilter": null
                },
                "stored": true,
                "dataSourceCache": {}
            },
            {
                "title": "Rock",
                "icon": "folder",
                "timeStamp": 1658773547126,
                "tag": {},
                "nodePath": "root/collection:-1/location:-1/dbfolder:3275/dbfolder:3276/dbfolder:3277/dbfolder:3278/dbfolder:3279/dbfolder:3292",
                "nodePathSources": [
                    {
                        "handlerID": "root",
                        "persistentID": "root",
                        "dataSource": null
                    },
                    {
                        "handlerID": "collection",
                        "persistentID": "collection:-1",
                        "dataSource": {
                            "objectType": "collection",
                            "persistentInfo": {
                                "id": -1
                            }
                        }
                    },
                    {
                        "handlerID": "location",
                        "persistentID": "location:-1",
                        "dataSource": {
                            "objectType": "collection",
                            "persistentInfo": {
                                "id": -1
                            }
                        }
                    },
                    {
                        "handlerID": "dbfolder",
                        "persistentID": "dbfolder:3275",
                        "dataSource": {
                            "objectType": "dbfolder",
                            "persistentInfo": {
                                "id": 3275
                            }
                        }
                    },
                    {
                        "handlerID": "dbfolder",
                        "persistentID": "dbfolder:3276",
                        "dataSource": {
                            "objectType": "dbfolder",
                            "persistentInfo": {
                                "id": 3276
                            }
                        }
                    },
                    {
                        "handlerID": "dbfolder",
                        "persistentID": "dbfolder:3277",
                        "dataSource": {
                            "objectType": "dbfolder",
                            "persistentInfo": {
                                "id": 3277
                            }
                        }
                    },
                    {
                        "handlerID": "dbfolder",
                        "persistentID": "dbfolder:3278",
                        "dataSource": {
                            "objectType": "dbfolder",
                            "persistentInfo": {
                                "id": 3278
                            }
                        }
                    },
                    {
                        "handlerID": "dbfolder",
                        "persistentID": "dbfolder:3279",
                        "dataSource": {
                            "objectType": "dbfolder",
                            "persistentInfo": {
                                "id": 3279
                            }
                        }
                    },
                    {
                        "handlerID": "dbfolder",
                        "persistentID": "dbfolder:3292",
                        "dataSource": {
                            "objectType": "dbfolder",
                            "persistentInfo": {
                                "id": 3292
                            }
                        }
                    }
                ],
                "treePath": "root/collection:-1/location:-1/dbfolder:3275/dbfolder:3276/dbfolder:3277/dbfolder:3278/dbfolder:3279/dbfolder:3292",
                "controlsState": {
                    "viewPanel": {
                        "subNodesState": {
                            "viewControl_MiddlePanel": {
                                "subNodesState": {
                                    "viewControl_Scroller": {
                                        "subNodesState": {
                                            "viewControl_folder_listView": {
                                                "focusedIndex": 1,
                                                "itemCount": 22,
                                                "scrollOffset": 0,
                                                "popupShown": false,
                                                "sortString": "path DESC"
                                            }
                                        },
                                        "scrollTop": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        ]
    },
    "mediaTreeItems": {
        "treeNodes": [
            {
                "itemType": "home",
                "id": 0,
                "pos": 0,
                "visible": 0,
                "selected": false
            },
            {
                "itemType": "npview",
                "id": 0,
                "pos": 1,
                "visible": 1,
                "selected": false
            },
            {
                "itemType": "collection",
                "id": -1,
                "pos": 2,
                "visible": 1,
                "selected": true
            },
            {
                "itemType": "collection",
                "id": 6,
                "pos": 3,
                "visible": 2,
                "selected": false
            },
            {
                "itemType": "collection",
                "id": 8,
                "pos": 4,
                "visible": 0
            },
            {
                "itemType": "collection",
                "id": 9,
                "pos": 5,
                "visible": 0
            },
            {
                "itemType": "collection",
                "id": 7,
                "pos": 6,
                "visible": 2,
                "selected": false
            },
            {
                "itemType": "collection",
                "id": 10,
                "pos": 7,
                "visible": 0
            },
            {
                "itemType": "collection",
                "id": 11,
                "pos": 8,
                "visible": 2
            },
            {
                "itemType": "playlists",
                "id": 0,
                "pos": 9,
                "visible": 1,
                "selected": false
            },
            {
                "itemType": "collection",
                "id": 14,
                "pos": 10,
                "visible": 0
            },
            {
                "itemType": "devicesList",
                "id": 0,
                "pos": 11,
                "visible": 0,
                "selected": false
            },
            {
                "itemType": "collection",
                "id": 12,
                "pos": 12,
                "visible": 2
            },
            {
                "itemType": "computer",
                "id": 0,
                "pos": 13,
                "visible": 1,
                "selected": false
            },
            {
                "itemType": "web",
                "id": 0,
                "pos": 14,
                "visible": 0,
                "selected": false
            },
            {
                "itemType": "pinned",
                "id": 0,
                "pos": 15,
                "visible": 0,
                "selected": false
            },
            {
                "itemType": "optical_drive",
                "id": 0,
                "pos": 14,
                "visible": 1
            },
            {
                "itemType": "collection",
                "id": 1,
                "pos": 4,
                "visible": 1
            },
            {
                "itemType": "collection",
                "id": 2,
                "pos": 5,
                "visible": 2
            },
            {
                "itemType": "collection",
                "id": 4,
                "pos": 6,
                "visible": 2
            },
            {
                "itemType": "collection",
                "id": 3,
                "pos": 7,
                "visible": 2
            },
            {
                "itemType": "collection",
                "id": 5,
                "pos": 8,
                "visible": 2
            }
        ]
    },
    "VIEW_HANDLERS_STATE_NODE_FOLDER": {
        "foldersList": {
            "hiddenSubViews": {
                "columnBrowser": true,
                "folder_Tree": true,
                "folder_NodeList": true,
                "folder_RowNodeList": true
            }
        }
    }
}
persistent.json (14,023 bytes)   
screenshot.25.png (9,982 bytes)   
screenshot.25.png (9,982 bytes)   
Fixed in build2658

Relationships

related to 0019294 feedbackzvezdan Tracklist's adding/removal methods don't update tracks from the parent playlist/PlayingEntries 

Activities

Ludek

2022-07-26 14:20

developer   ~0068904

Last edited: 2022-07-26 14:30

The issue is that getSongList returns PlaylistEntries not Tracklist,
to get Tracklist you need to use app.player.getSongList().getTracklist() , see: https://www.mediamonkey.com/docs/api/classes/PlaylistEntries.html
image.png (6,769 bytes)   
image.png (6,769 bytes)   

Ludek

2022-07-26 14:25

developer   ~0068905

Last edited: 2022-07-26 14:30

So yes, app.player.addTracksAsync is the way to add tracks to Now Playing: https://www.mediamonkey.com/docs/api/classes/Player.html

Anyhow I agree that getSongList is quite confusing name for getting PlaylistEntries

I think we should mark it as LEGACY, and either replace it by getEntries() or even better add getTracklist() method directly to the Player object?

zvezdan

2022-07-26 14:26

updater   ~0068906

You don;t need to post the screenshots for API refeernces, the link is sufficient.

And when you look at the API of PlaylistEntries you will see that it supports the add method (https://www.mediamonkey.com/docs/api/classes/PlaylistEntries.html#method_add), just as it supports del, remove and removeAsync methods that I mentioned in another issue.

zvezdan

2022-07-26 14:30

updater   ~0068907

Yes, I agree that the getSongList name of method is quite confusing. And I agree that getTracklist() method should be directly accessed from the Player object. I was always wondering why you didn't do that at first place.

zvezdan

2022-07-26 14:36

updater   ~0068908

However, I would leave the getSongList() because of compatibility with the existing scripts.

Ludek

2022-07-26 14:45

developer   ~0068909

Last edited: 2022-07-26 14:46

OK, I noted it in the docs and added the app.player.getTracklist method for the next 5.0.4 build
image-2.png (18,295 bytes)   
image-2.png (18,295 bytes)   

Ludek

2022-07-26 14:48

developer   ~0068910

Last edited: 2022-07-26 14:49

Otherwise yes, PlaylistEntries includes the add method (just like any other descendant of SharedList class), that's the point why you got "Incorrect interface type requested" error once you wanted to add Track to the list instead of PlaylistEntry

zvezdan

2022-07-26 14:53

updater   ~0068911

I don't understand what are you saying. I wanted to add track to the PlaylistEntry using its add method:
oPlayingList = app.player.getSongList()
oPlayingList.add(oSelTrack)

Ludek

2022-07-26 15:42

developer   ~0068919

I am saying that you were trying to insert Track type to the list that expects PlaylistEntry type.
i.e. it is like if you wanted to insert string to the Tracklist, you would also get the "Incorrect interface type requested" assertion.
Or inserting Track to artist list etc.

zvezdan

2022-07-26 16:14

updater   ~0068922

The oPlayingList is the PlaylistEntry type since app.player.getSongList() returns PlaylistEntry. The very same app.player.getSongList() works fine without such error when using del, remove and removeAsync methods. The only one which gives error is the add method.

zvezdan

2022-07-26 16:22

updater   ~0068923

I wanted to say PlaylistEntries, not PlaylistEntry. I don't even know what is PlaylistEntry, unless it is the same Track object that I have in my code with tracklist.getValue().

zvezdan

2022-07-26 17:00

updater   ~0068924

I think that I am finally getting what you are saying. We should stop wasting our time on this discussion since this whole getSongList thing will soon be obsolete. Thankfully you decided to implement getTracklist directly to the Player class.