View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0019281 | MMW 5 | General | public | 2022-07-25 20:43 | 2022-08-06 20:04 |
Reporter | zvezdan | Assigned To | |||
Priority | high | Severity | minor | Reproducibility | always |
Status | closed | Resolution | no change required | ||
Fixed in Version | 5.0.4 | ||||
Summary | 0019281: "Incorrect interface type requested" error with PlaylistEntries.add method | ||||
Description | This 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 Reproduce | 1. 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. | ||||
Tags | No 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 } } } } | ||||
Fixed in build | 2658 | ||||
|
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 |
|
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? |
|
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. |
|
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. |
|
However, I would leave the getSongList() because of compatibility with the existing scripts. |
|
OK, I noted it in the docs and added the app.player.getTracklist method for the next 5.0.4 build |
|
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 |
|
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) |
|
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. |
|
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. |
|
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(). |
|
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. |