Merge branch 'master' into ldap_auth

This commit is contained in:
2025-09-21 06:37:41 +02:00
68 changed files with 1411 additions and 644 deletions

No files matched your search

+18
View File
@@ -39,6 +39,24 @@
<head>
<meta charset="utf-8">
<title>gonic</title>
<style>
@font-face {
font-family: "Inconsolata";
font-style: normal;
font-weight: 500;
src: local(""),
url("{{ path "/admin/static/inconsolata-v31-latin-500.woff2" }}") format("woff2"),
url("{{ path "/admin/static/inconsolata-v31-latin-500.woff" }}") format("woff");
}
@font-face {
font-family: "Inconsolata";
font-style: normal;
font-weight: 600;
src: local(""),
url("{{ path "/admin/static/inconsolata-v31-latin-600.woff2" }}") format("woff2"),
url("{{ path "/admin/static/inconsolata-v31-latin-600.woff" }}") format("woff");
}
</style>
<link rel="stylesheet" href="{{ path "/admin/static/style.css" | noCache }}">
<link rel="shortcut icon" href="{{ path "/admin/static/favicon.ico" }}" type="image/x-icon">
<link rel="icon" href="{{ path "/admin/static/favicon.ico" }}" type="image/x-icon">
File diff suppressed because one or more lines are too long
-18
View File
@@ -12,24 +12,6 @@ a {
text-decoration: none;
}
@font-face {
font-family: "Inconsolata";
font-style: normal;
font-weight: 500;
src: local(""),
url("/admin/static/inconsolata-v31-latin-500.woff2") format("woff2"),
url("/admin/static/inconsolata-v31-latin-500.woff") format("woff");
}
@font-face {
font-family: "Inconsolata";
font-style: normal;
font-weight: 600;
src: local(""),
url("/admin/static/inconsolata-v31-latin-600.woff2") format("woff2"),
url("/admin/static/inconsolata-v31-latin-600.woff") format("woff");
}
@tailwind components;
@tailwind utilities;
+1 -1
View File
@@ -274,7 +274,7 @@ func respRaw(h http.HandlerFunc) http.Handler {
type templateData struct {
// common
Flashes []interface{}
Flashes []any
User *db.User
Version string
+1
View File
@@ -128,6 +128,7 @@ func New(dbc *db.DB, scannr *scanner.Scanner, musicPaths []MusicPath, podcastsPa
c.Handle("/getSimilarSongs", chain(resp(c.ServeGetSimilarSongs)))
c.Handle("/getSimilarSongs2", chain(resp(c.ServeGetSimilarSongsTwo)))
c.Handle("/getLyrics", chain(resp(c.ServeGetLyrics)))
c.Handle("/getLyricsBySongId", chain(resp(c.ServeGetLyricsBySongID)))
// raw
c.Handle("/getCoverArt", chainRaw(respRaw(c.ServeGetCoverArt)))
+2 -3
View File
@@ -39,8 +39,8 @@ const (
)
const (
audioPath5s = "testdata/audio/5s.flac" //nolint:deadcode,varcheck
audioPath10s = "testdata/audio/10s.flac" //nolint:deadcode,varcheck
audioPath5s = "testdata/audio/5s.flac"
audioPath10s = "testdata/audio/10s.flac"
)
type queryCase struct {
@@ -87,7 +87,6 @@ func makeHTTPMockWithAdmin(query url.Values) (*httptest.ResponseRecorder, *http.
func runQueryCases(t *testing.T, h handlerSubsonic, cases []*queryCase) {
t.Helper()
for _, qc := range cases {
qc := qc
t.Run(qc.expectPath, func(t *testing.T) {
t.Helper()
t.Parallel()
+19 -1
View File
@@ -45,9 +45,27 @@ func (c *Controller) ServeGetBookmarks(r *http.Request) *spec.Response {
Find(&track, "id=?", bookmark.EntryID).
Error
if err != nil {
return spec.NewError(10, "finding entry: %v", err)
/*
* We get here if we have a bookmark for a Track that no longer exists, this should be an
* error because tracks can disappear if the files are moved etc. Just skip the not found
* entry and move on.
*/
continue
}
respBookmark.Entry = spec.NewTrackByTags(&track, track.Album)
case specid.PodcastEpisode:
var podcastEpisode db.PodcastEpisode
err := c.dbc.
Preload("Podcast").
Find(&podcastEpisode, "id=?", bookmark.EntryID).
Error
if err != nil {
/* Same as with the missing track above. */
continue
}
respBookmark.Entry = spec.NewTCPodcastEpisode(&podcastEpisode)
default:
continue
}
sub.Bookmarks.List = append(sub.Bookmarks.List, respBookmark)
+30 -11
View File
@@ -1,10 +1,10 @@
package ctrlsubsonic
import (
"fmt"
"net/http"
"strings"
"github.com/google/uuid"
"github.com/jinzhu/gorm"
"go.senan.xyz/gonic/db"
@@ -80,11 +80,13 @@ func (c *Controller) ServeGetMusicDirectory(r *http.Request) *spec.Response {
Where("parent_id=?", id.Value).
Preload("AlbumStar", "user_id=?", user.ID).
Preload("AlbumRating", "user_id=?", user.ID).
Order("tag_year").
Order("albums.right_path COLLATE NOCASE").
Find(&childFolders)
for _, ch := range childFolders {
childrenObj = append(childrenObj, spec.NewTCAlbumByFolder(ch))
}
// start looking for child childTracks in the current dir
var childTracks []*db.Track
c.dbc.
@@ -94,6 +96,7 @@ func (c *Controller) ServeGetMusicDirectory(r *http.Request) *spec.Response {
Preload("Artists").
Preload("TrackStar", "user_id=?", user.ID).
Preload("TrackRating", "user_id=?", user.ID).
Order("tracks.tag_disc_number, tracks.tag_track_number").
Order("filename").
Find(&childTracks)
@@ -198,13 +201,17 @@ func (c *Controller) ServeSearchTwo(r *http.Request) *spec.Response {
params := r.Context().Value(CtxParams).(params.Params)
user := r.Context().Value(CtxUser).(*db.User)
query, err := params.Get("query")
var queries []string
if err != nil {
return spec.NewError(10, "please provide a `query` parameter")
}
for _, s := range strings.Fields(query) {
queries = append(queries, fmt.Sprintf("%%%s%%", strings.Trim(s, `*"'`)))
}
var isUUID = uuid.Validate(query) == nil
var isAll = query == `""`
var fuzzy = query
fuzzy = strings.Join(strings.Fields(fuzzy), "%")
fuzzy = strings.ToLower(fuzzy)
fuzzy = "%" + fuzzy + "%"
results := &spec.SearchResultTwo{}
@@ -219,8 +226,12 @@ func (c *Controller) ServeSearchTwo(r *http.Request) *spec.Response {
var artists []*db.Album
q := c.dbc.Where(`parent_id IN ?`, rootQ.SubQuery())
for _, s := range queries {
q = q.Where(`right_path LIKE ? OR right_path_u_dec LIKE ?`, s, s)
switch {
case isUUID:
q = q.Where(0)
case isAll:
default:
q = q.Where(`right_path LIKE ? OR right_path_u_dec LIKE ?`, fuzzy, fuzzy)
}
q = q.
Preload("AlbumStar", "user_id=?", user.ID).
@@ -238,8 +249,12 @@ func (c *Controller) ServeSearchTwo(r *http.Request) *spec.Response {
var albums []*db.Album
q = c.dbc.
Joins("JOIN album_artists ON album_artists.album_id=albums.id")
for _, s := range queries {
q = q.Where(`right_path LIKE ? OR right_path_u_dec LIKE ?`, s, s)
switch {
case isUUID:
q = q.Where(`tag_brainz_id = ?`, query)
case isAll:
default:
q = q.Where(`right_path LIKE ? OR right_path_u_dec LIKE ?`, fuzzy, fuzzy)
}
q = q.
Preload("AlbumStar", "user_id=?", user.ID).
@@ -259,8 +274,12 @@ func (c *Controller) ServeSearchTwo(r *http.Request) *spec.Response {
// search tracks
var tracks []*db.Track
q = c.dbc.Preload("Album")
for _, s := range queries {
q = q.Where(`filename LIKE ? OR filename LIKE ?`, s, s)
switch {
case isUUID:
q = q.Where(`tag_brainz_id = ?`, query)
case isAll:
default:
q = q.Where(`filename LIKE ?`, fuzzy)
}
q = q.
Preload("Artists").
+27 -12
View File
@@ -2,7 +2,6 @@ package ctrlsubsonic
import (
"errors"
"fmt"
"log"
"math"
"net/http"
@@ -217,13 +216,17 @@ func (c *Controller) ServeSearchThree(r *http.Request) *spec.Response {
params := r.Context().Value(CtxParams).(params.Params)
user := r.Context().Value(CtxUser).(*db.User)
query, err := params.Get("query")
var queries []string
if err != nil {
return spec.NewError(10, "please provide a `query` parameter")
}
for _, s := range strings.Fields(query) {
queries = append(queries, fmt.Sprintf("%%%s%%", strings.Trim(s, `*"'`)))
}
var isUUID = uuid.Validate(query) == nil
var isAll = query == `""`
var fuzzy = query
fuzzy = strings.Join(strings.Fields(fuzzy), "%")
fuzzy = strings.ToLower(fuzzy)
fuzzy = "%" + fuzzy + "%"
results := &spec.SearchResultThree{}
@@ -232,8 +235,12 @@ func (c *Controller) ServeSearchThree(r *http.Request) *spec.Response {
q := c.dbc.
Select("*, count(albums.id) album_count").
Group("artists.id")
for _, s := range queries {
q = q.Where(`name LIKE ? OR name_u_dec LIKE ?`, s, s)
switch {
case isUUID:
q = q.Where(0)
case isAll:
default:
q = q.Where(`name LIKE ? OR name_u_dec LIKE ?`, fuzzy, fuzzy)
}
q = q.
Joins("JOIN album_artists ON album_artists.artist_id=artists.id").
@@ -261,8 +268,12 @@ func (c *Controller) ServeSearchThree(r *http.Request) *spec.Response {
Preload("AlbumStar", "user_id=?", user.ID).
Preload("AlbumRating", "user_id=?", user.ID).
Preload("Play", "user_id=?", user.ID)
for _, s := range queries {
q = q.Where(`tag_title LIKE ? OR tag_title_u_dec LIKE ?`, s, s)
switch {
case isUUID:
q = q.Where(`tag_brainz_id = ?`, query)
case isAll:
default:
q = q.Where(`tag_title LIKE ? OR tag_title_u_dec LIKE ?`, fuzzy, fuzzy)
}
q = q.
Offset(params.GetOrInt("albumOffset", 0)).
@@ -286,8 +297,12 @@ func (c *Controller) ServeSearchThree(r *http.Request) *spec.Response {
Preload("Artists").
Preload("TrackStar", "user_id=?", user.ID).
Preload("TrackRating", "user_id=?", user.ID)
for _, s := range queries {
q = q.Where(`tracks.tag_title LIKE ? OR tracks.tag_title_u_dec LIKE ?`, s, s)
switch {
case isUUID:
q = q.Where(`tracks.tag_brainz_id = ?`, query)
case isAll:
default:
q = q.Where(`tracks.tag_title LIKE ? OR tracks.tag_title_u_dec LIKE ?`, fuzzy, fuzzy)
}
q = q.Offset(params.GetOrInt("songOffset", 0)).
Limit(params.GetOrInt("songCount", 20))
@@ -418,7 +433,7 @@ func (c *Controller) ServeGetAlbumInfoTwo(r *http.Request) *spec.Response {
sub.AlbumInfo.MusicBrainzID = info.MusicBrainzID
sub.AlbumInfo.LastFMURL = info.LastFMURL
if _, err := uuid.Parse(album.TagBrainzID); err == nil {
if err := uuid.Validate(album.TagBrainzID); err == nil {
sub.AlbumInfo.MusicBrainzID = album.TagBrainzID // prefer db musicbrainz ID over lastfm's
}
+186 -21
View File
@@ -8,10 +8,12 @@ import (
"net/http"
"os"
"path/filepath"
"strings"
"sync"
"time"
"unicode"
"github.com/env25/mpdlrc/lrc"
"github.com/google/uuid"
"github.com/jinzhu/gorm"
@@ -41,6 +43,7 @@ func (c *Controller) ServeGetOpenSubsonicExtensions(_ *http.Request) *spec.Respo
sub.OpenSubsonicExtensions = &spec.OpenSubsonicExtensions{
{Name: "transcodeOffset", Versions: []int{1}},
{Name: "formPost", Versions: []int{1}},
{Name: "songLyrics", Versions: []int{1}},
}
return sub
}
@@ -75,10 +78,10 @@ func (c *Controller) ServeScrobble(r *http.Request) *spec.Response {
scrobbleTrack.AlbumArtist = track.Album.TagAlbumArtist
scrobbleTrack.TrackNumber = uint(track.TagTrackNumber)
scrobbleTrack.Duration = time.Second * time.Duration(track.Length)
if _, err := uuid.Parse(track.TagBrainzID); err == nil {
if err := uuid.Validate(track.TagBrainzID); err == nil {
scrobbleTrack.MusicBrainzID = track.TagBrainzID
}
if _, err := uuid.Parse(track.Album.TagBrainzID); err == nil {
if err := uuid.Validate(track.Album.TagBrainzID); err == nil {
scrobbleTrack.MusicBrainzReleaseID = track.Album.TagBrainzID
}
@@ -206,30 +209,44 @@ func (c *Controller) ServeGetPlayQueue(r *http.Request) *spec.Response {
sub.PlayQueue.ChangedBy = queue.ChangedBy
trackIDs := queue.GetItems()
sub.PlayQueue.List = make([]*spec.TrackChild, len(trackIDs))
sub.PlayQueue.List = make([]*spec.TrackChild, 0, len(trackIDs))
transcodeMeta := streamGetTranscodeMeta(c.dbc, user.ID, params.GetOr("c", ""))
for i, id := range trackIDs {
for _, id := range trackIDs {
switch id.Type {
case specid.Track:
track := db.Track{}
c.dbc.
var track db.Track
err := c.dbc.
Where("id=?", id.Value).
Preload("Album").
Preload("Artists").
Preload("TrackStar", "user_id=?", user.ID).
Preload("TrackRating", "user_id=?", user.ID).
Find(&track)
sub.PlayQueue.List[i] = spec.NewTCTrackByFolder(&track, track.Album)
sub.PlayQueue.List[i].TranscodeMeta = transcodeMeta
Find(&track).
Error
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
return spec.NewError(0, "error finding track")
}
if track.ID != 0 {
tc := spec.NewTCTrackByFolder(&track, track.Album)
tc.TranscodeMeta = transcodeMeta
sub.PlayQueue.List = append(sub.PlayQueue.List, tc)
}
case specid.PodcastEpisode:
pe := db.PodcastEpisode{}
c.dbc.
var pe db.PodcastEpisode
err := c.dbc.
Where("id=?", id.Value).
Find(&pe)
sub.PlayQueue.List[i] = spec.NewTCPodcastEpisode(&pe)
sub.PlayQueue.List[i].TranscodeMeta = transcodeMeta
Find(&pe).
Error
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
return spec.NewError(0, "error finding podcast episode")
}
if pe.ID != 0 {
tc := spec.NewTCPodcastEpisode(&pe)
tc.TranscodeMeta = transcodeMeta
sub.PlayQueue.List = append(sub.PlayQueue.List, tc)
}
}
}
return sub
@@ -335,7 +352,7 @@ func (c *Controller) ServeGetRandomSongs(r *http.Request) *spec.Response {
return sub
}
var errNotATrack = errors.New("not a track")
var errUnknownPlaylistEntry = errors.New("unknown playlist entry")
func (c *Controller) ServeJukebox(r *http.Request) *spec.Response { // nolint:gocyclo
if c.jukebox == nil {
@@ -377,11 +394,16 @@ func (c *Controller) ServeJukebox(r *http.Request) *spec.Response { // nolint:go
if err != nil {
return nil, fmt.Errorf("fetch track: %w", err)
}
track, ok := file.(*db.Track)
if !ok {
return nil, fmt.Errorf("%q: %w", path, errNotATrack)
switch f := file.(type) {
case *db.Track:
ret = append(ret, spec.NewTrackByTags(f, f.Album))
case *db.InternetRadioStation:
ret = append(ret, spec.NewTCInternetRadioStation(f))
case *db.PodcastEpisode:
ret = append(ret, spec.NewTCPodcastEpisode(f))
default:
return nil, fmt.Errorf("%q: %w", path, errUnknownPlaylistEntry)
}
ret = append(ret, spec.NewTrackByTags(track, track.Album))
}
return ret, nil
}
@@ -468,12 +490,155 @@ func (c *Controller) ServeJukebox(r *http.Request) *spec.Response { // nolint:go
return sub
}
func (c *Controller) ServeGetLyrics(_ *http.Request) *spec.Response {
func (c *Controller) ServeGetLyrics(r *http.Request) *spec.Response {
params := r.Context().Value(CtxParams).(params.Params)
artist, _ := params.Get("artist")
title, _ := params.Get("title")
var track db.Track
err := c.dbc.
Preload("Album").
Joins("JOIN track_artists ON track_artists.track_id = tracks.id").
Joins("JOIN artists ON artists.id = track_artists.artist_id").
Where("tracks.tag_title LIKE ? AND artists.name LIKE ?", title, artist).
First(&track).
Error
if errors.Is(err, gorm.ErrRecordNotFound) {
return spec.NewError(70, "couldn't find a track with that id")
}
if err != nil {
return spec.NewError(0, "lyrics: %v", err)
}
sub := spec.NewResponse()
sub.Lyrics = &spec.Lyrics{}
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,
}
return sub
}
func (c *Controller) ServeGetLyricsBySongID(r *http.Request) *spec.Response {
params := r.Context().Value(CtxParams).(params.Params)
id, err := params.GetID("id")
if err != nil {
return spec.NewError(10, "provide an `id` parameter")
}
var track db.Track
q := c.dbc.
Preload("Album").
Preload("Album.Artists").
Preload("Artists").
Where("id=?", id.Value).
First(&track)
if err := q.Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return spec.NewError(70, "couldn't find a track with that id")
} else {
return spec.NewError(0, "lyrics: %v", err)
}
}
sub := spec.NewResponse()
if track.TagLyrics != "" {
times, lrc, err := lrc.ParseString(track.TagLyrics)
if err != nil {
return spec.NewError(0, "lyricsFile: %v", err)
}
lines := make([]spec.Lyric, len(times))
for i, time := range times {
lines[i] = spec.Lyric{
Start: time.Milliseconds(),
Value: strings.TrimSpace(lrc[i]),
}
}
structured := 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
}
times, lrc, err := lyricsFile(track)
if err != nil {
if os.IsNotExist(err) {
sub.LyricsList = &spec.LyricsList{
StructuredLyrics: []spec.StructuredLyrics{},
}
return sub
}
return spec.NewError(0, "lyricsFile: %v", err)
}
lines := make([]spec.Lyric, len(times))
for i, time := range times {
lines[i] = spec.Lyric{
Start: time.Milliseconds(),
Value: strings.TrimSpace(lrc[i]),
}
}
structured := 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
}
func lyricsFile(file db.Track) ([]lrc.Duration, []lrc.Text, error) {
filePath := file.AbsPath()
fileDir := filepath.Dir(filePath)
fileName := strings.TrimSuffix(filepath.Base(filePath), filepath.Ext(filePath))
lrcContent, err := os.ReadFile(filepath.Join(fileDir, fileName+".lrc"))
if err != nil {
return []lrc.Duration{}, []lrc.Text{}, err
}
return lrc.Parse(lrcContent)
}
func scrobbleStatsUpdateTrack(dbc *db.DB, track *db.Track, userID int, playTime time.Time) error {
var play db.Play
if err := dbc.Where("album_id=? AND user_id=?", track.AlbumID, userID).First(&play).Error; err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
+4 -2
View File
@@ -75,8 +75,10 @@ func (c *Controller) ServeCreateOrUpdatePlaylist(r *http.Request) *spec.Response
playlistPath := playlistIDDecode(playlistID)
var playlist playlistp.Playlist
if pl, _ := c.playlistStore.Read(playlistPath); pl != nil {
playlist = *pl
if playlistPath != "" {
if pl, err := c.playlistStore.Read(playlistPath); err != nil && pl != nil {
playlist = *pl
}
}
if playlist.UserID != 0 && playlist.UserID != user.ID {
+6 -8
View File
@@ -155,11 +155,9 @@ func coverScaleAndSave(reader io.Reader, cachePath string, size int) error {
if err != nil {
return fmt.Errorf("resizing: %w", err)
}
width := size
if width > src.Bounds().Dx() {
width := min(size,
// don't upscale images
width = src.Bounds().Dx()
}
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)
}
@@ -194,7 +192,7 @@ func (c *Controller) ServeStream(w http.ResponseWriter, r *http.Request) *spec.R
}
client, _ := params.Get("c")
pref, err := streamGetTransodePreference(c.dbc, user.ID, client)
pref, err := streamGetTranscodePreference(c.dbc, user.ID, client)
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
return spec.NewError(0, "couldn't find transcode preference: %v", err)
}
@@ -224,7 +222,7 @@ func (c *Controller) ServeStream(w http.ResponseWriter, r *http.Request) *spec.R
profile = transcode.WithSeek(profile, time.Second*time.Duration(timeOffset))
}
log.Printf("trancoding to %q with at bitrate %d", profile.MIME(), profile.BitRate())
log.Printf("transcoding to %q with at bitrate %d", profile.MIME(), profile.BitRate())
w.Header().Set("Content-Type", profile.MIME())
if err := c.transcoder.Transcode(r.Context(), profile, file.AbsPath(), w); err != nil && !errors.Is(err, transcode.ErrFFmpegKilled) {
@@ -252,7 +250,7 @@ func (c *Controller) ServeGetAvatar(w http.ResponseWriter, r *http.Request) *spe
return nil
}
func streamGetTransodePreference(dbc *db.DB, userID int, client string) (*db.TranscodePreference, error) {
func streamGetTranscodePreference(dbc *db.DB, userID int, client string) (*db.TranscodePreference, error) {
var pref db.TranscodePreference
err := dbc.
Where("user_id=?", userID).
@@ -270,7 +268,7 @@ func streamGetTransodePreference(dbc *db.DB, userID int, client string) (*db.Tra
}
func streamGetTranscodeMeta(dbc *db.DB, userID int, client string) spec.TranscodeMeta {
pref, _ := streamGetTransodePreference(dbc, userID, client)
pref, _ := streamGetTranscodePreference(dbc, userID, client)
if pref == nil {
return spec.TranscodeMeta{}
}
+3 -4
View File
@@ -27,6 +27,7 @@ package params
import (
"errors"
"maps"
"net/http"
"net/url"
"strconv"
@@ -44,9 +45,7 @@ func New(r *http.Request) Params {
params := r.URL.Query()
// also if there's any in the post body, use those too
if err := r.ParseForm(); err == nil {
for k, v := range r.Form {
params[k] = v
}
maps.Copy(params, r.Form)
}
return Params(params)
}
@@ -389,7 +388,7 @@ func parseTime(in string) (time.Time, error) {
return time.Unix(0, ns), nil
}
func parse(values []string, i interface{}) error {
func parse(values []string, i any) error {
if len(values) == 0 {
return ErrNoValues
}
@@ -1,6 +1,7 @@
package spec
import (
"cmp"
"path/filepath"
"go.senan.xyz/gonic/db"
@@ -19,6 +20,7 @@ func NewAlbumByFolder(f *db.Album) *Album {
Duration: f.Duration,
Created: f.CreatedAt,
AverageRating: formatRating(f.AverageRating),
ReleaseTypes: []string{},
}
if f.AlbumStar != nil {
a.Starred = &f.AlbumStar.StarDate
@@ -40,6 +42,7 @@ func NewTCAlbumByFolder(f *db.Album) *TrackChild {
ParentID: f.ParentSID(),
CreatedAt: f.CreatedAt,
AverageRating: formatRating(f.AverageRating),
Year: f.TagYear,
}
if f.AlbumStar != nil {
trCh.Starred = &f.AlbumStar.StarDate
@@ -60,7 +63,7 @@ func NewTCTrackByFolder(t *db.Track, parent *db.Album) *TrackChild {
Suffix: formatExt(t.Ext()),
Size: t.Size,
Artist: t.TagTrackArtist,
Title: t.TagTitle,
Title: cmp.Or(t.TagTitle, t.Filename),
TrackNumber: t.TagTrackNumber,
DiscNumber: t.TagDiscNumber,
Path: filepath.Join(
@@ -86,6 +89,7 @@ func NewTCTrackByFolder(t *db.Track, parent *db.Album) *TrackChild {
}
if t.Album != nil {
trCh.Album = t.Album.RightPath
trCh.AlbumID = t.Album.SID()
}
if t.TrackStar != nil {
trCh.Starred = &t.TrackStar.StarDate
@@ -100,6 +104,9 @@ func NewTCTrackByFolder(t *db.Track, parent *db.Album) *TrackChild {
trCh.Genres = append(trCh.Genres, &GenreRef{Name: g.Name})
}
for _, a := range t.Artists {
if a.Name == t.TagTrackArtist {
trCh.ArtistID = a.SID()
}
trCh.Artists = append(trCh.Artists, &ArtistRef{ID: a.SID(), Name: a.Name})
}
if t.ReplayGainTrackGain != 0 || t.ReplayGainAlbumGain != 0 {
@@ -126,6 +133,9 @@ func NewTCPodcastEpisode(pe *db.PodcastEpisode) *TrackChild {
IsDir: false,
Type: "podcastepisode",
CreatedAt: pe.CreatedAt,
Album: pe.Album,
Artist: pe.Artist,
CoverID: pe.SID(),
}
if pe.Podcast != nil {
trCh.ParentID = pe.Podcast.SID()
@@ -135,7 +145,7 @@ func NewTCPodcastEpisode(pe *db.PodcastEpisode) *TrackChild {
}
func NewArtistByFolder(f *db.Album) *Artist {
// the db is structued around "browse by tags", and where
// the db is structured around "browse by tags", and where
// an album is also a folder. so we're constructing an artist
// from an "album" where
// maybe TODO: rename the Album model to Folder
@@ -1,6 +1,7 @@
package spec
import (
"cmp"
"path/filepath"
"sort"
@@ -22,6 +23,8 @@ func NewAlbumByTags(a *db.Album, artists []*db.Artist) *Album {
Year: a.TagYear,
Tracks: []*TrackChild{},
AverageRating: formatRating(a.AverageRating),
IsCompilation: a.TagCompilation,
ReleaseTypes: formatReleaseTypes(a.TagReleaseType),
}
if a.Cover != "" {
ret.CoverID = a.SID()
@@ -76,7 +79,7 @@ func NewTrackByTags(t *db.Track, album *db.Album) *TrackChild {
Path: filepath.Join(album.LeftPath, album.RightPath, t.Filename),
Size: t.Size,
Suffix: formatExt(t.Ext()),
Title: t.TagTitle,
Title: cmp.Or(t.TagTitle, t.Filename),
TrackNumber: t.TagTrackNumber,
DiscNumber: t.TagDiscNumber,
Type: "music",
@@ -10,3 +10,13 @@ func NewInternetRadioStation(irs *db.InternetRadioStation) *InternetRadioStation
HomepageURL: irs.HomepageURL,
}
}
func NewTCInternetRadioStation(irs *db.InternetRadioStation) *TrackChild {
return &TrackChild{
ID: irs.SID(),
Title: irs.Name,
IsDir: false,
IsVideo: false,
Type: "internetradio",
}
}
@@ -42,6 +42,8 @@ func NewPodcastEpisode(pe *db.PodcastEpisode) *PodcastEpisode {
BitRate: pe.Bitrate,
IsDir: false,
Size: pe.Size,
Album: pe.Album,
Artist: pe.Artist,
}
if pe.Podcast != nil {
r.Path = pe.AbsPath()
+71 -23
View File
@@ -2,13 +2,15 @@ package spec
import (
"fmt"
"html"
"regexp"
"strings"
"time"
"unicode"
"github.com/microcosm-cc/bluemonday"
"go.senan.xyz/gonic"
"go.senan.xyz/gonic/server/ctrlsubsonic/specid"
"jaytaylor.com/html2text"
)
// https://web.archive.org/web/20220707025402/https://www.subsonic.org/pages/api.jsp
@@ -69,6 +71,7 @@ type Response struct {
SimilarSongsTwo *SimilarSongsTwo `xml:"similarSongs2" json:"similarSongs2,omitempty"`
InternetRadioStations *InternetRadioStations `xml:"internetRadioStations" json:"internetRadioStations,omitempty"`
Lyrics *Lyrics `xml:"lyrics" json:"lyrics,omitempty"`
LyricsList *LyricsList `xml:"lyricsList" json:"lyricsList,omitempty"`
}
func NewResponse() *Response {
@@ -99,7 +102,7 @@ type Error struct {
Message string `xml:"message,attr" json:"message"`
}
func NewError(code int, message string, a ...interface{}) *Response {
func NewError(code int, message string, a ...any) *Response {
r := NewResponse()
r.Status = "failed"
r.Error = &Error{
@@ -125,7 +128,7 @@ type GenreRef struct {
// https://opensubsonic.netlify.app/docs/responses/albumid3/
type Album struct {
ID *specid.ID `xml:"id,attr,omitempty" json:"id"`
Created time.Time `xml:"created,attr,omitempty" json:"created,omitempty"`
Created time.Time `xml:"created,attr,omitempty" json:"created"`
// legacy or single tag mode
ArtistID *specid.ID `xml:"artistId,attr,omitempty" json:"artistId,omitempty"`
@@ -150,6 +153,9 @@ type Album struct {
Year int `xml:"year,attr,omitempty" json:"year,omitempty"`
Tracks []*TrackChild `xml:"song,omitempty" json:"song,omitempty"`
IsCompilation bool `xml:"isCompilation" json:"isCompilation"`
ReleaseTypes []string `xml:"releaseTypes" json:"releaseTypes"`
// star / rating
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`
@@ -195,7 +201,7 @@ type TrackChild struct {
Bitrate int `xml:"bitRate,attr,omitempty" json:"bitRate,omitempty"`
ContentType string `xml:"contentType,attr,omitempty" json:"contentType,omitempty"`
CoverID *specid.ID `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"`
CreatedAt time.Time `xml:"created,attr,omitempty" json:"created,omitempty"`
CreatedAt time.Time `xml:"created,attr,omitempty" json:"created"`
Duration int `xml:"duration,attr,omitempty" json:"duration,omitempty"`
Genre string `xml:"genre,attr,omitempty" json:"genre,omitempty"`
Genres []*GenreRef `xml:"genres,omitempty" json:"genres,omitempty"`
@@ -394,24 +400,26 @@ type PodcastChannel struct {
}
type PodcastEpisode struct {
ID *specid.ID `xml:"id,attr" json:"id"`
StreamID *specid.ID `xml:"streamId,attr" json:"streamId"`
ChannelID *specid.ID `xml:"channelId,attr" json:"channelId"`
Title string `xml:"title,attr" json:"title"`
Description string `xml:"description,attr" json:"description"`
PublishDate time.Time `xml:"publishDate,attr" json:"publishDate"`
Status string `xml:"status,attr" json:"status"`
Parent string `xml:"parent,attr" json:"parent"`
IsDir bool `xml:"isDir,attr" json:"isDir"`
Year int `xml:"year,attr" json:"year"`
Genre string `xml:"genre,attr" json:"genre"`
CoverArt *specid.ID `xml:"coverArt,attr" json:"coverArt"`
Size int `xml:"size,attr" json:"size"`
ContentType string `xml:"contentType,attr" json:"contentType"`
Suffix string `xml:"suffix,attr" json:"suffix"`
Duration int `xml:"duration,attr" json:"duration"`
BitRate int `xml:"bitRate,attr" json:"bitrate"`
Path string `xml:"path,attr" json:"path"`
ID *specid.ID `xml:"id,attr" json:"id"`
StreamID *specid.ID `xml:"streamId,attr" json:"streamId"`
ChannelID *specid.ID `xml:"channelId,attr" json:"channelId"`
Title string `xml:"title,attr" json:"title"`
Description string `xml:"description,attr" json:"description"`
PublishDate time.Time `xml:"publishDate,attr" json:"publishDate"`
Status string `xml:"status,attr" json:"status"`
Parent string `xml:"parent,attr" json:"parent"`
IsDir bool `xml:"isDir,attr" json:"isDir"`
Year int `xml:"year,attr" json:"year"`
Genre string `xml:"genre,attr" json:"genre"`
CoverArt *specid.ID `xml:"coverArt,attr" json:"coverArt"`
Size int `xml:"size,attr" json:"size"`
ContentType string `xml:"contentType,attr" json:"contentType"`
Suffix string `xml:"suffix,attr" json:"suffix"`
Duration int `xml:"duration,attr" json:"duration"`
BitRate int `xml:"bitRate,attr" json:"bitrate"`
Path string `xml:"path,attr" json:"path"`
Album string `xml:"album,attr" json:"album"`
Artist string `xml:"artist,attr" json:"artist"`
}
type Bookmarks struct {
@@ -468,6 +476,24 @@ type Lyrics struct {
Title string `xml:"title,attr,omitempty" json:"title,omitempty"`
}
type Lyric struct {
Start int64 `xml:"start,attr" json:"start"`
Value string `xml:",chardata" json:"value"`
}
type LyricsList struct {
StructuredLyrics []StructuredLyrics `xml:"structuredLyrics" json:"structuredLyrics"`
}
type StructuredLyrics struct {
Lang string `xml:"lang,attr" json:"lang"` // ISO 639 (or und, xxx if unknown)
Synced bool `xml:"synced,attr" json:"synced"`
Lines []Lyric `xml:"line" json:"line"`
DisplayArtist string `xml:"displayArtist,attr,omitempty" json:"displayArtist,omitempty"`
DisplayTitle string `xml:"displayTitle,attr,omitempty" json:"displayTitle,omitempty"`
Offset int `xml:"offset,attr,omitempty" json:"offset,omitempty"`
}
type OpenSubsonicExtension struct {
Name string `xml:"name,attr" json:"name"`
Versions []int `xml:"versions" json:"versions"`
@@ -486,12 +512,34 @@ func formatExt(ext string) string {
return strings.TrimPrefix(ext, ".")
}
func formatReleaseTypes(types string) []string {
parts := strings.Split(types, ",")
if len(parts) == 0 {
return []string{}
}
for i, part := range parts {
part = strings.TrimSpace(part)
if len(part) == 0 {
continue
}
part = string(unicode.ToUpper([]rune(part)[0])) + string([]rune(part)[1:])
if part == "Ep" {
part = "EP"
}
parts[i] = part
}
return parts
}
var doublePuncExpr = regexp.MustCompile(`\.\s+\.\s+`)
var licenceExpr = regexp.MustCompile(`(?i)\buser-contributed text.*`)
var readMoreExpr = regexp.MustCompile(`(?i)\bread more on.*`)
var bluemondayPolicy = bluemonday.StrictPolicy() //nolint:gochecknoglobals
func CleanExternalText(text string) string {
text, _ = html2text.FromString(text, html2text.Options{TextOnly: true})
text = bluemondayPolicy.Sanitize(text)
text = html.UnescapeString(text)
text = licenceExpr.ReplaceAllString(text, "")
text = readMoreExpr.ReplaceAllString(text, "")
text = doublePuncExpr.ReplaceAllString(text, ". ")
-1
View File
@@ -24,7 +24,6 @@ func TestParseID(t *testing.T) {
}
for _, tcase := range tcases {
tcase := tcase // pin
t.Run(tcase.param, func(t *testing.T) {
t.Parallel()
@@ -21,7 +21,9 @@
"name": "album-0",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-4",
@@ -37,7 +39,9 @@
"name": "album-1",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-5",
@@ -53,7 +57,9 @@
"name": "album-2",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-7",
@@ -69,7 +75,9 @@
"name": "album-0",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-8",
@@ -85,7 +93,9 @@
"name": "album-1",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-9",
@@ -101,7 +111,9 @@
"name": "album-2",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-11",
@@ -117,7 +129,9 @@
"name": "album-0",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-12",
@@ -133,7 +147,9 @@
"name": "album-1",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-13",
@@ -149,7 +165,9 @@
"name": "album-2",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
}
]
}
+27 -9
View File
@@ -21,7 +21,9 @@
"name": "album-0",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-7",
@@ -37,7 +39,9 @@
"name": "album-0",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-11",
@@ -53,7 +57,9 @@
"name": "album-0",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-4",
@@ -69,7 +75,9 @@
"name": "album-1",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-8",
@@ -85,7 +93,9 @@
"name": "album-1",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-12",
@@ -101,7 +111,9 @@
"name": "album-1",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-5",
@@ -117,7 +129,9 @@
"name": "album-2",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-9",
@@ -133,7 +147,9 @@
"name": "album-2",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-13",
@@ -149,7 +165,9 @@
"name": "album-2",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
}
]
}
+27 -9
View File
@@ -21,7 +21,9 @@
"name": "album-0",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-4",
@@ -37,7 +39,9 @@
"name": "album-1",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-5",
@@ -53,7 +57,9 @@
"name": "album-2",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-7",
@@ -69,7 +75,9 @@
"name": "album-0",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-8",
@@ -85,7 +93,9 @@
"name": "album-1",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-9",
@@ -101,7 +111,9 @@
"name": "album-2",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-11",
@@ -117,7 +129,9 @@
"name": "album-0",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-12",
@@ -133,7 +147,9 @@
"name": "album-1",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-13",
@@ -149,7 +165,9 @@
"name": "album-2",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
}
]
}
+102 -84
View File
@@ -7,6 +7,24 @@
"openSubsonic": true,
"albumList": {
"album": [
{
"id": "al-11",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-2",
"artists": null,
"displayArtist": "",
"title": "album-0",
"album": "album-0",
"parent": "al-10",
"isDir": true,
"coverArt": "al-11",
"name": "album-0",
"songCount": 3,
"duration": 300,
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-5",
"created": "2019-11-30T00:00:00Z",
@@ -21,7 +39,9 @@
"name": "album-2",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-7",
@@ -37,71 +57,9 @@
"name": "album-0",
"songCount": 3,
"duration": 300,
"playCount": 0
},
{
"id": "al-13",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-2",
"artists": null,
"displayArtist": "",
"title": "album-2",
"album": "album-2",
"parent": "al-10",
"isDir": true,
"coverArt": "al-13",
"name": "album-2",
"songCount": 3,
"duration": 300,
"playCount": 0
},
{
"id": "al-3",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-0",
"artists": null,
"displayArtist": "",
"title": "album-0",
"album": "album-0",
"parent": "al-2",
"isDir": true,
"coverArt": "al-3",
"name": "album-0",
"songCount": 3,
"duration": 300,
"playCount": 0
},
{
"id": "al-4",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-0",
"artists": null,
"displayArtist": "",
"title": "album-1",
"album": "album-1",
"parent": "al-2",
"isDir": true,
"coverArt": "al-4",
"name": "album-1",
"songCount": 3,
"duration": 300,
"playCount": 0
},
{
"id": "al-9",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-1",
"artists": null,
"displayArtist": "",
"title": "album-2",
"album": "album-2",
"parent": "al-6",
"isDir": true,
"coverArt": "al-9",
"name": "album-2",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-12",
@@ -117,7 +75,81 @@
"name": "album-1",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-9",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-1",
"artists": null,
"displayArtist": "",
"title": "album-2",
"album": "album-2",
"parent": "al-6",
"isDir": true,
"coverArt": "al-9",
"name": "album-2",
"songCount": 3,
"duration": 300,
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-4",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-0",
"artists": null,
"displayArtist": "",
"title": "album-1",
"album": "album-1",
"parent": "al-2",
"isDir": true,
"coverArt": "al-4",
"name": "album-1",
"songCount": 3,
"duration": 300,
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-3",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-0",
"artists": null,
"displayArtist": "",
"title": "album-0",
"album": "album-0",
"parent": "al-2",
"isDir": true,
"coverArt": "al-3",
"name": "album-0",
"songCount": 3,
"duration": 300,
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-13",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-2",
"artists": null,
"displayArtist": "",
"title": "album-2",
"album": "album-2",
"parent": "al-10",
"isDir": true,
"coverArt": "al-13",
"name": "album-2",
"songCount": 3,
"duration": 300,
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
},
{
"id": "al-8",
@@ -133,23 +165,9 @@
"name": "album-1",
"songCount": 3,
"duration": 300,
"playCount": 0
},
{
"id": "al-11",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-2",
"artists": null,
"displayArtist": "",
"title": "album-0",
"album": "album-0",
"parent": "al-10",
"isDir": true,
"coverArt": "al-11",
"name": "album-0",
"songCount": 3,
"duration": 300,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": []
}
]
}
@@ -21,7 +21,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-4",
@@ -37,7 +39,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-5",
@@ -53,7 +57,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-7",
@@ -69,7 +75,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-8",
@@ -85,7 +93,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-9",
@@ -101,7 +111,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-11",
@@ -117,7 +129,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-12",
@@ -133,7 +147,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-13",
@@ -149,7 +165,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
}
]
}
@@ -21,7 +21,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-7",
@@ -37,7 +39,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-11",
@@ -53,7 +57,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-4",
@@ -69,7 +75,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-8",
@@ -85,7 +93,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-12",
@@ -101,7 +111,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-5",
@@ -117,7 +129,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-9",
@@ -133,7 +147,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-13",
@@ -149,7 +165,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
}
]
}
+27 -9
View File
@@ -21,7 +21,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-4",
@@ -37,7 +39,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-5",
@@ -53,7 +57,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-7",
@@ -69,7 +75,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-8",
@@ -85,7 +93,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-9",
@@ -101,7 +111,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-11",
@@ -117,7 +129,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-12",
@@ -133,7 +147,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-13",
@@ -149,7 +165,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
}
]
}
+102 -84
View File
@@ -21,39 +21,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
},
{
"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
},
{
"id": "al-11",
"created": "2019-11-30T00:00:00Z",
"artistId": "ar-3",
"artist": "artist-2",
"artists": [{ "id": "ar-3", "name": "artist-2" }],
"displayArtist": "artist-2",
"title": "album-0",
"album": "album-0",
"coverArt": "al-11",
"name": "album-0",
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-13",
@@ -69,55 +39,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
},
{
"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,
"year": 2021
},
{
"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,
"year": 2021
},
{
"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
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-8",
@@ -133,7 +57,9 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-9",
@@ -149,7 +75,99 @@
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021
"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",
"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",
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-11",
"created": "2019-11-30T00:00:00Z",
"artistId": "ar-3",
"artist": "artist-2",
"artists": [{ "id": "ar-3", "name": "artist-2" }],
"displayArtist": "artist-2",
"title": "album-0",
"album": "album-0",
"coverArt": "al-11",
"name": "album-0",
"songCount": 3,
"duration": 300,
"playCount": 0,
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
}
]
}
+3 -1
View File
@@ -107,7 +107,9 @@
"musicBrainzId": "",
"replayGain": null
}
]
],
"isCompilation": false,
"releaseTypes": ["Album"]
}
}
}
+3 -1
View File
@@ -16,7 +16,9 @@
"name": "",
"songCount": 0,
"duration": 0,
"playCount": 0
"playCount": 0,
"isCompilation": false,
"releaseTypes": [""]
}
}
}
+9 -3
View File
@@ -26,7 +26,9 @@
"playCount": 0,
"genre": "Unknown Genre",
"genres": [{ "name": "Unknown Genre" }],
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-4",
@@ -44,7 +46,9 @@
"playCount": 0,
"genre": "Unknown Genre",
"genres": [{ "name": "Unknown Genre" }],
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-5",
@@ -62,7 +66,9 @@
"playCount": 0,
"genre": "Unknown Genre",
"genres": [{ "name": "Unknown Genre" }],
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
}
]
}
+9 -3
View File
@@ -26,7 +26,9 @@
"playCount": 0,
"genre": "Unknown Genre",
"genres": [{ "name": "Unknown Genre" }],
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-12",
@@ -44,7 +46,9 @@
"playCount": 0,
"genre": "Unknown Genre",
"genres": [{ "name": "Unknown Genre" }],
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-13",
@@ -62,7 +66,9 @@
"playCount": 0,
"genre": "Unknown Genre",
"genres": [{ "name": "Unknown Genre" }],
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
}
]
}
+9 -3
View File
@@ -26,7 +26,9 @@
"playCount": 0,
"genre": "Unknown Genre",
"genres": [{ "name": "Unknown Genre" }],
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-8",
@@ -44,7 +46,9 @@
"playCount": 0,
"genre": "Unknown Genre",
"genres": [{ "name": "Unknown Genre" }],
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-9",
@@ -62,7 +66,9 @@
"playCount": 0,
"genre": "Unknown Genre",
"genres": [{ "name": "Unknown Genre" }],
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
}
]
}
@@ -13,7 +13,9 @@
{
"id": "tr-1",
"album": "album-0",
"albumId": "al-3",
"artist": "artist-0",
"artistId": "ar-1",
"artists": [{ "id": "ar-1", "name": "artist-0" }],
"displayArtist": "",
"albumArtists": null,
@@ -39,7 +41,9 @@
{
"id": "tr-2",
"album": "album-0",
"albumId": "al-3",
"artist": "artist-0",
"artistId": "ar-1",
"artists": [{ "id": "ar-1", "name": "artist-0" }],
"displayArtist": "",
"albumArtists": null,
@@ -65,7 +69,9 @@
{
"id": "tr-3",
"album": "album-0",
"albumId": "al-3",
"artist": "artist-0",
"artistId": "ar-1",
"artists": [{ "id": "ar-1", "name": "artist-0" }],
"displayArtist": "",
"albumArtists": null,
@@ -23,6 +23,7 @@
"isVideo": false,
"parent": "al-2",
"title": "album-0",
"year": 2021,
"musicBrainzId": "",
"replayGain": null
},
@@ -39,6 +40,7 @@
"isVideo": false,
"parent": "al-2",
"title": "album-1",
"year": 2021,
"musicBrainzId": "",
"replayGain": null
},
@@ -55,6 +57,7 @@
"isVideo": false,
"parent": "al-2",
"title": "album-2",
"year": 2021,
"musicBrainzId": "",
"replayGain": null
}
+27 -9
View File
@@ -23,7 +23,9 @@
"playCount": 0,
"genre": "Unknown Genre",
"genres": [{ "name": "Unknown Genre" }],
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-4",
@@ -41,7 +43,9 @@
"playCount": 0,
"genre": "Unknown Genre",
"genres": [{ "name": "Unknown Genre" }],
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-5",
@@ -59,7 +63,9 @@
"playCount": 0,
"genre": "Unknown Genre",
"genres": [{ "name": "Unknown Genre" }],
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-7",
@@ -77,7 +83,9 @@
"playCount": 0,
"genre": "Unknown Genre",
"genres": [{ "name": "Unknown Genre" }],
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-8",
@@ -95,7 +103,9 @@
"playCount": 0,
"genre": "Unknown Genre",
"genres": [{ "name": "Unknown Genre" }],
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-9",
@@ -113,7 +123,9 @@
"playCount": 0,
"genre": "Unknown Genre",
"genres": [{ "name": "Unknown Genre" }],
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-11",
@@ -131,7 +143,9 @@
"playCount": 0,
"genre": "Unknown Genre",
"genres": [{ "name": "Unknown Genre" }],
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-12",
@@ -149,7 +163,9 @@
"playCount": 0,
"genre": "Unknown Genre",
"genres": [{ "name": "Unknown Genre" }],
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
},
{
"id": "al-13",
@@ -167,7 +183,9 @@
"playCount": 0,
"genre": "Unknown Genre",
"genres": [{ "name": "Unknown Genre" }],
"year": 2021
"year": 2021,
"isCompilation": false,
"releaseTypes": ["Album"]
}
]
}
+9
View File
@@ -20,6 +20,7 @@
"isVideo": false,
"parent": "al-2",
"title": "album-0",
"year": 2021,
"musicBrainzId": "",
"replayGain": null
},
@@ -36,6 +37,7 @@
"isVideo": false,
"parent": "al-2",
"title": "album-1",
"year": 2021,
"musicBrainzId": "",
"replayGain": null
},
@@ -52,6 +54,7 @@
"isVideo": false,
"parent": "al-2",
"title": "album-2",
"year": 2021,
"musicBrainzId": "",
"replayGain": null
},
@@ -68,6 +71,7 @@
"isVideo": false,
"parent": "al-6",
"title": "album-0",
"year": 2021,
"musicBrainzId": "",
"replayGain": null
},
@@ -84,6 +88,7 @@
"isVideo": false,
"parent": "al-6",
"title": "album-1",
"year": 2021,
"musicBrainzId": "",
"replayGain": null
},
@@ -100,6 +105,7 @@
"isVideo": false,
"parent": "al-6",
"title": "album-2",
"year": 2021,
"musicBrainzId": "",
"replayGain": null
},
@@ -116,6 +122,7 @@
"isVideo": false,
"parent": "al-10",
"title": "album-0",
"year": 2021,
"musicBrainzId": "",
"replayGain": null
},
@@ -132,6 +139,7 @@
"isVideo": false,
"parent": "al-10",
"title": "album-1",
"year": 2021,
"musicBrainzId": "",
"replayGain": null
},
@@ -148,6 +156,7 @@
"isVideo": false,
"parent": "al-10",
"title": "album-2",
"year": 2021,
"musicBrainzId": "",
"replayGain": null
}
+40
View File
@@ -10,7 +10,9 @@
{
"id": "tr-1",
"album": "album-0",
"albumId": "al-3",
"artist": "artist-0",
"artistId": "ar-1",
"artists": [{ "id": "ar-1", "name": "artist-0" }],
"displayArtist": "",
"albumArtists": null,
@@ -36,7 +38,9 @@
{
"id": "tr-2",
"album": "album-0",
"albumId": "al-3",
"artist": "artist-0",
"artistId": "ar-1",
"artists": [{ "id": "ar-1", "name": "artist-0" }],
"displayArtist": "",
"albumArtists": null,
@@ -62,7 +66,9 @@
{
"id": "tr-3",
"album": "album-0",
"albumId": "al-3",
"artist": "artist-0",
"artistId": "ar-1",
"artists": [{ "id": "ar-1", "name": "artist-0" }],
"displayArtist": "",
"albumArtists": null,
@@ -88,7 +94,9 @@
{
"id": "tr-4",
"album": "album-1",
"albumId": "al-4",
"artist": "artist-0",
"artistId": "ar-1",
"artists": [{ "id": "ar-1", "name": "artist-0" }],
"displayArtist": "",
"albumArtists": null,
@@ -114,7 +122,9 @@
{
"id": "tr-5",
"album": "album-1",
"albumId": "al-4",
"artist": "artist-0",
"artistId": "ar-1",
"artists": [{ "id": "ar-1", "name": "artist-0" }],
"displayArtist": "",
"albumArtists": null,
@@ -140,7 +150,9 @@
{
"id": "tr-6",
"album": "album-1",
"albumId": "al-4",
"artist": "artist-0",
"artistId": "ar-1",
"artists": [{ "id": "ar-1", "name": "artist-0" }],
"displayArtist": "",
"albumArtists": null,
@@ -166,7 +178,9 @@
{
"id": "tr-7",
"album": "album-2",
"albumId": "al-5",
"artist": "artist-0",
"artistId": "ar-1",
"artists": [{ "id": "ar-1", "name": "artist-0" }],
"displayArtist": "",
"albumArtists": null,
@@ -192,7 +206,9 @@
{
"id": "tr-8",
"album": "album-2",
"albumId": "al-5",
"artist": "artist-0",
"artistId": "ar-1",
"artists": [{ "id": "ar-1", "name": "artist-0" }],
"displayArtist": "",
"albumArtists": null,
@@ -218,7 +234,9 @@
{
"id": "tr-9",
"album": "album-2",
"albumId": "al-5",
"artist": "artist-0",
"artistId": "ar-1",
"artists": [{ "id": "ar-1", "name": "artist-0" }],
"displayArtist": "",
"albumArtists": null,
@@ -244,7 +262,9 @@
{
"id": "tr-10",
"album": "album-0",
"albumId": "al-7",
"artist": "artist-1",
"artistId": "ar-2",
"artists": [{ "id": "ar-2", "name": "artist-1" }],
"displayArtist": "",
"albumArtists": null,
@@ -270,7 +290,9 @@
{
"id": "tr-11",
"album": "album-0",
"albumId": "al-7",
"artist": "artist-1",
"artistId": "ar-2",
"artists": [{ "id": "ar-2", "name": "artist-1" }],
"displayArtist": "",
"albumArtists": null,
@@ -296,7 +318,9 @@
{
"id": "tr-12",
"album": "album-0",
"albumId": "al-7",
"artist": "artist-1",
"artistId": "ar-2",
"artists": [{ "id": "ar-2", "name": "artist-1" }],
"displayArtist": "",
"albumArtists": null,
@@ -322,7 +346,9 @@
{
"id": "tr-13",
"album": "album-1",
"albumId": "al-8",
"artist": "artist-1",
"artistId": "ar-2",
"artists": [{ "id": "ar-2", "name": "artist-1" }],
"displayArtist": "",
"albumArtists": null,
@@ -348,7 +374,9 @@
{
"id": "tr-14",
"album": "album-1",
"albumId": "al-8",
"artist": "artist-1",
"artistId": "ar-2",
"artists": [{ "id": "ar-2", "name": "artist-1" }],
"displayArtist": "",
"albumArtists": null,
@@ -374,7 +402,9 @@
{
"id": "tr-15",
"album": "album-1",
"albumId": "al-8",
"artist": "artist-1",
"artistId": "ar-2",
"artists": [{ "id": "ar-2", "name": "artist-1" }],
"displayArtist": "",
"albumArtists": null,
@@ -400,7 +430,9 @@
{
"id": "tr-16",
"album": "album-2",
"albumId": "al-9",
"artist": "artist-1",
"artistId": "ar-2",
"artists": [{ "id": "ar-2", "name": "artist-1" }],
"displayArtist": "",
"albumArtists": null,
@@ -426,7 +458,9 @@
{
"id": "tr-17",
"album": "album-2",
"albumId": "al-9",
"artist": "artist-1",
"artistId": "ar-2",
"artists": [{ "id": "ar-2", "name": "artist-1" }],
"displayArtist": "",
"albumArtists": null,
@@ -452,7 +486,9 @@
{
"id": "tr-18",
"album": "album-2",
"albumId": "al-9",
"artist": "artist-1",
"artistId": "ar-2",
"artists": [{ "id": "ar-2", "name": "artist-1" }],
"displayArtist": "",
"albumArtists": null,
@@ -478,7 +514,9 @@
{
"id": "tr-19",
"album": "album-0",
"albumId": "al-11",
"artist": "artist-2",
"artistId": "ar-3",
"artists": [{ "id": "ar-3", "name": "artist-2" }],
"displayArtist": "",
"albumArtists": null,
@@ -504,7 +542,9 @@
{
"id": "tr-20",
"album": "album-0",
"albumId": "al-11",
"artist": "artist-2",
"artistId": "ar-3",
"artists": [{ "id": "ar-3", "name": "artist-2" }],
"displayArtist": "",
"albumArtists": null,