2020-07-10 08:45:58 -08:00
|
|
|
package core
|
2016-03-08 19:05:54 -09:00
|
|
|
|
|
|
|
|
import (
|
2020-01-22 04:32:31 -09:00
|
|
|
"context"
|
2016-03-08 19:31:48 -09:00
|
|
|
_ "image/gif"
|
2016-03-18 07:33:50 -08:00
|
|
|
_ "image/png"
|
|
|
|
|
"io"
|
2016-03-08 19:31:48 -09:00
|
|
|
|
2020-04-04 18:23:20 -08:00
|
|
|
"github.com/navidrome/navidrome/consts"
|
2020-01-23 15:44:08 -09:00
|
|
|
"github.com/navidrome/navidrome/model"
|
2020-05-01 10:35:57 -08:00
|
|
|
"github.com/navidrome/navidrome/resources"
|
2020-08-21 07:33:23 -08:00
|
|
|
_ "golang.org/x/image/webp"
|
2016-03-08 19:05:54 -09:00
|
|
|
)
|
|
|
|
|
|
2020-07-31 05:31:19 -08:00
|
|
|
type Artwork interface {
|
2020-11-17 09:30:37 -09:00
|
|
|
Get(ctx context.Context, id string, size int) (io.ReadCloser, error)
|
2016-03-08 19:05:54 -09:00
|
|
|
}
|
|
|
|
|
|
2022-12-19 10:01:57 -09:00
|
|
|
func NewArtwork(ds model.DataStore) Artwork {
|
|
|
|
|
return &artwork{ds: ds}
|
2016-03-08 19:05:54 -09:00
|
|
|
}
|
|
|
|
|
|
2020-07-31 05:31:19 -08:00
|
|
|
type artwork struct {
|
2022-12-19 10:01:57 -09:00
|
|
|
ds model.DataStore
|
2020-07-24 09:30:27 -08:00
|
|
|
}
|
|
|
|
|
|
2022-12-19 09:59:24 -09:00
|
|
|
func (a *artwork) Get(ctx context.Context, id string, size int) (io.ReadCloser, error) {
|
|
|
|
|
return resources.FS().Open(consts.PlaceholderAlbumArt)
|
|
|
|
|
}
|