1
0
mirror of synced 2024-12-18 17:25:54 +01:00

Update frontend to use Subject38's proper categories as extracted from Jubeat XML.

This commit is contained in:
Jennifer Taylor 2022-08-17 01:38:04 +00:00
parent 8d67760788
commit 05e4ef0cb8
5 changed files with 26 additions and 3 deletions

View File

@ -37,6 +37,7 @@ class CatalogObject(BaseObject):
def __format_jubeat_song(self, song: Song) -> Dict[str, Any]: def __format_jubeat_song(self, song: Song) -> Dict[str, Any]:
return { return {
'difficulty': song.data.get_int('difficulty'), 'difficulty': song.data.get_int('difficulty'),
'category': song.data.get_int('version'),
'bpm_min': song.data.get_int('bpm_min'), 'bpm_min': song.data.get_int('bpm_min'),
'bpm_max': song.data.get_int('bpm_max'), 'bpm_max': song.data.get_int('bpm_max'),
} }

View File

@ -923,6 +923,7 @@ class GlobalMusicData(BaseGlobalData):
'bpm_min': int(data['bpm_min']), 'bpm_min': int(data['bpm_min']),
'bpm_max': int(data['bpm_max']), 'bpm_max': int(data['bpm_max']),
'difficulty': int(data['difficulty']), 'difficulty': int(data['difficulty']),
'version': int(data.get('category', int(songid / 10000000))),
}, },
) )

View File

@ -80,6 +80,21 @@ class JubeatFrontend(FrontendBase):
formatted_song['bpm_min'] = song.data.get_int('bpm_min', 120) formatted_song['bpm_min'] = song.data.get_int('bpm_min', 120)
formatted_song['bpm_max'] = song.data.get_int('bpm_max', 120) formatted_song['bpm_max'] = song.data.get_int('bpm_max', 120)
formatted_song['difficulties'] = difficulties formatted_song['difficulties'] = difficulties
formatted_song['version'] = {
VersionConstants.JUBEAT: 1,
VersionConstants.JUBEAT_RIPPLES: 2,
VersionConstants.JUBEAT_RIPPLES_APPEND: 2,
VersionConstants.JUBEAT_KNIT: 3,
VersionConstants.JUBEAT_KNIT_APPEND: 3,
VersionConstants.JUBEAT_COPIOUS: 4,
VersionConstants.JUBEAT_COPIOUS_APPEND: 4,
VersionConstants.JUBEAT_SAUCER: 5,
VersionConstants.JUBEAT_SAUCER_FULFILL: 5,
VersionConstants.JUBEAT_PROP: 6,
VersionConstants.JUBEAT_QUBELL: 7,
VersionConstants.JUBEAT_CLAN: 8,
VersionConstants.JUBEAT_FESTO: 9,
}.get(song.data.get_int('version', 1), 1)
return formatted_song return formatted_song
def merge_song(self, existing: Dict[str, Any], new: Song) -> Dict[str, Any]: def merge_song(self, existing: Dict[str, Any], new: Song) -> Dict[str, Any]:

View File

@ -129,7 +129,11 @@ var network_records = React.createClass({
renderBySeries: function() { renderBySeries: function() {
var songids = Object.keys(this.state.songs).sort(function(a, b) { var songids = Object.keys(this.state.songs).sort(function(a, b) {
return parseInt(b) - parseInt(a); if (this.state.songs[a].version == this.state.songs[b].version) {
return parseInt(b) - parseInt(a);
} else {
return this.state.songs[b].version - this.state.songs[a].version;
}
}.bind(this)); }.bind(this));
if (window.filterempty) { if (window.filterempty) {
songids = songids.filter(function(songid) { songids = songids.filter(function(songid) {
@ -139,7 +143,7 @@ var network_records = React.createClass({
var lastSeries = 0; var lastSeries = 0;
var lastSeries = 0; var lastSeries = 0;
for (var i = 0; i < songids.length; i++) { for (var i = 0; i < songids.length; i++) {
var curSeries = Math.floor(songids[i] / 10000000); var curSeries = this.state.songs[songids[i]].version;
if (curSeries != lastSeries) { if (curSeries != lastSeries) {
lastSeries = curSeries; lastSeries = curSeries;
songids.splice(i, 0, curSeries); songids.splice(i, 0, curSeries);

View File

@ -1384,6 +1384,7 @@ class ImportJubeat(ImportBase):
'title': None, 'title': None,
'artist': None, 'artist': None,
'genre': genre, 'genre': genre,
'version': version_to_db_constant.get(earliest_version),
'bpm_min': bpm_min, 'bpm_min': bpm_min,
'bpm_max': bpm_max, 'bpm_max': bpm_max,
'difficulty': { 'difficulty': {
@ -1391,7 +1392,6 @@ class ImportJubeat(ImportBase):
'advanced': difficulties[1], 'advanced': difficulties[1],
'extreme': difficulties[2], 'extreme': difficulties[2],
}, },
'version': version_to_db_constant.get(earliest_version),
}) })
emblems: List[Dict[str, Any]] = [] emblems: List[Dict[str, Any]] = []
@ -1446,6 +1446,7 @@ class ImportJubeat(ImportBase):
'title': song.name, 'title': song.name,
'artist': song.artist, 'artist': song.artist,
'genre': song.genre, 'genre': song.genre,
'version': song.data.get_int('version'),
'bpm_min': song.data.get_int('bpm_min'), 'bpm_min': song.data.get_int('bpm_min'),
'bpm_max': song.data.get_int('bpm_max'), 'bpm_max': song.data.get_int('bpm_max'),
'difficulty': { 'difficulty': {
@ -1512,6 +1513,7 @@ class ImportJubeat(ImportBase):
'difficulty': song['difficulty'][chart_map[chart]], 'difficulty': song['difficulty'][chart_map[chart]],
'bpm_min': song['bpm_min'], 'bpm_min': song['bpm_min'],
'bpm_max': song['bpm_max'], 'bpm_max': song['bpm_max'],
'version': song['version'],
} }
self.insert_music_id_for_song(next_id, songid, chart, song['title'], song['artist'], song['genre'], data) self.insert_music_id_for_song(next_id, songid, chart, song['title'], song['artist'], song['genre'], data)
self.finish_batch() self.finish_batch()