service

package
v0.0.0-...-64e8138 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlbumService

type AlbumService struct {
	Store     *store.AlbumStore
	Storage   FileStorage
	SearchSvc *SearchService
}

func (*AlbumService) AlbumHasCover

func (s *AlbumService) AlbumHasCover(albumID uuid.UUID, format string) bool

func (*AlbumService) AssignAlbumCoverByPath

func (s *AlbumService) AssignAlbumCoverByPath(albumID uuid.UUID, sourcePath string, format string) error

func (*AlbumService) CreateAlbum

func (s *AlbumService) CreateAlbum(title string, releaseDate time.Time, artistName string) (*model.Album, error)

func (*AlbumService) DeleteAlbum

func (s *AlbumService) DeleteAlbum(album *model.Album) error

func (*AlbumService) GetAlbumByID

func (s *AlbumService) GetAlbumByID(uuid uuid.UUID) (*model.Album, error)

func (*AlbumService) GetAlbumCoverPath

func (s *AlbumService) GetAlbumCoverPath(id uuid.UUID, format string, res string) string

func (*AlbumService) GetOrCreateAlbum

func (s *AlbumService) GetOrCreateAlbum(title string, artists []model.Artist) (*model.Album, error)

func (*AlbumService) UpdateAlbum

func (s *AlbumService) UpdateAlbum(id uuid.UUID, title string, releaseDate time.Time) (*model.Album, error)

func (*AlbumService) WriteAlbumCover

func (s *AlbumService) WriteAlbumCover(albumID uuid.UUID, data io.Reader, id string, format string) error

type ArtistService

type ArtistService struct {
	Store     *store.ArtistStore
	SearchSvc *SearchService
}

func (*ArtistService) AddIdentifierToArtist

func (s *ArtistService) AddIdentifierToArtist(artistID uuid.UUID, identifier string) error

func (*ArtistService) CreateArtist

func (s *ArtistService) CreateArtist(name string, identifiers []string) (*model.Artist, error)

func (*ArtistService) DeleteArtist

func (s *ArtistService) DeleteArtist(id uuid.UUID) error

func (*ArtistService) GetArtistByIdentifier

func (s *ArtistService) GetArtistByIdentifier(identifier string) (*model.Artist, error)

func (*ArtistService) UpdateArtist

func (s *ArtistService) UpdateArtist(id uuid.UUID, name string) (*model.Artist, error)

type BandwidthPoint

type BandwidthPoint struct {
	Timestamp time.Time `json:"timestamp"`
	BytesIn   int64     `json:"bytes_in"`
	BytesOut  int64     `json:"bytes_out"`
}

type FileStorage

type FileStorage interface {
	Save(path string, r io.Reader) error
	Exists(path string) bool
	Delete(path string) error
	Move(src, dst string) error
}

type MailService

type MailService struct {
	Store         *store.MailStore
	SettingsStore *store.SettingsStore
}

func NewMailService

func NewMailService(store *store.MailStore, settingsStore *store.SettingsStore) *MailService

func (*MailService) CreateRequestMail

func (ms *MailService) CreateRequestMail(category, message string, userID uuid.UUID) (*model.RequestMail, error)

func (*MailService) GetCategories

func (ms *MailService) GetCategories() []string

func (*MailService) GetNextRequestMail

func (ms *MailService) GetNextRequestMail() (*model.RequestMail, error)

func (*MailService) GetRequestMails

func (ms *MailService) GetRequestMails() []model.RequestMail

func (*MailService) SetStatus

func (ms *MailService) SetStatus(mailID uint, status int) error

type PlaylistService

type PlaylistService struct {
	Store     *store.PlaylistStore
	SearchSvc *SearchService
}

func NewPlaylistService

func NewPlaylistService(store *store.PlaylistStore) *PlaylistService

func (*PlaylistService) CreatePlaylist

func (ps *PlaylistService) CreatePlaylist(playlistID uuid.UUID, userID uuid.UUID, name string, parentFolder uuid.UUID, songIDs []uuid.UUID) (model.Playlist, error)

func (*PlaylistService) CreatePlaylistFolder

func (ps *PlaylistService) CreatePlaylistFolder(folderID uuid.UUID, userID uuid.UUID, name string, parentFolder *uuid.UUID) (model.PlaylistFolder, error)

func (*PlaylistService) CreatePlaylistWithContents

func (ps *PlaylistService) CreatePlaylistWithContents(userID uuid.UUID, name string, songIDs []uuid.UUID) (model.Playlist, error)

func (*PlaylistService) GetRootFolderID

func (ps *PlaylistService) GetRootFolderID(userID uuid.UUID) (uuid.UUID, error)

type SearchArtist

type SearchArtist struct {
	ID   uuid.UUID `json:"id"`
	Name string    `json:"name"`
}

