rest

package
v0.0.0-...-9d742bf Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2022 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package rest implements the REST API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(router *mux.Router, sessionManager *sessionup.Manager, explorer music.MusicLibraryExplorer)

Register registers a gorilla/mux Subrouter for the REST API on the given router

Types

type Folder

type Folder struct {
	Folders []SubFolder `json:"folders"`
	Songs   []Song      `json:"songs"`
}

Folder represents a music folder. It can be any folder in the filesystem hierarchy such as an album, an artist folder containing many albums, a genre folder containing many artists, etc. It is output by the REST API.

type FolderContents

type FolderContents struct {
	Folders []SubFolder `json:"folders"`
	Songs   []Song      `json:"songs"`
}

FolderContents represents the contents of a folder. It can contain SubFolders and Songs

type Song

type Song struct {
	Title string `json:"title"` // Title is the song's title. E.g. "Know Your Enemy"
	// TrackNumber uint   `json:"trackNumber"` // TrackNumber is the track number of the song. E.g. "3"
	// DiskNumber  uint   `json:"diskNumber"`  // DiskNumber is the disk number of the song. E.g. "1"
	// Artist      string `json:"artist"`      // Artist is the name of the main artist. E.g. "Yoko Kanno"
	// Duration    uint   `json:"duration"`    // Duration is the duration of the song in seconds. E.g. "165"
	URI string `json:"uri"` // URI to access this song on this server. E.g. "/music/Yoko%20Kanno/1-03%20-Know%20Your%20Enemy.flac"

}

Song represents a music file. It is distinguished by media type (audio/mp3, audio/flac, etc.) Most of its fields mirror tags such as ID3 tags for MP3. It is output by the REST API.

type SubFolder

type SubFolder struct {
	Name string `json:"name"` // Basename of the folder
	Path string `json:"path"` // Path from the root music folder. For example "Yoko%20Kanno"
}

SubFolder represents a music folder that is a child of a Folder. We do not expose its items yet, another HTTP request is needed to expose them.

Jump to

Keyboard shortcuts

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