Skip to content
This repository has been archived by the owner on Feb 8, 2025. It is now read-only.

Commit

Permalink
fix: maimai 2024 support
Browse files Browse the repository at this point in the history
  • Loading branch information
MoYoez committed Jun 6, 2024
1 parent 17630a7 commit 64621da
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions plugin/mai/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ import (
"golang.org/x/text/width"
)

type BaseUserIDStruct struct {
UserID int64 `json:"user_id"`
}

type GetMusicStruct struct {
BaseUserIDStruct
GetIndex int64 `json:"get_index"`
GetCounter int64 `json:"get_counter"`
}

type player struct {
AdditionalRating int `json:"additional_rating"`
Charts struct {
Expand Down Expand Up @@ -374,6 +364,7 @@ func RenderCard(data playerData, num int, isSimpleRender bool) image.Image {
}

func GetRankPicRaw(id int) (image.Image, error) {
log.Println(id)
var idStr string
if id < 10 {
idStr = "0" + strconv.FormatInt(int64(id), 10)
Expand Down Expand Up @@ -409,7 +400,21 @@ func GetCover(id string) (image.Image, error) {
downloadURL := "https://www.diving-fish.com/covers/" + fileName
cover, err := downloadImage(downloadURL)
if err != nil {
return LoadPictureWithResize(defaultCoverLink, 90, 90), nil
// try with lxns service
getConvert, _ := strconv.Atoi(id)
switch {
case getConvert >= 11000:
id = id[1:]
}
if getConvert > 10000 && getConvert < 11000 {
id = id[2:]
}
downloadFromLxns := "https://lx-rec-reproxy.lemonkoi.one/maimai/jacket/" + id + ".png"
coverNewer, err := downloadImage(downloadFromLxns)
if err != nil {
return LoadPictureWithResize(defaultCoverLink, 90, 90), nil
}
cover = coverNewer
}
saveImage(cover, filePath)
}
Expand Down Expand Up @@ -464,7 +469,12 @@ func LoadComboImage(imageName string) image.Image {

// LoadSyncImage Load sync images
func LoadSyncImage(imageName string) image.Image {
link := loadMaiPic + "sync_" + imageName + ".png"
var link string
if imageName == "sync" {
link = loadMaiPic + "sync_fs.png"
} else {
link = loadMaiPic + "sync_" + imageName + ".png"
}
return LoadPictureWithResize(link, 60, 40)
}

Expand Down

0 comments on commit 64621da

Please sign in to comment.