2023-11-20 16:33:41 +01:00
from argparse import ArgumentParser
2023-11-17 14:46:53 +01:00
from enum import Enum
import json
2023-11-20 12:31:57 +01:00
from helpers import (
doesPathExist ,
findAllObjects ,
findDoubloninList ,
findKeyInList ,
isChn ,
loadFile ,
)
2023-11-20 16:33:41 +01:00
if __name__ == " __main__ " :
parser = ArgumentParser ( )
parser . add_argument (
" -l " ,
" --language " ,
default = " englishUsText " ,
help = " This sets the language used for sorting the files. Possible values are : japaneseText, englishUsText, chineseTText, chineseSText and koreanText " ,
)
args = parser . parse_args ( )
language = args . language
if language not in [
" japaneseText " ,
" englishUsText " ,
" chineseTText " ,
" chineseSText " ,
" koreanText " ,
] :
print (
" Invalid language, Possible values are : japaneseText, englishUsText, chineseTText, chineseSText and koreanText "
)
exit ( 1 )
2023-11-17 14:46:53 +01:00
2023-11-20 12:31:57 +01:00
isChn = isChn ( )
2023-11-21 14:54:27 +01:00
songs = [ ]
2023-11-17 14:46:53 +01:00
# region Loading files
checkFile = { }
2023-11-20 12:31:57 +01:00
infos = loadFile ( path = " ./Data/x64/datatable/musicinfo.bin " )
2023-11-21 14:54:27 +01:00
usbs = loadFile ( path = " ./Data/x64/datatable/music_usbsetting.bin " )
orders = loadFile ( path = " ./Data/x64/datatable/music_order.bin " )
2023-11-20 12:31:57 +01:00
attributes = loadFile ( path = " ./Data/x64/datatable/music_attribute.bin " )
words = loadFile ( path = " ./Data/x64/datatable/wordlist.bin " )
2023-11-17 14:46:53 +01:00
# endregion
# region Classes And Methods
class Genres ( Enum ) :
Unknown = - 1
Pop = 0
Anime = 1
Kids = 2
Vocaloid = 3
GameMusic = 4
NamcoOriginal = 5
2023-11-21 11:12:49 +01:00
Variety = 6 if isChn else 7
Classical = 7 if isChn else 8
2023-11-20 12:31:57 +01:00
if not isChn :
2023-11-17 14:46:53 +01:00
Custom = 9
@classmethod
def _missing_ ( cls , value ) :
return cls . Unknown
def initCheckFile ( ) :
global checkFile
checkFile = {
2023-11-21 14:54:27 +01:00
" stats " : {
" TotalSongs " : 0 ,
" MaxId " : 0 ,
2023-11-17 14:46:53 +01:00
" UniqueIdTooHigh " : 0 ,
" UniqueIdTooHighList " : [ ] ,
" UnusedUniqueIds " : 0 ,
" UnusedUniqueIdsList " : [ ] ,
2023-11-21 14:54:27 +01:00
} ,
}
if infos is not None :
checkFile [ " musicinfo.bin " ] = {
" TotalEntries " : len ( infos ) ,
" Missing " : 0 ,
" MissingList " : [ ] ,
2023-11-17 14:46:53 +01:00
" Doublons " : 0 ,
" DoublonsList " : [ ] ,
" GenreNoList " : [ ] ,
2023-11-21 14:54:27 +01:00
}
for song in infos :
name = findKeyInList (
list = words ,
key = " key " ,
keyValue = " song_ " + song [ " id " ] ,
value = language ,
)
sub = findKeyInList (
list = words ,
key = " key " ,
keyValue = " song_sub_ " + song [ " id " ] ,
value = language ,
)
detail = findKeyInList (
list = words ,
key = " key " ,
keyValue = " song_detail_ " + song [ " id " ] ,
value = language ,
)
songs . append (
{
" id " : song [ " id " ] ,
" uniqueId " : song [ " uniqueId " ] ,
" genreNo " : song [ " genreNo " ] ,
" name " : name ,
" sub " : sub ,
" detail " : detail ,
}
)
2023-11-17 14:46:53 +01:00
if attributes is not None :
2023-11-21 11:12:49 +01:00
checkFile [ " music_attribute.bin " ] = {
2023-11-17 14:46:53 +01:00
" TotalEntries " : len ( attributes ) ,
" Missing " : 0 ,
" MissingList " : [ ] ,
" Mismatch " : 0 ,
" MismatchList " : [ ] ,
" Doublons " : 0 ,
" DoublonsList " : [ ] ,
}
2023-11-21 14:54:27 +01:00
for song in attributes :
temp = findKeyInList ( list = songs , key = " id " , keyValue = song [ " id " ] )
if temp is not None :
continue
name = findKeyInList (
list = words ,
key = " key " ,
keyValue = " song_ " + song [ " id " ] ,
value = language ,
)
sub = findKeyInList (
list = words ,
key = " key " ,
keyValue = " song_sub_ " + song [ " id " ] ,
value = language ,
)
detail = findKeyInList (
list = words ,
key = " key " ,
keyValue = " song_detail_ " + song [ " id " ] ,
value = language ,
)
genreNo = findKeyInList (
list = infos ,
key = " id " ,
keyValue = song [ " id " ] ,
value = " genreNo " ,
)
songs . append (
{
" id " : song [ " id " ] ,
" uniqueId " : song [ " uniqueId " ] ,
" genreNo " : genreNo ,
" name " : name ,
" sub " : sub ,
" detail " : detail ,
}
)
2023-11-17 14:46:53 +01:00
2023-11-21 14:54:27 +01:00
if orders is not None :
2023-11-21 11:12:49 +01:00
checkFile [ " music_order.bin " ] = {
2023-11-21 14:54:27 +01:00
" TotalEntries " : len ( orders ) ,
2023-11-17 14:46:53 +01:00
" UniqueEntries " : 0 ,
" UniqueEntriesList " : [ ] ,
" GenreNoList " : [ ] ,
" Missing " : 0 ,
" MissingList " : [ ] ,
" Mismatch " : 0 ,
" MismatchList " : [ ] ,
}
2023-11-21 14:54:27 +01:00
for song in orders :
temp = findKeyInList ( list = songs , key = " id " , keyValue = song [ " id " ] )
if temp is not None :
continue
name = findKeyInList (
list = words ,
key = " key " ,
keyValue = " song_ " + song [ " id " ] ,
value = language ,
)
sub = findKeyInList (
list = words ,
key = " key " ,
keyValue = " song_sub_ " + song [ " id " ] ,
value = language ,
)
detail = findKeyInList (
list = words ,
key = " key " ,
keyValue = " song_detail_ " + song [ " id " ] ,
value = language ,
)
genreNo = findKeyInList (
list = infos ,
key = " id " ,
keyValue = song [ " id " ] ,
value = " genreNo " ,
)
songs . append (
{
" id " : song [ " id " ] ,
" uniqueId " : song [ " uniqueId " ] ,
" genreNo " : genreNo ,
" name " : name ,
" sub " : sub ,
" detail " : detail ,
}
)
2023-11-17 14:46:53 +01:00
2023-11-21 14:54:27 +01:00
if usbs is not None :
2023-11-21 11:12:49 +01:00
checkFile [ " music_usbsetting.bin " ] = {
2023-11-21 14:54:27 +01:00
" TotalEntries " : len ( usbs ) ,
2023-11-17 14:46:53 +01:00
" Missing " : 0 ,
" MissingList " : [ ] ,
" Mismatch " : 0 ,
" MismatchList " : [ ] ,
" Doublons " : 0 ,
" DoublonsList " : [ ] ,
}
2023-11-21 14:54:27 +01:00
for song in usbs :
temp = findKeyInList ( list = songs , key = " id " , keyValue = song [ " id " ] )
if temp is not None :
continue
name = findKeyInList (
list = words ,
key = " key " ,
keyValue = " song_ " + song [ " id " ] ,
value = language ,
)
sub = findKeyInList (
list = words ,
key = " key " ,
keyValue = " song_sub_ " + song [ " id " ] ,
value = language ,
)
detail = findKeyInList (
list = words ,
key = " key " ,
keyValue = " song_detail_ " + song [ " id " ] ,
value = language ,
)
genreNo = findKeyInList (
list = infos ,
key = " id " ,
keyValue = song [ " id " ] ,
value = " genreNo " ,
)
songs . append (
{
" id " : song [ " id " ] ,
" uniqueId " : song [ " uniqueId " ] ,
" genreNo " : genreNo ,
" name " : name ,
" sub " : sub ,
" detail " : detail ,
}
)
2023-11-17 14:46:53 +01:00
if words is not None :
2023-11-21 11:12:49 +01:00
checkFile [ " wordlist.bin " ] = {
2023-11-17 14:46:53 +01:00
" TotalEntries " : len ( words ) ,
" MissingSongName " : 0 ,
" MissingSongNameList " : [ ] ,
" MissingSongSub " : 0 ,
" MissingSongSubList " : [ ] ,
" MissingSongDetail " : 0 ,
" MissingSongDetailList " : [ ] ,
" Doublons " : 0 ,
" DoublonsList " : [ ] ,
}
2023-11-21 14:54:27 +01:00
if all ( [ doesPathExist ( " ./Data/x64/fumen " ) , doesPathExist ( " ./Data/x64/sound " ) ] ) :
checkFile . update (
{
" GameFiles " : {
" MissingSound " : 0 ,
" MissingSoundList " : [ ] ,
" MissingFumen " : 0 ,
" MissingFumenList " : [ ] ,
} ,
}
)
2023-11-17 14:46:53 +01:00
2023-11-21 14:54:27 +01:00
# Update stats
checkFile [ " stats " ] [ " TotalSongs " ] = len ( songs )
checkFile [ " stats " ] [ " MaxId " ] = max ( songs , key = lambda ev : ev [ " uniqueId " ] ) [ " uniqueId " ]
2023-11-17 14:46:53 +01:00
2023-11-21 14:54:27 +01:00
print ( " Found a total of " , str ( len ( songs ) ) , " songs in datatables " )
2023-11-17 14:46:53 +01:00
2023-11-21 14:54:27 +01:00
# endregion
2023-11-17 14:46:53 +01:00
# Preparing the json file containing the results of this checking script
initCheckFile ( )
# Checking...
for song in songs :
2023-11-21 14:54:27 +01:00
# stats
# Checking for too high of an id
if song [ " uniqueId " ] > 1599 :
checkFile [ " stats " ] [ " UniqueIdTooHigh " ] + = 1
checkFile [ " stats " ] [ " UniqueIdTooHighList " ] . append (
{
" id " : song [ " id " ] ,
" uniqueId " : song [ " uniqueId " ] ,
}
)
2023-11-21 11:12:49 +01:00
# musicinfo.bin
2023-11-17 14:46:53 +01:00
if infos is not None :
2023-11-21 14:54:27 +01:00
# Check for missing uniqueIds or id and uniqueId mismatches
orderOccurences = findAllObjects ( list = infos , key = " id " , keyValue = song [ " id " ] )
if len ( orderOccurences ) == 0 :
checkFile [ " musicinfo.bin " ] [ " Missing " ] + = 1
checkFile [ " musicinfo.bin " ] [ " MissingList " ] . append ( song [ " id " ] )
2023-11-17 14:46:53 +01:00
# Listing genres and counting entries for each genres
genre = {
2023-11-21 14:54:27 +01:00
" GenreNo " : song [ " genreNo " ] ,
" Name " : Genres ( song [ " genreNo " ] ) . name ,
2023-11-17 14:46:53 +01:00
" NumberofSongs " : 0 ,
}
if (
findKeyInList (
2023-11-21 11:12:49 +01:00
list = checkFile [ " musicinfo.bin " ] [ " GenreNoList " ] ,
2023-11-17 14:46:53 +01:00
key = " GenreNo " ,
2023-11-21 14:54:27 +01:00
keyValue = song [ " genreNo " ] ,
2023-11-17 14:46:53 +01:00
)
is None
) :
genre [ " NumberofSongs " ] = len (
2023-11-21 14:54:27 +01:00
findAllObjects ( list = infos , key = " genreNo " , keyValue = song [ " genreNo " ] )
2023-11-17 14:46:53 +01:00
)
2023-11-21 11:12:49 +01:00
checkFile [ " musicinfo.bin " ] [ " GenreNoList " ] . append ( genre )
2023-11-17 14:46:53 +01:00
# Search doublons
2023-11-21 14:54:27 +01:00
if findDoubloninList ( list = infos , key = " id " , keyValue = song [ " id " ] ) :
if song [ " id " ] not in checkFile [ " musicinfo.bin " ] [ " DoublonsList " ] :
2023-11-21 11:12:49 +01:00
checkFile [ " musicinfo.bin " ] [ " Doublons " ] + = 1
2023-11-21 14:54:27 +01:00
checkFile [ " musicinfo.bin " ] [ " DoublonsList " ] . append ( song [ " id " ] )
2023-11-17 14:46:53 +01:00
2023-11-21 14:54:27 +01:00
if findDoubloninList ( list = infos , key = " uniqueId " , keyValue = song [ " uniqueId " ] ) :
if song [ " uniqueId " ] not in checkFile [ " musicinfo.bin " ] [ " DoublonsList " ] :
2023-11-21 11:12:49 +01:00
checkFile [ " musicinfo.bin " ] [ " Doublons " ] + = 1
2023-11-21 14:54:27 +01:00
checkFile [ " musicinfo.bin " ] [ " DoublonsList " ] . append ( song [ " uniqueId " ] )
2023-11-21 11:12:49 +01:00
2023-11-21 14:54:27 +01:00
# music_attribute.bin
if attributes is not None :
2023-11-17 14:46:53 +01:00
# Check for missing uniqueIds or id and uniqueId mismatches
2023-11-21 14:54:27 +01:00
orderOccurences = findAllObjects ( list = attributes , key = " id " , keyValue = song [ " id " ] )
2023-11-17 14:46:53 +01:00
if len ( orderOccurences ) == 0 :
2023-11-21 14:54:27 +01:00
checkFile [ " music_attribute.bin " ] [ " Missing " ] + = 1
checkFile [ " music_attribute.bin " ] [ " MissingList " ] . append ( song [ " id " ] )
2023-11-17 14:46:53 +01:00
else :
for occurence in orderOccurences :
if not all (
2023-11-21 14:54:27 +01:00
[
song [ " id " ] == occurence [ " id " ] ,
song [ " uniqueId " ] == occurence [ " uniqueId " ] ,
]
2023-11-17 14:46:53 +01:00
) :
2023-11-21 14:54:27 +01:00
if (
song [ " id " ]
not in checkFile [ " music_attribute.bin " ] [ " MismatchList " ]
) :
checkFile [ " music_attribute.bin " ] [ " Mismatch " ] + = 1
checkFile [ " music_attribute.bin " ] [ " MismatchList " ] . append (
2023-11-17 14:46:53 +01:00
{
2023-11-21 14:54:27 +01:00
" id " : song [ " id " ] ,
" ExpectedUniqueId " : song [ " uniqueId " ] ,
2023-11-17 14:46:53 +01:00
" CurrentUniqueId " : occurence [ " uniqueId " ] ,
}
)
2023-11-21 14:54:27 +01:00
if findDoubloninList ( list = attributes , key = " id " , keyValue = song [ " id " ] ) :
if song [ " id " ] not in checkFile [ " music_attribute.bin " ] [ " DoublonsList " ] :
checkFile [ " music_attribute.bin " ] [ " Doublons " ] + = 1
checkFile [ " music_attribute.bin " ] [ " DoublonsList " ] . append ( song [ " id " ] )
if findDoubloninList (
list = attributes , key = " uniqueId " , keyValue = song [ " uniqueId " ]
) :
if song [ " uniqueId " ] not in checkFile [ " musicinfo.bin " ] [ " DoublonsList " ] :
checkFile [ " music_attribute.bin " ] [ " Doublons " ] + = 1
checkFile [ " music_attribute.bin " ] [ " DoublonsList " ] . append (
song [ " uniqueId " ]
)
2023-11-17 14:46:53 +01:00
2023-11-21 14:54:27 +01:00
# music_usbsetting.bin
if usbs is not None :
2023-11-17 14:46:53 +01:00
# Check for missing uniqueIds or id and uniqueId mismatches
2023-11-21 14:54:27 +01:00
orderOccurences = findAllObjects ( list = usbs , key = " id " , keyValue = song [ " id " ] )
2023-11-17 14:46:53 +01:00
if len ( orderOccurences ) == 0 :
2023-11-21 14:54:27 +01:00
checkFile [ " music_usbsetting.bin " ] [ " Missing " ] + = 1
checkFile [ " music_usbsetting.bin " ] [ " MissingList " ] . append ( song [ " id " ] )
2023-11-17 14:46:53 +01:00
else :
for occurence in orderOccurences :
if not all (
2023-11-21 14:54:27 +01:00
[
song [ " id " ] == occurence [ " id " ] ,
song [ " uniqueId " ] == occurence [ " uniqueId " ] ,
]
2023-11-17 14:46:53 +01:00
) :
2023-11-21 14:54:27 +01:00
if (
song [ " id " ]
not in checkFile [ " music_usbsetting.bin " ] [ " MismatchList " ]
) :
checkFile [ " music_usbsetting.bin " ] [ " Mismatch " ] + = 1
checkFile [ " music_usbsetting.bin " ] [ " MismatchList " ] . append (
2023-11-17 14:46:53 +01:00
{
2023-11-21 14:54:27 +01:00
" id " : song [ " id " ] ,
" ExpectedUniqueId " : song [ " uniqueId " ] ,
2023-11-17 14:46:53 +01:00
" CurrentUniqueId " : occurence [ " uniqueId " ] ,
}
)
2023-11-21 14:54:27 +01:00
# Search doublons
if findDoubloninList ( list = usbs , key = " id " , keyValue = song [ " id " ] ) :
if song [ " id " ] not in checkFile [ " music_usbsetting.bin " ] [ " DoublonsList " ] :
checkFile [ " music_usbsetting.bin " ] [ " Doublons " ] + = 1
checkFile [ " music_usbsetting.bin " ] [ " DoublonsList " ] . append ( song [ " id " ] )
if findDoubloninList ( list = usbs , key = " uniqueId " , keyValue = song [ " uniqueId " ] ) :
if song [ " uniqueId " ] not in checkFile [ " musicinfo.bin " ] [ " DoublonsList " ] :
checkFile [ " music_usbsetting.bin " ] [ " Doublons " ] + = 1
checkFile [ " music_usbsetting.bin " ] [ " DoublonsList " ] . append (
song [ " uniqueId " ]
)
2023-11-21 11:12:49 +01:00
# music_order.bin
2023-11-21 14:54:27 +01:00
if orders is not None :
2023-11-17 14:46:53 +01:00
# Check for missing uniqueIds or id and uniqueId mismatches
2023-11-21 14:54:27 +01:00
orderOccurences = findAllObjects ( list = orders , key = " id " , keyValue = song [ " id " ] )
2023-11-17 14:46:53 +01:00
if len ( orderOccurences ) == 0 :
2023-11-21 11:12:49 +01:00
checkFile [ " music_order.bin " ] [ " Missing " ] + = 1
2023-11-21 14:54:27 +01:00
checkFile [ " music_order.bin " ] [ " MissingList " ] . append ( song [ " id " ] )
2023-11-17 14:46:53 +01:00
else :
songGenres = [ ]
for occurence in orderOccurences :
songGenres . append ( occurence [ " genreNo " ] )
if not all (
2023-11-21 14:54:27 +01:00
[
song [ " id " ] == occurence [ " id " ] ,
song [ " uniqueId " ] == occurence [ " uniqueId " ] ,
]
2023-11-17 14:46:53 +01:00
) :
2023-11-21 14:54:27 +01:00
if song [ " id " ] not in checkFile [ " music_order.bin " ] [ " MismatchList " ] :
2023-11-21 11:12:49 +01:00
checkFile [ " music_order.bin " ] [ " Mismatch " ] + = 1
checkFile [ " music_order.bin " ] [ " MismatchList " ] . append (
2023-11-17 14:46:53 +01:00
{
2023-11-21 14:54:27 +01:00
" id " : song [ " id " ] ,
" ExpectedUniqueId " : song [ " uniqueId " ] ,
2023-11-17 14:46:53 +01:00
" CurrentUniqueId " : occurence [ " uniqueId " ] ,
}
)
# Counting unique entries
2023-11-21 11:12:49 +01:00
checkFile [ " music_order.bin " ] [ " UniqueEntries " ] + = 1
checkFile [ " music_order.bin " ] [ " UniqueEntriesList " ] . append (
2023-11-17 14:46:53 +01:00
{
2023-11-21 14:54:27 +01:00
song [ " id " ] : songGenres ,
2023-11-17 14:46:53 +01:00
}
)
2023-11-21 11:12:49 +01:00
# wordlist.bin
2023-11-17 14:46:53 +01:00
if words is not None :
2023-11-21 14:54:27 +01:00
if song [ " name " ] == " " :
2023-11-21 11:12:49 +01:00
checkFile [ " wordlist.bin " ] [ " MissingSongName " ] + = 1
2023-11-21 14:54:27 +01:00
checkFile [ " wordlist.bin " ] [ " MissingSongNameList " ] . append ( song [ " id " ] )
if song [ " sub " ] == " " :
2023-11-21 11:12:49 +01:00
checkFile [ " wordlist.bin " ] [ " MissingSongSub " ] + = 1
2023-11-21 14:54:27 +01:00
checkFile [ " wordlist.bin " ] [ " MissingSongSubList " ] . append ( song [ " id " ] )
if song [ " detail " ] == " " :
2023-11-21 11:12:49 +01:00
checkFile [ " wordlist.bin " ] [ " MissingSongDetail " ] + = 1
2023-11-21 14:54:27 +01:00
checkFile [ " wordlist.bin " ] [ " MissingSongDetailList " ] . append ( song [ " id " ] )
2023-11-17 14:46:53 +01:00
# Gamefiles
2023-11-21 14:54:27 +01:00
if all ( [ doesPathExist ( " ./Data/x64/fumen " ) , doesPathExist ( " ./Data/x64/sound " ) ] ) :
if not doesPathExist ( " ./Data/x64/sound/ " + " song_ " + song [ " id " ] + " .nus3bank " ) :
checkFile [ " GameFiles " ] [ " MissingSound " ] + = 1
checkFile [ " GameFiles " ] [ " MissingSoundList " ] . append ( song [ " id " ] )
if not doesPathExist ( " ./Data/x64/fumen/ " + song [ " id " ] ) :
checkFile [ " GameFiles " ] [ " MissingFumen " ] + = 1
checkFile [ " GameFiles " ] [ " MissingFumenList " ] . append ( song [ " id " ] )
2023-11-17 14:46:53 +01:00
# Checking for vacant uniqueIds
2023-11-21 14:54:27 +01:00
for i in range ( max ( checkFile [ " stats " ] [ " MaxId " ] , 1600 ) ) :
key = findKeyInList ( list = songs , key = " uniqueId " , keyValue = i )
2023-11-17 14:46:53 +01:00
if key is not None :
2023-11-21 11:12:49 +01:00
# Updating GenreNoList of music_order.bin
2023-11-21 14:54:27 +01:00
if orders is not None :
for song in findAllObjects (
list = orders , key = " uniqueId " , keyValue = key [ " uniqueId " ]
2023-11-17 14:46:53 +01:00
) :
2023-11-21 14:54:27 +01:00
genre = {
" GenreNo " : song [ " genreNo " ] ,
" Name " : Genres ( song [ " genreNo " ] ) . name ,
" NumberofSongs " : 0 ,
}
if (
findKeyInList (
list = checkFile [ " music_order.bin " ] [ " GenreNoList " ] ,
key = " GenreNo " ,
keyValue = song [ " genreNo " ] ,
)
is None
) :
genre [ " NumberofSongs " ] = len (
findAllObjects (
list = orders , key = " genreNo " , keyValue = song [ " genreNo " ]
)
)
checkFile [ " music_order.bin " ] [ " GenreNoList " ] . append ( genre )
2023-11-17 14:46:53 +01:00
else :
# Finding unused Ids bellow 1599
if i < 1600 :
2023-11-21 14:54:27 +01:00
checkFile [ " stats " ] [ " UnusedUniqueIds " ] + = 1
checkFile [ " stats " ] [ " UnusedUniqueIdsList " ] . append ( i )
2023-11-17 14:46:53 +01:00
# Checking for doublons in wordlist
if words is not None :
for word in words :
if findDoubloninList ( list = words , key = " key " , keyValue = word [ " key " ] ) :
2023-11-21 11:12:49 +01:00
if word [ " key " ] not in checkFile [ " wordlist.bin " ] [ " DoublonsList " ] :
checkFile [ " wordlist.bin " ] [ " Doublons " ] + = 1
checkFile [ " wordlist.bin " ] [ " DoublonsList " ] . append ( word [ " key " ] )
2023-11-17 14:46:53 +01:00
2023-11-21 14:54:27 +01:00
2023-11-17 14:46:53 +01:00
# Sorting some values for better readability
2023-11-21 14:54:27 +01:00
if infos is not None :
checkFile [ " musicinfo.bin " ] [ " GenreNoList " ] . sort (
key = lambda x : str ( x [ " GenreNo " ] ) , reverse = False
)
if orders is not None :
checkFile [ " music_order.bin " ] [ " GenreNoList " ] . sort (
key = lambda x : str ( x [ " GenreNo " ] ) , reverse = False
)
2023-11-17 14:46:53 +01:00
# Writing everything to checks.json
json_object = json . dumps ( checkFile , ensure_ascii = False , indent = " \t " )
# json_object = json.dumps(jsonList, ensure_ascii=False, indent="\t")
with open ( " ./checks.json " , " w " , encoding = " utf8 " ) as outfile :
outfile . write ( json_object )
print ( " Wrote checks. \n " )