checkbms

package module
v0.0.0-...-8734da6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2021 License: Apache-2.0 Imports: 23 Imported by: 2

README

checkbms

A package and command that check format and dependence of bms file or folder.

Usage

checkbms [option][bms file or folder path]

options

  • -diff : In addition, check differences between bms files when you entry bms folder path.

License

Apache License 2.0

Reference

Documentation

Index

Constants

View Source
const (
	Wav objType = iota + 1
	Bmp
	Mine
	Bpm
	ExtendedBpm
	Stop
	Scroll
)
View Source
const (
	Error   = AlertLevel("ERROR")
	Warning = AlertLevel("WARNING")
	Notice  = AlertLevel("NOTICE")
)

Variables

View Source
var AUDIO_EXTS = []string{".wav", ".ogg", ".flac", ".mp3"}
View Source
var BMP_CHANNELS = []string{"04", "06", "07"}
View Source
var BMP_EXTS = append(IMAGE_EXTS, MOVIE_EXTS...)
View Source
var BPM_CHANNELS = []string{"03"}
View Source
var COMMANDS = []Command{
	{"player", Int, Necessary, []int{1, 4}},
	{"genre", String, Semi_necessary, nil},
	{"title", String, Necessary, nil},
	{"artist", String, Semi_necessary, nil},
	{"subtitle", String, Unnecessary, nil},
	{"subartist", String, Unnecessary, nil},
	{"bpm", Float, Necessary, []float64{math.SmallestNonzeroFloat64, math.MaxFloat64}},
	{"playlevel", Int, Semi_necessary, []int{0, math.MaxInt64}},
	{"rank", Int, Semi_necessary, []int{0, 4}},
	{"defexrank", Float, Unnecessary, []float64{0, math.MaxFloat64}},
	{"total", Float, Semi_necessary, []float64{0, math.MaxFloat64}},
	{"difficulty", Int, Semi_necessary, []int{0, 5}},
	{"stagefile", Path, Unnecessary, IMAGE_EXTS},
	{"banner", Path, Unnecessary, IMAGE_EXTS},
	{"backbmp", Path, Unnecessary, IMAGE_EXTS},
	{"preview", Path, Unnecessary, AUDIO_EXTS},
	{"lntype", Int, Unnecessary, []int{1, 2}},
	{"lnobj", String, Unnecessary, []string{`^[0-9a-zA-Z]{2}$`}},
	{"lnmode", Int, Unnecessary, []int{1, 3}},
	{"volwav", Int, Unnecessary, []int{0, math.MaxInt64}},
	{"comment", String, Unnecessary, nil},
}
View Source
var EXTENDEDBPM_CHANNELS = []string{"08"}
View Source
var IMAGE_EXTS = []string{".bmp", ".png", ".jpg", ".jpeg", ".gif"}
View Source
var INVISIBLENOTE_CHANNELS = []string{
	"31", "32", "33", "34", "35", "36", "37", "38", "39",
	"41", "42", "43", "44", "45", "46", "47", "48", "49",
}
View Source
var LN_CHANNELS = []string{
	"51", "52", "53", "54", "55", "56", "57", "58", "59",
	"61", "62", "63", "64", "65", "66", "67", "68", "69",
}
View Source
var MEASURE_CHANNELS = []string{"02"}
View Source
var MINE_CHANNELS = []string{
	"d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9",
	"e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9",
}
View Source
var MOVIE_EXTS = []string{".mpg", ".mpeg", ".wmv", ".avi", ".mp4", ".webm", ".m4v", ".m1v", ".m2v"}
View Source
var NORMALNOTE_CHANNELS = []string{
	"11", "12", "13", "14", "15", "16", "17", "18", "19",
	"21", "22", "23", "24", "25", "26", "27", "28", "29",
}
View Source
var SCROLL_CHANNELS = []string{"sc"}
View Source
var STOP_CHANNELS = []string{"09"}

Functions

func CalculateDefaultTotal

func CalculateDefaultTotal(totalNotes, keymode int) float64

func CheckBgaEventsAreUnified

func CheckBgaEventsAreUnified(bmsDir *Directory) (nbs []notUnifiedBgaEvents)

func CheckBgaHeaderIdIsDuplicate

func CheckBgaHeaderIdIsDuplicate(bmsonFile *BmsonFile) (dis []duplicateBgaHeaderId)

func CheckBgaHeadersAreUnified

func CheckBgaHeadersAreUnified(bmsDir *Directory) (nb *notUnifiedBgaHeader)

