Merge branch 'master' into ldap_auth
This commit is contained in:
No files matched your search
+34
-29
@@ -26,6 +26,7 @@ import (
|
||||
"go.senan.xyz/gonic/scrobble"
|
||||
"go.senan.xyz/gonic/server/ctrlsubsonic/params"
|
||||
"go.senan.xyz/gonic/server/ctrlsubsonic/spec"
|
||||
"go.senan.xyz/gonic/tags"
|
||||
"go.senan.xyz/gonic/transcode"
|
||||
)
|
||||
|
||||
@@ -54,41 +55,45 @@ type ProxyPathResolver func(in string) string
|
||||
type Controller struct {
|
||||
*http.ServeMux
|
||||
|
||||
dbc *db.DB
|
||||
scanner *scanner.Scanner
|
||||
musicPaths []MusicPath
|
||||
podcastsPath string
|
||||
cacheAudioPath string
|
||||
cacheCoverPath string
|
||||
jukebox *jukebox.Jukebox
|
||||
playlistStore *playlist.Store
|
||||
scrobblers []scrobble.Scrobbler
|
||||
podcasts *podcast.Podcasts
|
||||
transcoder transcode.Transcoder
|
||||
lastFMClient *lastfm.Client
|
||||
artistInfoCache *artistinfocache.ArtistInfoCache
|
||||
albumInfoCache *albuminfocache.AlbumInfoCache
|
||||
dbc *db.DB
|
||||
scanner *scanner.Scanner
|
||||
musicPaths []MusicPath
|
||||
podcastsPath string
|
||||
cacheAudioPath string
|
||||
cacheCoverPath string
|
||||
jukebox *jukebox.Jukebox
|
||||
playlistStore *playlist.Store
|
||||
scrobblers []scrobble.Scrobbler
|
||||
podcasts *podcast.Podcasts
|
||||
transcoder transcode.Transcoder
|
||||
lastFMClient *lastfm.Client
|
||||
artistInfoCache *artistinfocache.ArtistInfoCache
|
||||
albumInfoCache *albuminfocache.AlbumInfoCache
|
||||
tagReader tags.Reader
|
||||
|
||||
resolveProxyPath ProxyPathResolver
|
||||
}
|
||||
|
||||
func New(dbc *db.DB, scannr *scanner.Scanner, musicPaths []MusicPath, podcastsPath string, cacheAudioPath string, cacheCoverPath string, jukebox *jukebox.Jukebox, playlistStore *playlist.Store, scrobblers []scrobble.Scrobbler, podcasts *podcast.Podcasts, transcoder transcode.Transcoder, lastFMClient *lastfm.Client, artistInfoCache *artistinfocache.ArtistInfoCache, albumInfoCache *albuminfocache.AlbumInfoCache, resolveProxyPath ProxyPathResolver, ldapConfig ldap.Config) (*Controller, error) {
|
||||
func New(dbc *db.DB, scannr *scanner.Scanner, musicPaths []MusicPath, podcastsPath string, cacheAudioPath string, cacheCoverPath string, jukebox *jukebox.Jukebox, playlistStore *playlist.Store, scrobblers []scrobble.Scrobbler, podcasts *podcast.Podcasts, transcoder transcode.Transcoder, lastFMClient *lastfm.Client, artistInfoCache *artistinfocache.ArtistInfoCache, albumInfoCache *albuminfocache.AlbumInfoCache, tagReader tags.Reader, resolveProxyPath ProxyPathResolver, ldapConfig ldap.Config) (*Controller, error) {
|
||||
c := Controller{
|
||||
ServeMux: http.NewServeMux(),
|
||||
|
||||
dbc: dbc,
|
||||
scanner: scannr,
|
||||
musicPaths: musicPaths,
|
||||
podcastsPath: podcastsPath,
|
||||
cacheAudioPath: cacheAudioPath,
|
||||
cacheCoverPath: cacheCoverPath,
|
||||
jukebox: jukebox,
|
||||
playlistStore: playlistStore,
|
||||
scrobblers: scrobblers,
|
||||
podcasts: podcasts,
|
||||
transcoder: transcoder,
|
||||
lastFMClient: lastFMClient,
|
||||
artistInfoCache: artistInfoCache,
|
||||
albumInfoCache: albumInfoCache,
|
||||
dbc: dbc,
|
||||
scanner: scannr,
|
||||
musicPaths: musicPaths,
|
||||
podcastsPath: podcastsPath,
|
||||
cacheAudioPath: cacheAudioPath,
|
||||
cacheCoverPath: cacheCoverPath,
|
||||
jukebox: jukebox,
|
||||
playlistStore: playlistStore,
|
||||
scrobblers: scrobblers,
|
||||
podcasts: podcasts,
|
||||
transcoder: transcoder,
|
||||
lastFMClient: lastFMClient,
|
||||
artistInfoCache: artistInfoCache,
|
||||
albumInfoCache: albumInfoCache,
|
||||
tagReader: tagReader,
|
||||
|
||||
resolveProxyPath: resolveProxyPath,
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
jd "github.com/josephburnett/jd/lib"
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -142,9 +143,9 @@ func makec(tb testing.TB, roots []string, audio bool) *Controller {
|
||||
if !audio {
|
||||
continue
|
||||
}
|
||||
m.SetRealAudio(filepath.Join(root, "artist-0/album-0/track-0.flac"), 10, audioPath10s)
|
||||
m.SetRealAudio(filepath.Join(root, "artist-0/album-0/track-1.flac"), 10, audioPath10s)
|
||||
m.SetRealAudio(filepath.Join(root, "artist-0/album-0/track-2.flac"), 10, audioPath10s)
|
||||
m.SetAudio(filepath.Join(root, "artist-0/album-0/track-0.flac"), 10*time.Second, 0, audioPath10s)
|
||||
m.SetAudio(filepath.Join(root, "artist-0/album-0/track-1.flac"), 10*time.Second, 0, audioPath10s)
|
||||
m.SetAudio(filepath.Join(root, "artist-0/album-0/track-2.flac"), 10*time.Second, 0, audioPath10s)
|
||||
}
|
||||
|
||||
m.ScanAndClean()
|
||||
|
||||
@@ -198,6 +198,7 @@ func (c *Controller) ServeGetAlbumListTwo(r *http.Request) *spec.Response {
|
||||
Offset(params.GetOrInt("offset", 0)).
|
||||
Limit(params.GetOrInt("size", 10)).
|
||||
Preload("Artists").
|
||||
Preload("Genres").
|
||||
Preload("AlbumStar", "user_id=?", user.ID).
|
||||
Preload("AlbumRating", "user_id=?", user.ID).
|
||||
Preload("Play", "user_id=?", user.ID).
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -512,30 +513,37 @@ func (c *Controller) ServeGetLyrics(r *http.Request) *spec.Response {
|
||||
|
||||
sub := spec.NewResponse()
|
||||
|
||||
if track.TagLyrics != "" {
|
||||
sub.Lyrics = &spec.Lyrics{
|
||||
Value: track.TagLyrics,
|
||||
Artist: track.TagTrackArtist,
|
||||
Title: track.TagTitle,
|
||||
}
|
||||
return sub
|
||||
}
|
||||
|
||||
_, text, err := lyricsFile(track)
|
||||
if os.IsNotExist(err) {
|
||||
return sub
|
||||
}
|
||||
if err != nil {
|
||||
return spec.NewError(0, "lyricsFile: %v", err)
|
||||
}
|
||||
|
||||
contents := strings.Join(text, "\n")
|
||||
|
||||
sub.Lyrics = &spec.Lyrics{
|
||||
Value: contents,
|
||||
Artist: track.TagTrackArtist,
|
||||
Title: track.TagTitle,
|
||||
Value: "",
|
||||
}
|
||||
|
||||
lyrics, err := lyricsAll(track)
|
||||
if err != nil {
|
||||
return spec.NewError(0, "get lyrics: %v", err)
|
||||
}
|
||||
if len(lyrics) == 0 {
|
||||
return sub
|
||||
}
|
||||
|
||||
// prefer unsynced for this endpoint
|
||||
slices.SortFunc(lyrics, func(a, b *spec.StructuredLyrics) int {
|
||||
if a.Synced {
|
||||
return +1
|
||||
}
|
||||
return -1
|
||||
})
|
||||
|
||||
lyric := lyrics[0]
|
||||
|
||||
var lines []string
|
||||
for _, l := range lyric.Lines {
|
||||
lines = append(lines, l.Value)
|
||||
}
|
||||
|
||||
sub.Lyrics.Value = strings.Join(lines, "\n")
|
||||
|
||||
return sub
|
||||
}
|
||||
|
||||
@@ -562,81 +570,165 @@ func (c *Controller) ServeGetLyricsBySongID(r *http.Request) *spec.Response {
|
||||
}
|
||||
|
||||
sub := spec.NewResponse()
|
||||
sub.LyricsList = &spec.LyricsList{
|
||||
StructuredLyrics: []*spec.StructuredLyrics{},
|
||||
}
|
||||
|
||||
if track.TagLyrics != "" {
|
||||
times, lrc, err := lrc.ParseString(track.TagLyrics)
|
||||
if err != nil {
|
||||
return spec.NewError(0, "lyricsFile: %v", err)
|
||||
}
|
||||
structuredLyrics, err := lyricsAll(track)
|
||||
if err != nil {
|
||||
return spec.NewError(0, "get lyrics: %v", err)
|
||||
}
|
||||
|
||||
sub.LyricsList.StructuredLyrics = structuredLyrics
|
||||
|
||||
return sub
|
||||
}
|
||||
|
||||
func lyricsAll(track db.Track) ([]*spec.StructuredLyrics, error) {
|
||||
var r []*spec.StructuredLyrics
|
||||
|
||||
fromTags, err := lyricsFromTags(track)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("from tags: %w", err)
|
||||
}
|
||||
if fromTags != nil {
|
||||
r = append(r, fromTags)
|
||||
}
|
||||
|
||||
fromFile, err := lyricsFromFile(track)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("from file: %w", err)
|
||||
}
|
||||
if fromFile != nil {
|
||||
r = append(r, fromFile)
|
||||
}
|
||||
|
||||
fromFileUnsynced, err := lyricsFromFileUnsynced(track)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("from file unsynced: %w", err)
|
||||
}
|
||||
if fromFileUnsynced != nil {
|
||||
r = append(r, fromFileUnsynced)
|
||||
}
|
||||
|
||||
return r, nil
|
||||
}
|
||||
|
||||
func lyricsFromTags(track db.Track) (*spec.StructuredLyrics, error) {
|
||||
if track.TagLyrics == "" {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
r := spec.StructuredLyrics{
|
||||
Lang: "xxx",
|
||||
DisplayArtist: track.TagTrackArtist,
|
||||
DisplayTitle: track.TagTitle,
|
||||
}
|
||||
|
||||
times, lrc, err := lrc.ParseString(track.TagLyrics)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(times) > 0 {
|
||||
lines := make([]spec.Lyric, len(times))
|
||||
for i, time := range times {
|
||||
start := time.Milliseconds()
|
||||
lines[i] = spec.Lyric{
|
||||
Start: time.Milliseconds(),
|
||||
Start: &start,
|
||||
Value: strings.TrimSpace(lrc[i]),
|
||||
}
|
||||
}
|
||||
|
||||
structured := spec.StructuredLyrics{
|
||||
Lang: "xxx",
|
||||
Synced: true,
|
||||
Lines: lines,
|
||||
DisplayArtist: track.TagTrackArtist,
|
||||
DisplayTitle: track.TagTitle,
|
||||
Offset: 0,
|
||||
}
|
||||
r.Synced = true
|
||||
r.Lines = lines
|
||||
|
||||
sub.LyricsList = &spec.LyricsList{
|
||||
StructuredLyrics: []spec.StructuredLyrics{structured},
|
||||
}
|
||||
return sub
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
times, lrc, err := lyricsFile(track)
|
||||
rawLines := strings.Split(track.TagLyrics, "\n")
|
||||
|
||||
lines := make([]spec.Lyric, 0, len(rawLines))
|
||||
for _, line := range rawLines {
|
||||
lines = append(lines, spec.Lyric{
|
||||
Value: strings.TrimSpace(line),
|
||||
})
|
||||
}
|
||||
|
||||
r.Lines = lines
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
func lyricsFromFile(track db.Track) (*spec.StructuredLyrics, error) {
|
||||
filePath := track.AbsPath()
|
||||
fileDir := filepath.Dir(filePath)
|
||||
fileName := strings.TrimSuffix(filepath.Base(filePath), filepath.Ext(filePath))
|
||||
|
||||
lrcContent, err := os.ReadFile(filepath.Join(fileDir, fileName+".lrc"))
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
return nil, nil
|
||||
}
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
sub.LyricsList = &spec.LyricsList{
|
||||
StructuredLyrics: []spec.StructuredLyrics{},
|
||||
}
|
||||
return sub
|
||||
}
|
||||
return spec.NewError(0, "lyricsFile: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
times, lrc, err := lrc.Parse(lrcContent)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
lines := make([]spec.Lyric, len(times))
|
||||
for i, time := range times {
|
||||
start := time.Milliseconds()
|
||||
lines[i] = spec.Lyric{
|
||||
Start: time.Milliseconds(),
|
||||
Start: &start,
|
||||
Value: strings.TrimSpace(lrc[i]),
|
||||
}
|
||||
}
|
||||
|
||||
structured := spec.StructuredLyrics{
|
||||
r := spec.StructuredLyrics{
|
||||
Lang: "xxx",
|
||||
Synced: true,
|
||||
Lines: lines,
|
||||
DisplayArtist: track.TagTrackArtist,
|
||||
DisplayTitle: track.TagTitle,
|
||||
Offset: 0,
|
||||
}
|
||||
|
||||
sub.LyricsList = &spec.LyricsList{
|
||||
StructuredLyrics: []spec.StructuredLyrics{structured},
|
||||
}
|
||||
return sub
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
func lyricsFile(file db.Track) ([]lrc.Duration, []lrc.Text, error) {
|
||||
filePath := file.AbsPath()
|
||||
func lyricsFromFileUnsynced(track db.Track) (*spec.StructuredLyrics, error) {
|
||||
filePath := track.AbsPath()
|
||||
fileDir := filepath.Dir(filePath)
|
||||
fileName := strings.TrimSuffix(filepath.Base(filePath), filepath.Ext(filePath))
|
||||
|
||||
lrcContent, err := os.ReadFile(filepath.Join(fileDir, fileName+".lrc"))
|
||||
text, err := os.ReadFile(filepath.Join(fileDir, fileName+".txt"))
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
return nil, nil
|
||||
}
|
||||
if err != nil {
|
||||
return []lrc.Duration{}, []lrc.Text{}, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return lrc.Parse(lrcContent)
|
||||
r := spec.StructuredLyrics{
|
||||
Lang: "xxx",
|
||||
DisplayArtist: track.TagTrackArtist,
|
||||
DisplayTitle: track.TagTitle,
|
||||
}
|
||||
|
||||
rawLines := strings.Split(string(text), "\n")
|
||||
|
||||
lines := make([]spec.Lyric, 0, len(rawLines))
|
||||
for _, line := range rawLines {
|
||||
lines = append(lines, spec.Lyric{
|
||||
Value: strings.TrimSpace(line),
|
||||
})
|
||||
}
|
||||
|
||||
r.Lines = lines
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
func scrobbleStatsUpdateTrack(dbc *db.DB, track *db.Track, userID int, playTime time.Time) error {
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
"go.senan.xyz/gonic/server/ctrlsubsonic/spec"
|
||||
"go.senan.xyz/gonic/server/ctrlsubsonic/specid"
|
||||
"go.senan.xyz/gonic/server/ctrlsubsonic/specidpaths"
|
||||
"go.senan.xyz/gonic/tags"
|
||||
"go.senan.xyz/gonic/transcode"
|
||||
)
|
||||
|
||||
@@ -49,7 +50,7 @@ func (c *Controller) ServeGetCoverArt(w http.ResponseWriter, r *http.Request) *s
|
||||
_, err = os.Stat(cachePath)
|
||||
switch {
|
||||
case os.IsNotExist(err):
|
||||
reader, err := coverFor(c.dbc, c.artistInfoCache, id)
|
||||
reader, err := coverFor(c.dbc, c.artistInfoCache, c.tagReader, id)
|
||||
if err != nil {
|
||||
return spec.NewError(10, "couldn't find cover %q: %v", id, err)
|
||||
}
|
||||
@@ -76,7 +77,7 @@ var (
|
||||
)
|
||||
|
||||
// TODO: can we use specidpaths.Locate here?
|
||||
func coverFor(dbc *db.DB, artistInfoCache *artistinfocache.ArtistInfoCache, id specid.ID) (io.ReadCloser, error) {
|
||||
func coverFor(dbc *db.DB, artistInfoCache *artistinfocache.ArtistInfoCache, tagReader tags.Reader, id specid.ID) (io.ReadCloser, error) {
|
||||
switch id.Type {
|
||||
case specid.Album:
|
||||
return coverForAlbum(dbc, id.Value)
|
||||
@@ -85,7 +86,9 @@ func coverFor(dbc *db.DB, artistInfoCache *artistinfocache.ArtistInfoCache, id s
|
||||
case specid.Podcast:
|
||||
return coverForPodcast(dbc, id.Value)
|
||||
case specid.PodcastEpisode:
|
||||
return coverGetPathPodcastEpisode(dbc, id.Value)
|
||||
return coverForPodcastEpisode(dbc, id.Value)
|
||||
case specid.Track:
|
||||
return coverForTrack(dbc, tagReader, id.Value)
|
||||
default:
|
||||
return nil, errCoverNotFound
|
||||
}
|
||||
@@ -135,7 +138,7 @@ func coverForPodcast(dbc *db.DB, id int) (*os.File, error) {
|
||||
return os.Open(filepath.Join(podcast.RootDir, podcast.Image))
|
||||
}
|
||||
|
||||
func coverGetPathPodcastEpisode(dbc *db.DB, id int) (*os.File, error) {
|
||||
func coverForPodcastEpisode(dbc *db.DB, id int) (*os.File, error) {
|
||||
var pe db.PodcastEpisode
|
||||
err := dbc.
|
||||
Preload("Podcast").
|
||||
@@ -150,14 +153,38 @@ func coverGetPathPodcastEpisode(dbc *db.DB, id int) (*os.File, error) {
|
||||
return os.Open(filepath.Join(pe.Podcast.RootDir, pe.Podcast.Image))
|
||||
}
|
||||
|
||||
func coverForTrack(dbc *db.DB, tagReader tags.Reader, id int) (io.ReadCloser, error) {
|
||||
var tr db.Track
|
||||
err := dbc.
|
||||
Preload("Album").
|
||||
First(&tr, id).
|
||||
Error
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("select track: %w", err)
|
||||
}
|
||||
|
||||
absPath := tr.AbsPath()
|
||||
|
||||
cover, err := tagReader.ReadCover(absPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("read cover: %w", err)
|
||||
}
|
||||
if len(cover) == 0 {
|
||||
return nil, errCoverEmpty
|
||||
}
|
||||
|
||||
return io.NopCloser(bytes.NewReader(cover)), nil
|
||||
}
|
||||
|
||||
func coverScaleAndSave(reader io.Reader, cachePath string, size int) error {
|
||||
src, err := imaging.Decode(reader)
|
||||
if err != nil {
|
||||
return fmt.Errorf("resizing: %w", err)
|
||||
}
|
||||
width := min(size,
|
||||
// don't upscale images
|
||||
src.Bounds().Dx())
|
||||
|
||||
// don't upscale images
|
||||
width := min(size, src.Bounds().Dx())
|
||||
|
||||
if err := imaging.Save(imaging.Resize(src, width, 0, imaging.Lanczos), cachePath); err != nil {
|
||||
return fmt.Errorf("caching %q: %w", cachePath, err)
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ func NewAlbumByFolder(f *db.Album) *Album {
|
||||
}
|
||||
if f.Cover != "" {
|
||||
a.CoverID = f.SID()
|
||||
} else if f.EmbeddedCoverTrackID != nil {
|
||||
a.CoverID = f.EmbeddedCoverTrackSID()
|
||||
}
|
||||
return a
|
||||
}
|
||||
@@ -52,7 +54,10 @@ func NewTCAlbumByFolder(f *db.Album) *TrackChild {
|
||||
}
|
||||
if f.Cover != "" {
|
||||
trCh.CoverID = f.SID()
|
||||
} else if f.EmbeddedCoverTrackID != nil {
|
||||
trCh.CoverID = f.EmbeddedCoverTrackSID()
|
||||
}
|
||||
|
||||
return trCh
|
||||
}
|
||||
|
||||
@@ -84,9 +89,16 @@ func NewTCTrackByFolder(t *db.Track, parent *db.Album) *TrackChild {
|
||||
if trCh.Title == "" {
|
||||
trCh.Title = t.Filename
|
||||
}
|
||||
if parent.Cover != "" {
|
||||
|
||||
switch {
|
||||
case t.HasEmbeddedCover:
|
||||
trCh.CoverID = t.SID()
|
||||
case parent.Cover != "":
|
||||
trCh.CoverID = parent.SID()
|
||||
case parent.EmbeddedCoverTrackID != nil:
|
||||
trCh.CoverID = parent.EmbeddedCoverTrackSID()
|
||||
}
|
||||
|
||||
if t.Album != nil {
|
||||
trCh.Album = t.Album.RightPath
|
||||
trCh.AlbumID = t.Album.SID()
|
||||
@@ -163,6 +175,8 @@ func NewArtistByFolder(f *db.Album) *Artist {
|
||||
}
|
||||
if f.Cover != "" {
|
||||
a.CoverID = f.SID()
|
||||
} else if f.EmbeddedCoverTrackID != nil {
|
||||
a.CoverID = f.EmbeddedCoverTrackSID()
|
||||
}
|
||||
return a
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ func NewAlbumByTags(a *db.Album, artists []*db.Artist) *Album {
|
||||
}
|
||||
if a.Cover != "" {
|
||||
ret.CoverID = a.SID()
|
||||
} else if a.EmbeddedCoverTrackID != nil {
|
||||
ret.CoverID = a.EmbeddedCoverTrackSID()
|
||||
}
|
||||
if a.AlbumStar != nil {
|
||||
ret.Starred = &a.AlbumStar.StarDate
|
||||
@@ -88,9 +90,16 @@ func NewTrackByTags(t *db.Track, album *db.Album) *TrackChild {
|
||||
AverageRating: formatRating(t.AverageRating),
|
||||
TranscodeMeta: TranscodeMeta{},
|
||||
}
|
||||
if album.Cover != "" {
|
||||
|
||||
switch {
|
||||
case t.HasEmbeddedCover:
|
||||
ret.CoverID = t.SID()
|
||||
case album.Cover != "":
|
||||
ret.CoverID = album.SID()
|
||||
case album.EmbeddedCoverTrackID != nil:
|
||||
ret.CoverID = album.EmbeddedCoverTrackSID()
|
||||
}
|
||||
|
||||
if t.TrackStar != nil {
|
||||
ret.Starred = &t.TrackStar.StarDate
|
||||
}
|
||||
|
||||
@@ -477,12 +477,12 @@ type Lyrics struct {
|
||||
}
|
||||
|
||||
type Lyric struct {
|
||||
Start int64 `xml:"start,attr" json:"start"`
|
||||
Start *int64 `xml:"start,attr,omitempty" json:"start,omitempty"`
|
||||
Value string `xml:",chardata" json:"value"`
|
||||
}
|
||||
|
||||
type LyricsList struct {
|
||||
StructuredLyrics []StructuredLyrics `xml:"structuredLyrics" json:"structuredLyrics"`
|
||||
StructuredLyrics []*StructuredLyrics `xml:"structuredLyrics" json:"structuredLyrics"`
|
||||
}
|
||||
|
||||
type StructuredLyrics struct {
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -39,6 +41,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -57,6 +61,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -75,6 +81,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -93,6 +101,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -111,6 +121,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -129,6 +141,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -147,6 +161,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -165,6 +181,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -39,6 +41,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -57,6 +61,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -75,6 +81,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -93,6 +101,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -111,6 +121,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -129,6 +141,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -147,6 +161,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -165,6 +181,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -39,6 +41,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -57,6 +61,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -75,6 +81,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -93,6 +101,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -111,6 +121,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -129,6 +141,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -147,6 +161,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -165,6 +181,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
|
||||
+113
-95
@@ -7,6 +7,26 @@
|
||||
"openSubsonic": true,
|
||||
"albumList2": {
|
||||
"album": [
|
||||
{
|
||||
"id": "al-5",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"artistId": "ar-1",
|
||||
"artist": "artist-0",
|
||||
"artists": [{ "id": "ar-1", "name": "artist-0" }],
|
||||
"displayArtist": "artist-0",
|
||||
"title": "album-2",
|
||||
"album": "album-2",
|
||||
"coverArt": "al-5",
|
||||
"name": "album-2",
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-3",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
@@ -21,24 +41,8 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-13",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"artistId": "ar-3",
|
||||
"artist": "artist-2",
|
||||
"artists": [{ "id": "ar-3", "name": "artist-2" }],
|
||||
"displayArtist": "artist-2",
|
||||
"title": "album-2",
|
||||
"album": "album-2",
|
||||
"coverArt": "al-13",
|
||||
"name": "album-2",
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -57,96 +61,28 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-9",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"artistId": "ar-2",
|
||||
"artist": "artist-1",
|
||||
"artists": [{ "id": "ar-2", "name": "artist-1" }],
|
||||
"displayArtist": "artist-1",
|
||||
"title": "album-2",
|
||||
"album": "album-2",
|
||||
"coverArt": "al-9",
|
||||
"name": "album-2",
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-5",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"artistId": "ar-1",
|
||||
"artist": "artist-0",
|
||||
"artists": [{ "id": "ar-1", "name": "artist-0" }],
|
||||
"displayArtist": "artist-0",
|
||||
"title": "album-2",
|
||||
"album": "album-2",
|
||||
"coverArt": "al-5",
|
||||
"name": "album-2",
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-12",
|
||||
"id": "al-13",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"artistId": "ar-3",
|
||||
"artist": "artist-2",
|
||||
"artists": [{ "id": "ar-3", "name": "artist-2" }],
|
||||
"displayArtist": "artist-2",
|
||||
"title": "album-1",
|
||||
"album": "album-1",
|
||||
"coverArt": "al-12",
|
||||
"name": "album-1",
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-7",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"artistId": "ar-2",
|
||||
"artist": "artist-1",
|
||||
"artists": [{ "id": "ar-2", "name": "artist-1" }],
|
||||
"displayArtist": "artist-1",
|
||||
"title": "album-0",
|
||||
"album": "album-0",
|
||||
"coverArt": "al-7",
|
||||
"name": "album-0",
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-4",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"artistId": "ar-1",
|
||||
"artist": "artist-0",
|
||||
"artists": [{ "id": "ar-1", "name": "artist-0" }],
|
||||
"displayArtist": "artist-0",
|
||||
"title": "album-1",
|
||||
"album": "album-1",
|
||||
"coverArt": "al-4",
|
||||
"name": "album-1",
|
||||
"title": "album-2",
|
||||
"album": "album-2",
|
||||
"coverArt": "al-13",
|
||||
"name": "album-2",
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
@@ -165,6 +101,88 @@
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-12",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"artistId": "ar-3",
|
||||
"artist": "artist-2",
|
||||
"artists": [{ "id": "ar-3", "name": "artist-2" }],
|
||||
"displayArtist": "artist-2",
|
||||
"title": "album-1",
|
||||
"album": "album-1",
|
||||
"coverArt": "al-12",
|
||||
"name": "album-1",
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-4",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"artistId": "ar-1",
|
||||
"artist": "artist-0",
|
||||
"artists": [{ "id": "ar-1", "name": "artist-0" }],
|
||||
"displayArtist": "artist-0",
|
||||
"title": "album-1",
|
||||
"album": "album-1",
|
||||
"coverArt": "al-4",
|
||||
"name": "album-1",
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-7",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"artistId": "ar-2",
|
||||
"artist": "artist-1",
|
||||
"artists": [{ "id": "ar-2", "name": "artist-1" }],
|
||||
"displayArtist": "artist-1",
|
||||
"title": "album-0",
|
||||
"album": "album-0",
|
||||
"coverArt": "al-7",
|
||||
"name": "album-0",
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-9",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"artistId": "ar-2",
|
||||
"artist": "artist-1",
|
||||
"artists": [{ "id": "ar-2", "name": "artist-1" }],
|
||||
"displayArtist": "artist-1",
|
||||
"title": "album-2",
|
||||
"album": "album-2",
|
||||
"coverArt": "al-9",
|
||||
"name": "album-2",
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
|
||||
Reference in New Issue
Block a user