summertriangle-dev / sparklebox

Source code for starlight.kirara.ca.
74 stars 13 forks source link

About adding api for song data #19

Closed superk589 closed 8 years ago

superk589 commented 8 years ago

Hello, i'm a developer and now working on a project of cinderella girls starlight stage. i've benefited from your api a lot. i really appreciate for you and the project. Now, i have a problem in my project. i hope to get songs data of the game including song name, number of notes, difficulty and so on. But mainly for the original note distribution data(as the image uploaded below, what i want was the original data but not the image). i have no idea of how to get the data right now, but if you can provide api for getting the original song data, i will be much more thankful to you.

5-2 the image is from site https://deresute.info

CaiMiao commented 8 years ago

These original beatmap datas are in individual sqlite dbs for each song in game truth. Parse the manifest and fetch song*.bdb (if I still remember it right), LZ4 unarchive them.

summertriangle-dev commented 8 years ago

I could add song data to the API if you want, but not beatmap data (because they are stored in different files as per @CaiMiao's comment).

superk589 commented 8 years ago

Song data is good enough, especially for cd cover url, live id, number of notes, stars of difficulty. This data will be helpful for team simulation and score calculation. I will also try CaiMiao's idea to get beatmap data. Thanks!

Snack-X commented 8 years ago

Hello! I'm the guy who made deresute.info. I have my (internal) API for the things you need(you can see api.deresute.info on the source code of the webpage), but not documented yet. Currently I don't have a plan to document API endpoints, but I'll do it if someone really needs for it.

CaiMiao commented 8 years ago

Nice.

发自我的 iPhone

在 2016年7月19日,下午2:48,Snack notifications@github.com 写道:

Hello! I'm the guy who made deresute.info. I have my (internal) API for the things you need(you can see api.deresute.info on the source code of the webpage), but not documented yet. Currently I don't have a plan to document API endpoints, but I'll do it if someone really needs for it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

superk589 commented 8 years ago

@Snack-X I really need for it and i think some others may need too. Because clients on mobiles or pads are not suitable for downloading much data or doing complex analysis. By now there are some perfect website for デレステ just like yours and this sparklebox, but not so many good mobile clients for it. If you can provide the api briefly, there will be more developers benefit from your pretty work.

summertriangle-dev commented 8 years ago

This is informal documentation based on snack's comments in IRC. It hasn't been checked for correctness so you might have to fix your usage later.

https://api.deresute.info/api/live -> Live list. Returns JSON dict with all Lives. A Live is one album cover in the game list.

{
  "2": { ; live ID
    "music": {
      "id": 1002, ; unique ID
      "bpm": 172, ; Beats-per-minute
      "title": "\u8f1d\u304f\u4e16\u754c\u306e\u9b54\u6cd5" ; Song title
    },
    "type": 4, ; Attribute: 1 = cute, 2 = cool, 3 = passion, 4 = any (rainbow)
    "sp_type": 0, ; unknown, possibly a special unlock condition 
    "event_type": 0, ; Originating event type: 1 = token, 3 = medley ("groove")
    "details": [ ; Live detail unique IDs. Ordered by difficulty.
      81, ; debut
      82, ; regular
      83, ; etc..
      84,
      0   ; 0 because master+ map doesn't exist
    ],
    "diff_deb": 7,  ; number of stars for the particular difficulty
    "diff_reg": 13,
    "diff_pro": 18,
    "diff_mas": 25,
    "diff_masp": 0
  },
  ...
}

https://api.deresute.info/pt/NNN_D -> Beatmap Returns JSON list of note objects.

https://api.deresute.info/pt/002_4

NNN = live ID zero-filled to 3 positions. D = difficulty; 1->5 represents debut->m+

[
  {
    "id": 3,         ; unique id of this note in this beatmap
    "sec": 2.790698, ; time (when the note hits the middle of the tap zone) as an offset into the song
    "type": 2,       ; Note type: 1 = tap, 2 = hold/release, 100 = FC (see below), 91 = start, 92 = end 
    "startPos": 3,   ; Lane the note will start in. Differs from finishPos to create curved trails.
    "finishPos": 5,  ; Lane that you tap the note in.
    "status": 0,     ; Slide direction: 1 = left, 2 = right (exception for type 100, see below)
    "sync": 0,       ; whether the horizontal line is drawn for notes with the exact same time
    "groupId": 0     ; notes with the same groupId will be connected (i.e. slides)
  },
  ...
]

A note with type 100 specifies the full combo for a map in the status value.

{
  "id": 1,
  "sec": 0,
  "type": 100,
  "startPos": 0,
  "finishPos": 0,
  "status": 224, ; 224 notes for full combo
  "sync": 0,
  "groupId": 0
},

A note with type 91 marks the beginning of the song (usually at sec 0) and a note with type 92 marks the end. Neither have any useful values (except maybe "sec")

Snack-X commented 8 years ago

Though API is still usable for now, I think I'd better refine/remake it for more public and better usage. I'll write here as soon as I finish on them.

Snack-X commented 8 years ago

Aaand.. it's done.

Old API is still running, but after migrating deresute.info to new API, it will be shut down. So if you are using api.deresute.info, check out documentation and migrate to apiv2.deresute.info.

superk589 commented 8 years ago

Very nice document! I already know what I'm going to do. Thanks again!

CaiMiao commented 8 years ago

@superk589 You should now close your issue (if your problem involving sparklebox is solved). 另外你是准备做app吗?可否一起交流下想法?

点击链接加入群【P桑与idol们】:[DELETED]

superk589 commented 8 years ago

@CaiMiao 是的 不过本人还是新手 边学边做 这是我做的第一个iOS项目 已加群 这边先关掉了