func CheckBmsDirectory

func CheckBmsDirectory(bmsDir *Directory, doDiffCheck bool)

func CheckBmsFile

func CheckBmsFile(bmsFile *BmsFile)

func CheckBmsonFile

func CheckBmsonFile(bmsonFile *BmsonFile)

func CheckBpmValue

func CheckBpmValue(bmsFile *BmsFile) (ibs []invalidBpmObj)

func CheckDefinedBgaFilesExistBmson

func CheckDefinedBgaFilesExistBmson(bmsDir *Directory, bmsonFile *BmsonFile) (nfs []notExistFileBmson)

func CheckDefinedBmpFilesExist

func CheckDefinedBmpFilesExist(bmsDir *Directory, bmsFile *BmsFile) (nfs []notExistFile)

func CheckDefinedFilesExist

func CheckDefinedFilesExist(bmsDir *Directory, bmsFile *BmsFile) (nfs []notExistFile)

func CheckDefinedInfoFilesExistBmson

func CheckDefinedInfoFilesExistBmson(bmsDir *Directory, bmsonFile *BmsonFile) (nfs []notExistFileBmson)

func CheckDefinedSoundFilesExistBmson

func CheckDefinedSoundFilesExistBmson(bmsDir *Directory, bmsonFile *BmsonFile) (nfs []notExistFileBmson)

func CheckDefinedUnplacedBgaHeader

func CheckDefinedUnplacedBgaHeader(bmsonFile *BmsonFile) (du *definedUnplacedBgaHeader)

func CheckDefinedWavFilesExist

func CheckDefinedWavFilesExist(bmsDir *Directory, bmsFile *BmsFile) (nfs []notExistFile)

pathsOfdoNotExistWavs := []string{}

func CheckDefinitionDiff

func CheckDefinitionDiff(bmsDirPath string, bmsFileI, bmsFileJ *BmsFile) (dds []definitionDiff)

func CheckDefinitionsAreUnified

func CheckDefinitionsAreUnified(bmsDir *Directory) (nds []notUnifiedDefinitions)

func CheckDuplicateY

func CheckDuplicateY(bmsonFile *BmsonFile) (yds []yDuplicate)

func CheckEmptyDirectory

func CheckEmptyDirectory(bmsDir *Directory) (eds []emptyDirectory)

func CheckEndOfLNExistsAndNotesInLN

func CheckEndOfLNExistsAndNotesInLN(bmsFile *BmsFile) (nls []noteInLN, els []endMissingLN)

func CheckEnvironmentDependentFilename

func CheckEnvironmentDependentFilename(bmsDir *Directory) (efs []environmentDependentFilename)

must do after used check

func CheckFirstNoteHasContinueFlag

func CheckFirstNoteHasContinueFlag(bmsonFile *BmsonFile) (fcs []firstNoteHasContinueFlag)

func CheckIndexedDefinitionsAreUnified

func CheckIndexedDefinitionsAreUnified(bmsDir *Directory) (nis []notUnifiedIndexedDefinition)

func CheckIndexedDefinitionsHaveInvalidValue

func CheckIndexedDefinitionsHaveInvalidValue(bmsFile *BmsFile) (mds []missingIndexedDefinition, eds []emptyDefinition, ivs []invalidValueOfIndexedCommand, nwd *noWavExtDefs)

func CheckMeasureLength

func CheckMeasureLength(bmsFile *BmsFile) (ims []invalidMeasureLength, dms []duplicateMeasureLength)

func CheckNoWavSoundChannels

func CheckNoWavSoundChannels(bmsonFile *BmsonFile) (nw *noWavSoundChannels)

func CheckNonNotesSoundChannel

func CheckNonNotesSoundChannel(bmsonFile *BmsonFile) (nss []nonNotesSoundChannel)

func CheckNoteInLNBmson

func CheckNoteInLNBmson(bmsonFile *BmsonFile) (nls []noteInLNBmson)

func CheckNoteOverlap

func CheckNoteOverlap(bmsFile *BmsFile) (ons []overlapNotes)

func CheckObjectDiff

func CheckObjectDiff(bmsDirPath string, bmsFileI, bmsFileJ *BmsFile) (ods []objectDiff)

func CheckObjectStructuresAreUnified

func CheckObjectStructuresAreUnified(bmsDir *Directory) (nos []notUnifiedObjectStructure)

func CheckOutOfLaneNotes

func CheckOutOfLaneNotes(bmsonFile *BmsonFile) (on *outOfLaneNotes)

