update WTVBGMusic class/system

- rename getCategoryList to getCategorySongList
- add proper getCategoryList which filters client usable categories
- do not show empty categories to classic clients
This commit is contained in:
zefie
2021-11-09 11:42:03 -05:00
parent 2b493dc389
commit c16eed3ec8
3 changed files with 28 additions and 11 deletions

View File

@@ -1077,7 +1077,8 @@ class WTVBGMusic {
return null;
}
getCategoryList(category) {
getCategorySongList(category) {
if (this.session_data.hasCap("client-can-do-rmf")) {
// use rmf list
var musiclist = this.musiclist_rmf;
@@ -1099,6 +1100,17 @@ class WTVBGMusic {
return songList.filter(value => Object.keys(value).length !== 0);
}
getCategoryList() {
var categories = [];
var self = this;
Object.keys(self.categories).forEach(function (k) {
var songList = self.getCategorySongList(parseInt(k) + 1);
if (songList.length > 0) categories[k] = self.categories[k];
});
return categories.filter(value => Object.keys(value).length !== 0);
}
getCategoryName(category) {
return this.categories[parseInt(category) - 1];
}