db

package
v0.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2021 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PAGE_SIZE = 50
)

Variables

View Source
var DataFolder string
View Source
var Database *gorm.DB

Functions

func Connect

func Connect(dataFolder string)

func LogStartup

func LogStartup(version string) (previousVersion string, err error)

func PlayTrack

func PlayTrack(track *Track) error

Types

type Album

type Album struct {
	gorm.Model
	MBID     string `gorm:"unique"`
	Title    string
	ArtistID uint
	Artist   Artist
}

func ListAlbums

func ListAlbums() ([]*Album, error)

func ListAlbumsBy

func ListAlbumsBy(artist *Artist) ([]*Album, error)

func (*Album) GetAlbumArtPath

func (a *Album) GetAlbumArtPath() string

type Artist

type Artist struct {
	gorm.Model
	MBID string `gorm:"unique"`
	Name string
}

func ListArtists

func ListArtists() ([]*Artist, error)

type NeptuneVersion

type NeptuneVersion struct {
	gorm.Model
	Version string
}

type Tag

type Tag struct {
	gorm.Model
	Name string `gorm:"unique"`
}

func ListTags

func ListTags() ([]*Tag, error)

type Track

type Track struct {
	gorm.Model
	MBID         string
	YoutubeID    string `gorm:"unique"`
	AlbumID      uint
	Album        Album
	Title        string
	Length       int
	PlayCount    int
	YoutubeTitle string
	Tags         []TrackTag
}

func ListAllTracks

func ListAllTracks() ([]*Track, error)

func ListTracks

func ListTracks(page int) ([]*Track, error)

func ListTracksBy

func ListTracksBy(artist *Artist) ([]*Track, error)

func ListTracksIn

func ListTracksIn(album *Album) ([]*Track, error)

func ListTracksWith

func ListTracksWith(tag *Tag) ([]*Track, error)

func PlayEntry

func PlayEntry(result *youtube.YoutubeEntry) (*Track, error)

func StoreTrack

func StoreTrack(videoInfo *youtube.VideoInfo, trackInfo *providers.TrackInfo) (*Track, error)

func TrackFrom

func TrackFrom(result *youtube.YoutubeEntry) (*Track, error)

func (*Track) GetPath

func (t *Track) GetPath() string

type TrackTag

type TrackTag struct {
	gorm.Model
	TagID   uint
	Tag     Tag
	TrackID uint
	Track   Track
}

Jump to

Keyboard shortcuts

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