func CheckOver1MinuteAudioFile

func CheckOver1MinuteAudioFile(bmsDir *Directory) (oas []over1MinuteAudioFile)

must do after CheckDefinedWavFilesExist TODO 引数としてUsedリストを受け取る?

func CheckPlacedObjIsDefinedAndDefinedHeaderIsPlaced

func CheckPlacedObjIsDefinedAndDefinedHeaderIsPlaced(bmsFile *BmsFile) (puos []placedUndefinedObj, duos []definedUnplacedObj)

この実装だとログの出力される順番が変わる?Placed→Defined→Placed→Defined→...だったのがPlaced*5→Defined*5になる

func CheckPlacedUndefiedBgaIds

func CheckPlacedUndefiedBgaIds(bmsonFile *BmsonFile) (pus []placedUndefinedBgaIds)

func CheckSameHashBmsFiles

func CheckSameHashBmsFiles(bmsDir *Directory) (sbs []sameHashBmsFiles)

func CheckSoundChannelNameIsInvalid

func CheckSoundChannelNameIsInvalid(bmsonFile *BmsonFile) (iss []invalidSoundChannelName)

func CheckSoundChannelsAreUnified

func CheckSoundChannelsAreUnified(bmsDir *Directory) (ns *notUnifiedSoundChannels)

func CheckSoundNotesIn0thMeasure

func CheckSoundNotesIn0thMeasure(bmsonFile *BmsonFile) *soundNotesIn0thMeasure

func CheckSoundOfMineExplosionIsUsed

func CheckSoundOfMineExplosionIsUsed(bmsFile *BmsFile) *unusedMineSound

func CheckTitleAndSubtitleHaveSameText

func CheckTitleAndSubtitleHaveSameText(bmsFile *BmsFile) (ts *titleAndSubtitleHaveSameText)

func CheckTitleTextsAreDuplicate

func CheckTitleTextsAreDuplicate(bmsonFile *BmsonFile) (tds []titleTextsAreDuplicate)

func CheckTotalnotesIsZero

func CheckTotalnotesIsZero(bmsFileBase *BmsFileBase) *totalnotesIsZero

func CheckUnusedFile

func CheckUnusedFile(bmsDir *Directory) (ufs []unusedFile)

func CheckWavDuplicate

func CheckWavDuplicate(bmsFile *BmsFile) (dupWavs []duplicateWavs)

func CheckWavObjExistsIn0thMeasure

func CheckWavObjExistsIn0thMeasure(bmsFile *BmsFile) *wavObjsIn0thMeasure

func CheckWithoutKeysound

func CheckWithoutKeysound(bmsFile *BmsFile, wavFileIsExist func(string) bool) (wm *withoutKeysoundMoments, wn *withoutKeysoundNotes)

実在しないファイル名を持つWAV定義を考慮する場合、wavFileIsExistを渡す。そうでなければnilを渡す。

func CheckWithoutKeysoundBmson

func CheckWithoutKeysoundBmson(bmsonFile *BmsonFile, wavFileIsExist func(string) bool) (wm *withoutKeysoundMomentsBmson, wn *withoutKeysoundNotesBmson)

func IsBmsDirectory

func IsBmsDirectory(path string) bool

func IsBmsFile

func IsBmsFile(path string) bool

func IsBmsonFile

func IsBmsonFile(path string) bool

func JudgeOverTotal

func JudgeOverTotal(total float64, totalNotes, keymode int) int

TOTALが過剰な値か判別する -1: 低すぎ 0: 適正 1: 高すぎ

Types

type AlertLevel

type AlertLevel string

func (AlertLevel) String_ja

func (al AlertLevel) String_ja() string

type Bms

type Bms struct {
	Header             map[string]string
	HeaderWav          []indexedDefinition
	HeaderBmp          []indexedDefinition
	HeaderExtendedBpm  []indexedDefinition
	HeaderStop         []indexedDefinition
	HeaderScroll       []indexedDefinition
	BmsWavObjs         []bmsObj
	BmsBmpObjs         []bmsObj
	BmsMineObjs        []bmsObj
	BmsBpmObjs         []bmsObj
	BmsExtendedBpmObjs []bmsObj
	BmsStopObjs        []bmsObj
	BmsScrollObjs      []bmsObj
	BmsMeasureLengths  []measureLength
}

type BmsFile

type BmsFile struct {
	BmsFileBase
	Bms
}

func NewBmsFile

