Files
Vocaluxe/VocaluxeSongServer/Contracts/LibraryDtos.cs
T
Simon DiesenreiterandClaude Opus 5.5 efcc63a640 Song server: central song library with on-demand downloads
- VocaluxeSongServer: ASP.NET Core server that scans an UltraStar library and
  serves the song list (ETag), single files (Range) and zip bundles; optional
  API key; Dockerfile and Gitea workflow for git.disi.dev/projects/vocaluxe-song-server
- Game: config section SongServer (Url, ApiKey). At song loading, the song text
  files are mirrored into a local cache that is loaded like a song folder;
  without connection the last library is used
- VocaluxeLib: CSongFiles hook for all song file access; media are downloaded on
  demand (covers in the background, preview audio, everything before singing
  with progress in the sing screen)
- Tests for scanner, API and downloads (incl. resume); AGENTS.md for the fork

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 17:23:00 +01:00

59 lines
2.4 KiB
C#

#region license
// This file is part of Vocaluxe.
//
// Vocaluxe is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Vocaluxe is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion
using System.Collections.Generic;
// Shared between the song server and the game (linked into Vocaluxe.csproj). Keep it free of dependencies.
// Serialized as camelCase JSON. All paths are relative to the library root and use '/'.
namespace VocaluxeSongServer.Contracts
{
/// <summary>GET /api/v1/library</summary>
public sealed class LibraryDto
{
/// <summary>Changes whenever any song file is added, removed or changed. Also sent as ETag.</summary>
public string Version { get; set; } = "";
public string ScannedAt { get; set; } = "";
public List<SongDto> Songs { get; set; } = new List<SongDto>();
/// <summary>All files in the song folders (text files, audio, video, images), downloadable via /api/v1/files/{path}.</summary>
public List<FileDto> Files { get; set; } = new List<FileDto>();
}
public sealed class SongDto
{
/// <summary>Stable id, derived from the path of the text file.</summary>
public string Id { get; set; } = "";
/// <summary>Path of the UltraStar text file.</summary>
public string Path { get; set; } = "";
public string Title { get; set; } = "";
public string Artist { get; set; } = "";
}
public sealed class FileDto
{
public string Path { get; set; } = "";
public long Size { get; set; }
/// <summary>Last modification, Unix time in milliseconds (UTC).</summary>
public long Modified { get; set; }
}
/// <summary>POST /api/v1/files/bundle: returns the files as a zip archive (entries named by their path).</summary>
public sealed class BundleRequest
{
public List<string> Paths { get; set; } = new List<string>();
}
}