Updated checkDatatables.py, added language switch
This commit is contained in:
parent
17695a7b9a
commit
beb8feede8
10
README.md
10
README.md
@ -70,7 +70,8 @@ py sortAlphabetically.py --restore
|
||||
|
||||
## checkDatatables.py
|
||||
|
||||
This script generates a comprehensive list of various informations regarding your database files. It is meant to be used for basic checks such as:
|
||||
This script generates a comprehensive list of various informations regarding your database files for a given language.
|
||||
It is meant to be used for basic checks such as:
|
||||
|
||||
* Listing the amount of songs in your tables
|
||||
* Listing all vacant entries bellow 1599 to facilitate adding songs in
|
||||
@ -80,8 +81,13 @@ This script generates a comprehensive list of various informations regarding you
|
||||
* Checking for id and uniqueId mismatches in various files
|
||||
* Checking for missing sound and fumen files
|
||||
|
||||
Possible languages are : japaneseText, englishUsText, chineseTText, chineseSText and koreanText.
|
||||
|
||||
To run this one you simply need to call it like so:
|
||||
|
||||
> py checkDatatables.py
|
||||
```py
|
||||
# Check datatables
|
||||
py checkDatatables.py --language "englishUsText"
|
||||
```
|
||||
|
||||
The output will be written in a file named `checks.json`
|
||||
|
@ -1,8 +1,6 @@
|
||||
from argparse import ArgumentParser
|
||||
from enum import Enum
|
||||
import gzip
|
||||
from encryption import decrypt_file
|
||||
import json
|
||||
import os
|
||||
|
||||
from helpers import (
|
||||
doesPathExist,
|
||||
@ -13,12 +11,29 @@ from helpers import (
|
||||
loadFile,
|
||||
)
|
||||
|
||||
# "japaneseText"
|
||||
# "englishUsText"
|
||||
# "chineseTText"
|
||||
# "koreanText"
|
||||
# "chineseSText"
|
||||
language = "englishUsText"
|
||||
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)
|
||||
|
||||
isChn = isChn()
|
||||
|
||||
@ -32,10 +47,6 @@ attributes = loadFile(path="./Data/x64/datatable/music_attribute.bin")
|
||||
words = loadFile(path="./Data/x64/datatable/wordlist.bin")
|
||||
# endregion
|
||||
|
||||
# Forcing japanese language on 08.18 as this is what is usually used for omnimix.
|
||||
if isCHN:
|
||||
language = "japaneseText"
|
||||
|
||||
|
||||
# region Classes And Methods
|
||||
class Genres(Enum):
|
||||
@ -56,42 +67,21 @@ class Genres(Enum):
|
||||
return cls.Unknown
|
||||
|
||||
|
||||
def findKeyInList(list: list, key: str, keyValue, value=None):
|
||||
for object in list:
|
||||
if object[key] == keyValue:
|
||||
if value is not None:
|
||||
return object[value]
|
||||
else:
|
||||
return object
|
||||
class Song:
|
||||
id = ""
|
||||
uniqueId = -1
|
||||
genreNo = -1
|
||||
name = ""
|
||||
sub = ""
|
||||
detail = ""
|
||||
|
||||
if value is not None:
|
||||
return ""
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def findAllObjects(list: list, key: str, keyValue):
|
||||
templist = []
|
||||
templist.append(list)
|
||||
objects = []
|
||||
|
||||
for element in templist[0]:
|
||||
if element[key] == keyValue:
|
||||
objects.append(element)
|
||||
|
||||
return objects
|
||||
|
||||
|
||||
def findDoubloninList(list: list, key: str, keyValue):
|
||||
if len(findAllObjects(list=list, key=key, keyValue=keyValue)) > 1:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def doesPathExist(path: str):
|
||||
if os.path.exists(path):
|
||||
return True
|
||||
return False
|
||||
def __init__(self, id, uniqueId, genreNo, name, sub, detail):
|
||||
self.id = id
|
||||
self.uniqueId = uniqueId
|
||||
self.genreNo = genreNo
|
||||
self.name = name
|
||||
self.sub = sub
|
||||
self.detail = detail
|
||||
|
||||
|
||||
def initCheckFile():
|
||||
@ -169,23 +159,6 @@ def initCheckFile():
|
||||
)
|
||||
|
||||
|
||||
class Song:
|
||||
id = ""
|
||||
uniqueId = -1
|
||||
genreNo = -1
|
||||
name = ""
|
||||
sub = ""
|
||||
detail = ""
|
||||
|
||||
def __init__(self, id, uniqueId, genreNo, name, sub, detail):
|
||||
self.id = id
|
||||
self.uniqueId = uniqueId
|
||||
self.genreNo = genreNo
|
||||
self.name = name
|
||||
self.sub = sub
|
||||
self.detail = detail
|
||||
|
||||
|
||||
# endregion
|
||||
|
||||
# Loading all songs from musicinfo in an array
|
||||
|
Loading…
Reference in New Issue
Block a user