anjanms / DubAPI

A Node.js API for creating queup.net bots.
MIT License
20 stars 10 forks source link

on events.roomPlaylistUpdate, msg.songInfo.name might be undefined #16

Closed JTBrinkmann closed 8 years ago

JTBrinkmann commented 8 years ago

looks like songs with undefined as name are possible https://i.gyazo.com/85fc60c4453ef836d5d3634b304961fc.png This seems to be a Dubtrack bug, but until it's fixed, it might be worth considering fixing it in DubAPI, too.

anjanms commented 8 years ago

That's...interesting. Please give v1.2.0 a try.

cc: @NitroGhost

JTBrinkmann commented 8 years ago

example of a song

{
    "_id": "560e1b7ce54db00300d8d31c",
    "added": 1443765116411,
    "songid": "560e1b7ce54db00300d8d31b",
    "_song": {
        "_id": "560e1b7ce54db00300d8d31b",
        "created": 1443765116386,
        "updub": 0,
        "downdub": 0,
        "userid": null,
        "__v": 0
    },
    "playlistid": "560e1b7acbb6ee0300749d7d",
    "__v": 0
}

(example by @NitroGhost from the dubtrack slack)

anjanms commented 8 years ago

So there's more to it than just name being undefined? Is that what's being sent under songInfo in room_playlist-update?

BenWildeman commented 8 years ago

I would assume so. I found the offending songs in someones playlist that were all like the json brinkie posted. I don't personally log what comes through my bot other than errors because I couldn't care less. some how dubtrack is ending up with blank songs and it's pointing towards being soundcloud related. the playlist was imported from soundcloud and purely a soundcloud playlist not the only one I might add, she cleared out loads of the buggers from her millions of playlists

anjanms commented 8 years ago

Ah okay, that makes more sense. I'll add some more checks and emit an empty advance in the event vital things are missing. Since I haven't run into this myself, how does the frontend seem to handle this?

BenWildeman commented 8 years ago

front end is hilarious at handling this. if you don't notice the blank songs and they end up in the room queue, when it plays nothing plays, you'd expect it to skip because it ends up as "0:00" for the length, but it doesn't

anjanms commented 8 years ago

Haha. In that case throwing/emitting a custom error will probably be a better way to go. That way it can be caught and the bot can skip or do whatever.

anjanms commented 8 years ago

Sorry it took me so long to get back to this. You can now check for this by doing something like if (data.id !== undefined && data.media === undefined) in the advance event. You can also check ahead of time by looking for undefined media in the queue.