func NewBmsFile(bmsFileBase *BmsFileBase) *BmsFile

func (BmsFile) LogString

func (bf BmsFile) LogString(base bool) string

func (BmsFile) LogStringWithLang

func (bf BmsFile) LogStringWithLang(base bool, lang string) string

func (*BmsFile) ScanBmsFile

func (bmsFile *BmsFile) ScanBmsFile() error

type BmsFileBase

type BmsFileBase struct {
	File
	FullText   []byte
	Sha256     string
	Keymode    int // 5, 7, 9, 10, 14, 24, 48
	TotalNotes int
	Logs       Logs
}

func ReadBmsFileBase

func ReadBmsFileBase(path string) (bmsFileBase *BmsFileBase, _ error)

func (BmsFileBase) LogString

func (bf BmsFileBase) LogString(base bool) string

func (BmsFileBase) LogStringWithLang

func (bf BmsFileBase) LogStringWithLang(base bool, lang string) string

type BmsonFile

type BmsonFile struct {
	BmsFileBase
	bmson.Bmson
	IsInvalid bool // bmsonフォーマットエラーで無効なファイル
}

func NewBmsonFile

func NewBmsonFile(bmsFileBase *BmsFileBase) *BmsonFile

func (*BmsonFile) ScanBmsonFile

func (bmsonFile *BmsonFile) ScanBmsonFile() error

type Command

type Command struct {
	Name          string
	Type          CommandType
	Necessity     CommandNecessity
	BoundaryValue interface{} // Intなら0と100,-10とnilとか。Stringなら*とか(多分不要)。Pathなら許容する拡張子.oog、.wav

}

type CommandNecessity

type CommandNecessity int
const (
	Necessary CommandNecessity = iota + 1
	Semi_necessary
	Unnecessary
)

type CommandType

type CommandType int
const (
	Int CommandType = iota + 1
	Float
	String
	Path
)

type DiffBmsDirResult

type DiffBmsDirResult struct {
	DirPath1, DirPath2 string
	// contains filtered or unexported fields
}

func DiffBmsDirectories

func DiffBmsDirectories(dirPath1, dirPath2 string) (result *DiffBmsDirResult, _ error)

2つのディレクトリ内のファイル分布が一致するか比較して確認する。比較はファイルパスで行う。 音声、画像、動画ファイルを比較する時は、パスの拡張子を取り除き、名前だけで比較する。 bmsfileは同名ファイルでsha256の比較をする。一致しなかった場合はファイル記述内容のdiffをとる。

func (DiffBmsDirResult) LogStringWithLang

func (d DiffBmsDirResult) LogStringWithLang(lang string) (log string)

type Directory

type Directory struct {
	File
	BmsFiles   []BmsFile
	BmsonFiles []BmsonFile
	/*SoundFiles []NonBmsFile
	ImageFiles []NonBmsFile  // TODO
	OtherFiles []NonBmsFile*/
	NonBmsFiles []NonBmsFile
	Directories []Directory
	Logs        Logs
}

func ScanBmsDirectory

func ScanBmsDirectory(path string, isRootDir, doScan bool) (*Directory, error)

func ScanDirectory

func ScanDirectory(path string) ([]Directory, error)

func (Directory) LogString

func (d Directory) LogString(base bool) string

func (Directory) LogStringWithLang

func (d Directory) LogStringWithLang(base bool, lang string) string

type File

type File struct {
	Path string
}

type Log

type Log struct {
	Level      AlertLevel
	Message    string
	Message_ja string
	SubLogs    []string
	SubLogType SubLogType
}

func (Log) String

func (log Log) String() string

func (Log) StringWithLang

func (log Log) StringWithLang(lang string) (str string)

type Logs

type Logs []Log

func CheckBmsonInfo

func CheckBmsonInfo(bmsonFile *BmsonFile) (logs Logs)

func CheckHeaderCommands

func CheckHeaderCommands(bmsFile *BmsFile) (logs Logs)

func ScanBmson

func ScanBmson(bytes []byte) (bmsonData *bmson.Bmson, logs Logs, _ error)

func (Logs) String

func (logs Logs) String() string

func (Logs) StringWithLang

func (logs Logs) StringWithLang(lang string) string

type NonBmsFile

type NonBmsFile struct {
	File
	Used_bms   bool
	Used_bmson bool
}

func (NonBmsFile) UsedFromAny

func (f NonBmsFile) UsedFromAny() bool

type SubLogType

type SubLogType int
const (
	List SubLogType = iota
	Detail
)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL