db

package
v0.0.0-...-9316bc8 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Log = logging.Log

Functions

func CreateString

func CreateString(length int) string

func GenerateID

func GenerateID(path string) (string, error)

Types

type DB

type DB struct {
	// contains filtered or unexported fields
}

func OpenDatabase

func OpenDatabase() DB

func (DB) AddSong

func (db DB) AddSong(song Song) error

func (DB) CreatePlaylist

func (db DB) CreatePlaylist(name string) (bool, Playlist)

Creating a playlist.

func (DB) DeletePlaylist

func (db DB) DeletePlaylist(id string)

Deleting a playlist from the database.

func (DB) DoesSongExist

func (db DB) DoesSongExist(id string) bool

func (DB) GetAllPlaylists

func (db DB) GetAllPlaylists() ([]Playlist, error)

func (DB) GetAllSongs

func (db DB) GetAllSongs() []Song

func (DB) GetPlaylist

func (db DB) GetPlaylist(id string) (bool, Playlist)

A function that takes a DB and a string and returns a bool and a Playlist.

func (DB) LookupSong

func (db DB) LookupSong(id string) Song

type Playlist

type Playlist struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Songs []Song `json:"songs"`
	Art   string `json:"art"`
	Color string `json:"color"`
}

type Song

type Song struct {
	ID     string `json:"id"`     // Unique ID of the song
	Title  string `json:"title"`  // Display name of the song
	Artist string `json:"artist"` // Artist of the song
	Album  string `json:"album"`  // What album the song is from
	Length int    `json:"length"` // Length of the song in seconds
	Image  string `json:"image"`  // Path to the image for the song
}

Jump to

Keyboard shortcuts

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