Files
MusicPlayer/server/generated/soundtrack_with_songs.gd
SansanandClaude Opus 5.5 ef6ac8f1fd
Build / test (push) Successful in 1m43s
Build / build (push) Successful in 1m14s
Show soundtrack covers and edit alternative names (#49)
Covers: statistics cards show the soundtrack's cover on the left, and the
statistics popup shows it large. Until it arrives, and without a cover, the
soundtrack's initials stand in. Covers load only for cards on or near the
screen, three at a time, and are cached in covers/ next to the settings
(CoverCache), downloaded again only when cover_modified changes. The index and
file handling are shared with CharacterCache in a new FileCache.

Alternative names: the popup shows them and has an editor (add, remove, save)
that sends PUT /soundtracks/{uuid}/alternative-names. The statistics search and
the Search popup find soundtracks by them; Search shows the matching name after
the real one. Search now loads /soundtracks, falling back to the plain list.

The API types are regenerated from the server's spec, with a SoundtrackCover
theme style in every theme.

Closes #49

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 22:06:30 +02:00

47 lines
1.9 KiB
GDScript

# Generated by tools/generate_api_types.gd from server/openapi.json.
# Do not edit; change the server and generate again.
class_name SoundtrackWithSongs
extends RefCounted
## The [code]SoundtrackWithSongs[/code] schema of the MusicServer API.
## Other names the soundtrack is known by
var alternative_names: Array[String]
## When the cover last changed, in Unix seconds. Missing when there is no cover.
var cover_modified: int
var songs: Array[SongInfoForStats]
var soundtrack_id: int
var soundtrack_last_played: String
var soundtrack_name: String
var soundtrack_played: int
var soundtrack_uuid: String
## Reads the fields from parsed JSON. Missing fields keep their defaults.
static func from_dict(data: Dictionary) -> SoundtrackWithSongs:
var result: SoundtrackWithSongs = SoundtrackWithSongs.new()
result.alternative_names.assign(ApiJson.get_array(data, "alternative_names"))
result.cover_modified = ApiJson.get_int(data, "cover_modified", 0)
for item: Variant in ApiJson.get_array(data, "songs"):
if item is Dictionary:
result.songs.append(SongInfoForStats.from_dict(item))
result.soundtrack_id = ApiJson.get_int(data, "soundtrack_id", 0)
result.soundtrack_last_played = ApiJson.get_string(data, "soundtrack_last_played", "")
result.soundtrack_name = ApiJson.get_string(data, "soundtrack_name", "")
result.soundtrack_played = ApiJson.get_int(data, "soundtrack_played", 0)
result.soundtrack_uuid = ApiJson.get_string(data, "soundtrack_uuid", "")
return result
## Returns the fields under their JSON names, ready for [method JSON.stringify].
func to_dict() -> Dictionary:
return {
"alternative_names": alternative_names,
"cover_modified": cover_modified,
"songs": songs.map(func(item: SongInfoForStats) -> Dictionary: return item.to_dict()),
"soundtrack_id": soundtrack_id,
"soundtrack_last_played": soundtrack_last_played,
"soundtrack_name": soundtrack_name,
"soundtrack_played": soundtrack_played,
"soundtrack_uuid": soundtrack_uuid,
}