rkscv / danmaku

Danmaku plugin for mpv powered by dandanplay API
MIT License
13 stars 4 forks source link

Support for blocking the danmaku from specific sources #10

Closed dyphire closed 4 months ago

dyphire commented 4 months ago

This will be provided in a form similar to filter=userid[BiliBili], and can be used to implement blocking the specific danmaku source for dandanplay (like [Dandan][BiliBili]16dc4c7f).

Also options should be able to be updated at runtime.

rkscv commented 4 months ago

I'd prefer to make a new option like filter_source=bilibili,acfun to avoid unnecessary parsing burdens and usage hassles (keywords in filter rarely need to be updated at runtime).

The senders of danmaku are in [source]userId format, where the possible values of source are unclear. I've seen Bilibili, AcFun and Gamer but there should be more. I don't want to store a source string for each danmaku which is not memory or time efficient. I need to know all possible values at compile time, and this can only be partially achieved without a reply from the author of dandanplay (#8 (comment)).

Note: Danmaku returned by GET /api/v2/comment/{episodeId} don't seem to be all available danmaku from all sources, but some of them. Blocking danmaku from one source may block all danmaku (if this interface only returns danmaku from that source). There is also GET /api/v2/related/{episodeId}, but it requires multiple requests to be sent and danmaku to be de-duplicated locally, which is less efficient.

rkscv commented 4 months ago

Before I implement this, I'd like to know how are you going to use this feature without knowing if the dandanplay server correctly handles the timestamps of danmaku from different sources and if the videos from certain sources have extra credits or content cuts, or do you know?

dyphire commented 4 months ago

Before I implement this, I'd like to know how are you going to use this feature without knowing if the dandanplay server correctly handles the timestamps of danmaku from different sources and if the videos from certain sources have extra credits or content cuts, or do you know?

I think the usage scenario of this option is to manually apply it through commands when it is found that only part of the danmaku times in the danmaku do not match (Usually it comes from bilibili), such as key cycle-values script-opts danmaku-filter_source=bilibili danmaku-filter_source=. So this option is required to support runtime updates.

rkscv commented 4 months ago

Landed in e5192d7.

dyphire commented 4 months ago

Landed in e5192d7.

There is a capitalization error: Bilibili should be BiliBili. The iQiyi source should also be added: iqiyi. ( [Dandan][iqiyi] )

Edit: Tencent sources are basically Chinese anime, there's no need for that.

rkscv commented 4 months ago

There is a capitalization error: Bilibili should be BiliBili.

Fixed.

The iQiyi source should also be added: iqiyi.

Added.

Edit: Tencent sources are basically Chinese anime, there's no need for that.

Added for integrity.

rkscv commented 3 months ago

The author of dandanplay doesn't recommend using source in [source]userId as danmaku source because there's no stable pattern for this value. He recommends referring to the official dandanplay client's usage, using GET /api/v2/related/{episodeId} to get all the third-party sources, and then calling GET /api/v2/extcomment to get the danmaku from specific sources.

But this requires 3 serial HTTP requests (episode matching, source fetching and parallel danmaku fetching), and the original 2 serial HTTP requests (episode matching and danmaku fetching) strategy is already a bit slow for me, so I don’t want to implement this.