type SearchResult

type SearchResult struct {
	ID    uuid.UUID `json:"id"`
	Type  string    `json:"type"` // "song", "artist", "album", "playlist"
	Title string    `json:"title"`
	Sub   *string   `json:"sub,omitempty"` // Artist name for songs

	// For songs
	Artists    []SearchArtist `json:"artists,omitempty"`
	AlbumID    *uuid.UUID     `json:"album_id,omitempty"`
	AlbumTitle *string        `json:"album_title,omitempty"`
}

type SearchService

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

func NewSearchService

func NewSearchService() (*SearchService, error)

func (*SearchService) DeleteAllDocuments

func (s *SearchService) DeleteAllDocuments() error

func (*SearchService) DeleteDocument

func (s *SearchService) DeleteDocument(id uuid.UUID) error

func (*SearchService) IndexAlbum

func (s *SearchService) IndexAlbum(album *model.Album) error

func (*SearchService) IndexAlbums

func (s *SearchService) IndexAlbums(albums []model.Album) error

func (*SearchService) IndexArtist

func (s *SearchService) IndexArtist(artist *model.Artist) error

func (*SearchService) IndexArtists

func (s *SearchService) IndexArtists(artists []model.Artist) error

func (*SearchService) IndexPlaylist

func (s *SearchService) IndexPlaylist(playlist *model.Playlist) error

func (*SearchService) IndexPlaylists

func (s *SearchService) IndexPlaylists(playlists []model.Playlist) error

func (*SearchService) IndexSong

func (s *SearchService) IndexSong(song *model.Song) error

func (*SearchService) IndexSongs

func (s *SearchService) IndexSongs(songs []model.Song) error

func (*SearchService) Search

func (s *SearchService) Search(query string, limit int, filterType string) ([]SearchResult, error)

type SongCreationArtist

type SongCreationArtist struct {
	Name       string `json:"name" validate:"required"`
	Identifier string `json:"id" validate:"required"`
}

type SongService

type SongService struct {
	Store     *store.SongStore
	Storage   FileStorage
	ArtistSvc *ArtistService
	AlbumSvc  *AlbumService
	SearchSvc *SearchService
}

func (*SongService) AssignFileToSong

func (s *SongService) AssignFileToSong(songID uuid.UUID, format string, data io.Reader) (*model.SongFile, error)

func (*SongService) AssignFileToSongByPath

func (s *SongService) AssignFileToSongByPath(songID uuid.UUID, sourcePath string) (*model.SongFile, error)

func (*SongService) CreateSong

func (s *SongService) CreateSong(title string, artistsInput []SongCreationArtist, albumTitle string, albumID uuid.UUID) (*model.Song, error)

func (*SongService) DeleteSong

func (s *SongService) DeleteSong(songID uuid.UUID) error

func (*SongService) DeleteSongFile

func (s *SongService) DeleteSongFile(fileID uuid.UUID) error

func (*SongService) GetSongFiles

func (s *SongService) GetSongFiles(songID uuid.UUID) ([]model.SongFile, error)

func (*SongService) GetSongsByAlbumID

func (s *SongService) GetSongsByAlbumID(albumID uuid.UUID) ([]model.Song, error)

func (*SongService) ProbeDuration

func (s *SongService) ProbeDuration(path string) (float64, error)

func (*SongService) UpdateSong

func (s *SongService) UpdateSong(songID uuid.UUID, title string, artistsInput []SongCreationArtist, albumTitle string, albumID uuid.UUID) (*model.Song, error)

type StatsService

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

func NewStatsService

func NewStatsService() *StatsService

func (*StatsService) GetBandwidthHistory

func (s *StatsService) GetBandwidthHistory() []BandwidthPoint

func (*StatsService) RecordIncoming

func (s *StatsService) RecordIncoming(bytes int64)

func (*StatsService) RecordOutgoing

func (s *StatsService) RecordOutgoing(bytes int64)

type UserService

type UserService struct {
	Store           *store.UserStore
	PlaylistService *PlaylistService
	JWTSecret       string
}

func (*UserService) CheckPassword

func (s *UserService) CheckPassword(user *model.User, password string) error

func (*UserService) CreateUser

func (s *UserService) CreateUser(username, password string) (*model.User, error)

func (*UserService) DeleteUser

func (s *UserService) DeleteUser(user *model.User) error

func (*UserService) GenerateToken

func (s *UserService) GenerateToken(user *model.User) (string, error)

func (*UserService) GetUserByUsername

func (s *UserService) GetUserByUsername(username string) (*model.User, error)

func (*UserService) UpdatePassword

func (s *UserService) UpdatePassword(user *model.User, newPassword string) error

Jump to

Keyboard shortcuts

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