-
Notifications
You must be signed in to change notification settings - Fork 3
VocaDB
Yukari requests information from VocaDB's API (vocadb.net).
The information provided by VocaDB is very helpful for identifying titles and artists. #####Commands
- The song is matched correctly but the data is outdated
$vocadb
Update (re-request) song data from VocaDB for the currently playing media. - The song is matched incorrectly
$vocadb songId
Match the currently playing media with songId. If the song data exists in the database, that will be displayed, and no request will be made to VocaDB. - The song is mismatched and outdated
(#Todo/may not implement) Same as above, but will force a request even if data exists in the database. (This is essentially the same as typing$vocadb songId -f
$vocadb SongId
,$vocadb
)
#####Matching The main challenge in incorporating this into Cytube is matching the particular media with the appropriate VocaDB Song entry.
There are two API methods for Song: by songId and by mediaId. Since we queue Youtube* videos to the playlist, we use the mediaId Song API with Youtube as the provider. If there is a song entry on VocaDB that has the Youtube video link listed, it returns the matching Song data. When a video matches this way, we can be assured that the information provided by VocaDB accurately reflects the video.
*Cytube supports many more players, but Youtube is the most prevalent for Vocaloid media so Youtube will be used for this explanation.
However only a portion of Song entries contains Youtube media links. The majority service provider listed in VocaDB songs is NicoNicoDouga. Thus most of the videos listed in Cytube will not match directly with a Song entry in VocaDB. The good news is that many Youtube uploaders include the NicoNico video id in the Youtube description. When a direct match is not found, Yukari uses the Youtube API to get the video description, looking for a NicoNico Id. When one is found, another request is sent to VocaDB, this time, with the NicoNico Id. This greatly increases the chance that a video matches a song.
This 'indirect' matching is not always accurate. For example, if a description lists "Previous Work: smxxxxxx", then Yukari will match the wrong song. Cover works often list the original Nico id in their description, so this will also lead to a mismatch. A moderator should correct the mismatch with $vocadb vocadbSongId
This will require some searching on VocaDB to get the correct Song Id. If the song is not found on VocaDB, the moderator should add it to VocaDB, then use $vocadb newSongId
. If that is not possible, $vocadb 0
can be used to un-match the video.
Automatic matching is done during queue (and not playback).
It makes sense to cache the information from VocaDB so we don't repeatedly request the same information. Caching response data helps reduce bandwidth usage on both ends (and CPU and disk for the server).
Because a song information does not change often, there is no need to set an expiration time, or automatically update the song data. However, updates can and do happen from time to time. If a song data is outdated, a moderator should use $vocadb
(no arguments) to request the latest song data from VocaDB for the currently playing video. Even if there are multiple videos matched to a particular song, only one update is necessary because there is a separate (normalized) Song table in Yukari's database.
#####VocaDB Panel When a new video starts playing, Yukari retrieves the song information for the Song database, and sends a javascript update to the Cytube channel. The script is a simple variable (object) assignment, and the client browser is programmed (via custom external javascript) to processes the object and build the information display button and div.