diff --git a/bemani/api/objects/catalog.py b/bemani/api/objects/catalog.py index 7738a6f..b6e066d 100644 --- a/bemani/api/objects/catalog.py +++ b/bemani/api/objects/catalog.py @@ -37,6 +37,7 @@ class CatalogObject(BaseObject): def __format_jubeat_song(self, song: Song) -> Dict[str, Any]: return { 'difficulty': song.data.get_int('difficulty'), + 'category': song.data.get_int('version'), 'bpm_min': song.data.get_int('bpm_min'), 'bpm_max': song.data.get_int('bpm_max'), } diff --git a/bemani/data/api/music.py b/bemani/data/api/music.py index 15e5ca2..f17022a 100644 --- a/bemani/data/api/music.py +++ b/bemani/data/api/music.py @@ -923,6 +923,7 @@ class GlobalMusicData(BaseGlobalData): 'bpm_min': int(data['bpm_min']), 'bpm_max': int(data['bpm_max']), 'difficulty': int(data['difficulty']), + 'version': int(data.get('category', int(songid / 10000000))), }, ) diff --git a/bemani/frontend/jubeat/jubeat.py b/bemani/frontend/jubeat/jubeat.py index 907cfad..601962e 100644 --- a/bemani/frontend/jubeat/jubeat.py +++ b/bemani/frontend/jubeat/jubeat.py @@ -80,6 +80,21 @@ class JubeatFrontend(FrontendBase): formatted_song['bpm_min'] = song.data.get_int('bpm_min', 120) formatted_song['bpm_max'] = song.data.get_int('bpm_max', 120) 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 def merge_song(self, existing: Dict[str, Any], new: Song) -> Dict[str, Any]: diff --git a/bemani/frontend/static/controllers/jubeat/records.react.js b/bemani/frontend/static/controllers/jubeat/records.react.js index 31d0b7e..29d2cdb 100644 --- a/bemani/frontend/static/controllers/jubeat/records.react.js +++ b/bemani/frontend/static/controllers/jubeat/records.react.js @@ -129,7 +129,11 @@ var network_records = React.createClass({ renderBySeries: function() { 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)); if (window.filterempty) { songids = songids.filter(function(songid) { @@ -139,7 +143,7 @@ var network_records = React.createClass({ var lastSeries = 0; var lastSeries = 0; 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) { lastSeries = curSeries; songids.splice(i, 0, curSeries); diff --git a/bemani/utils/read.py b/bemani/utils/read.py index 38be806..233e980 100644 --- a/bemani/utils/read.py +++ b/bemani/utils/read.py @@ -1384,6 +1384,7 @@ class ImportJubeat(ImportBase): 'title': None, 'artist': None, 'genre': genre, + 'version': version_to_db_constant.get(earliest_version), 'bpm_min': bpm_min, 'bpm_max': bpm_max, 'difficulty': { @@ -1391,7 +1392,6 @@ class ImportJubeat(ImportBase): 'advanced': difficulties[1], 'extreme': difficulties[2], }, - 'version': version_to_db_constant.get(earliest_version), }) emblems: List[Dict[str, Any]] = [] @@ -1446,6 +1446,7 @@ class ImportJubeat(ImportBase): 'title': song.name, 'artist': song.artist, 'genre': song.genre, + 'version': song.data.get_int('version'), 'bpm_min': song.data.get_int('bpm_min'), 'bpm_max': song.data.get_int('bpm_max'), 'difficulty': { @@ -1512,6 +1513,7 @@ class ImportJubeat(ImportBase): 'difficulty': song['difficulty'][chart_map[chart]], 'bpm_min': song['bpm_min'], '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.finish_batch()