Author SHA1 Message Date
yaemiku c2e2e037a2 Merge branch 'master' into default_music_folder 2026-04-26 03:57:41 +02:00
yaemiku 0f469d7eac Merge branch 'master' into default_music_folder 2026-04-26 03:02:02 +02:00
Eric Munson f79af9c6a8 feat(podcast): ensure that any error path out of doPodcastDownload sets status (#672)
Release / Lint and test (push) Successful in 2m44s
Release / Run Release Please (push) Failing after 15s
Release / Notify IRC (push) Has been skipped
Release / Build binaries (386, linux) (push) Has been skipped
Release / Build binaries (386, windows) (push) Has been skipped
Release / Build binaries (amd64, darwin) (push) Has been skipped
Release / Build binaries (amd64, linux) (push) Has been skipped
Release / Build binaries (amd64, windows) (push) Has been skipped
Release / Build binaries (arm64, darwin) (push) Has been skipped
Release / Build binaries (arm64, linux) (push) Has been skipped
Release / Build, tag, and publish Docker image (push) Has been skipped
Some error paths out of this function are not setting the podcast status
to 'error'. Move the deferred error checking earlier to ensure the
status is set.

Signed-off-by: Eric B Munson <eric@munsonfam.org>
2026-04-26 03:00:56 +02:00
Florian Sorko 8df5f95a3d fix(podcast): fix crash if itunes extensions are missing (#668)
I came across this issue when I started to use a custom RSS
generator that works fine for e.g. the Apple Podcasts app
but results in a crash in gonic.

I found these nil pointer dereferences by looking at the stacktraces
only.
No time was spent looking for additional locations were this might need to
be fixed.

The custom generator if that helps
https://gist.github.com/diepfote/59aaf5eb8ea3e2d7bcdd97b8efd2a472
2026-04-26 03:00:55 +02:00
Eric Munson 3c46097df3 feat(subsonic): make error codes match Open Subsonic spec (#671)
There were a number of error codes being returned that did not match the
the code given by the spec. Primarily this was the use of error code 10
(missing input parameter) when 70 (data not found) was the more
appropriate return. Though several uses of 10 are actually 0 (internal
server or unspecified error).

Signed-off-by: Eric B Munson <eric@munsonfam.org>
2026-04-26 03:00:54 +02:00
sentriz 13098660d2 feat(playlist): use relative paths in m3u playlists
write playlist item paths relative to the playlist file directory, an resolve relative paths back to absolute on read

closes #537
closes #529
2026-04-26 03:00:53 +02:00
sentriz fb3fb745f8 fix(scanner): reset batch timer on fsnotify Remove events
fixes #637
2026-04-26 03:00:52 +02:00
sentriz ee43c4db00 fix(subsonic): update homepage URL casing
closes #664
2026-04-26 03:00:51 +02:00
sentriz da5f2ca01c update readme
closes #667
2026-04-26 03:00:50 +02:00
Kynn | CherryblueandSenan Kelly e4a07750e4 feat: support track level year tags (#661)
* [ PR Year @ Track-level ] This resolves issue #549

* Update db/migrations.go

Co-authored-by: Senan Kelly <senan@senan.xyz>

* [ PR #661 ] Fixes proposed by Sentriz (file indentation, simpler call to functions)

* [ PR #661 ] Fix File indentation for construct_by_folder

* [ PR #661 ] Set known tracks year field to their parent (album) year value ; until next deep scan.

* [ PR #661 ] Fix database field names in sql query

* Update db/migrations.go

Co-authored-by: Senan Kelly <senan@senan.xyz>

* Update db/migrations.go

Co-authored-by: Senan Kelly <senan@senan.xyz>

---------

Co-authored-by: Senan Kelly <senan@senan.xyz>
2026-04-26 03:00:49 +02:00
sentriz d42ce531c6 fix(listenbrainz): disable post-quantum TLS to avoid connection reset errors
listenbrainz's server can't handle the larger TLS ClientHello from
Go's post-quantum key exchange (Kyber). Explicitly set classic curve
preferences to avoid "connection reset by peer" errors.

https://github.com/golang/go/issues/70139
2026-04-26 03:00:48 +02:00
sentriz 3964c04419 feat: scan and return track contributors
Release / Lint and test (push) Successful in 3m1s
Release / Run Release Please (push) Failing after 9s
Release / Build, tag, and publish Docker image (push) Has been skipped
Release / Notify IRC (push) Has been skipped
Release / Build binaries (386, linux) (push) Has been skipped
Release / Build binaries (386, windows) (push) Has been skipped
Release / Build binaries (amd64, darwin) (push) Has been skipped
Release / Build binaries (amd64, linux) (push) Has been skipped
Release / Build binaries (amd64, windows) (push) Has been skipped
Release / Build binaries (arm64, darwin) (push) Has been skipped
Release / Build binaries (arm64, linux) (push) Has been skipped
2026-04-23 18:42:29 +01:00
sentriz f55cc3fe43 chore(deps)!: bump to go1.26
Release-As: 0.21.0
2026-04-23 18:42:05 +01:00
sentriz 61124b562c update gitignore 2026-04-21 17:23:09 +01:00
sentriz fd15ea9881 add dependabot.yml 2026-04-21 12:58:09 +01:00
sentriz ec457fb380 fix(lastfm): don't replace cached artist image with empty on refresh
last.fm intermittently omits the og:image meta tag from artist pages.
previously this would overwrite a good cached image URL with empty, leaving artists without
artwork until the next cache cycle
2026-04-14 10:37:46 +01:00
sentriz 5daf95cdeb fix(scanner): reduce sqlite lock contention during scans
closes #678
2026-04-03 13:56:31 +01:00
sentriz 0f98064bca fix(subsonic): return averageRating as float
fixes #677
2026-03-27 15:11:54 +00:00
sentriz bf8469cbf8 feat(subsonic): sort genres alphabetically by default 2026-03-27 14:45:30 +00:00
sentriz dec400022d fix(subsonic): unambiguate all columns 2026-03-27 14:45:30 +00:00
Eric Munson f5eecae4ef feat(docs): add Music Assistant to list of tested applications (#676)
Signed-off-by: Eric B Munson <eric@munsonfam.org>
2026-03-22 12:35:09 +01:00
yaemiku 002a38f7a6 Merge branch 'master' into default_music_folder 2026-03-11 22:15:20 +01:00
Eric Munson 192ee10b3f feat(podcast): ensure that any error path out of doPodcastDownload sets status (#672)
Some error paths out of this function are not setting the podcast status
to 'error'. Move the deferred error checking earlier to ensure the
status is set.

Signed-off-by: Eric B Munson <eric@munsonfam.org>
2026-03-11 16:37:53 +00:00
Florian Sorko 9473ec7539 fix(podcast): fix crash if itunes extensions are missing (#668)
I came across this issue when I started to use a custom RSS
generator that works fine for e.g. the Apple Podcasts app
but results in a crash in gonic.

I found these nil pointer dereferences by looking at the stacktraces
only.
No time was spent looking for additional locations were this might need to
be fixed.

The custom generator if that helps
https://gist.github.com/diepfote/59aaf5eb8ea3e2d7bcdd97b8efd2a472
2026-03-10 21:27:35 +00:00
Eric Munson 1b770c95d8 feat(subsonic): make error codes match Open Subsonic spec (#671)
There were a number of error codes being returned that did not match the
the code given by the spec. Primarily this was the use of error code 10
(missing input parameter) when 70 (data not found) was the more
appropriate return. Though several uses of 10 are actually 0 (internal
server or unspecified error).

Signed-off-by: Eric B Munson <eric@munsonfam.org>
2026-03-10 19:56:47 +00:00
sentriz 798e7f875a feat(playlist): use relative paths in m3u playlists
write playlist item paths relative to the playlist file directory, an resolve relative paths back to absolute on read

closes #537
closes #529
2026-03-09 15:26:21 +00:00
sentriz 65c4674da0 fix(scanner): reset batch timer on fsnotify Remove events
fixes #637
2026-03-09 14:57:12 +00:00
sentriz e535e7888c fix(subsonic): update homepage URL casing
closes #664
2026-03-09 14:49:01 +00:00
sentriz ad65a9ab3e update readme
closes #667
2026-03-09 14:46:20 +00:00
Kynn | CherryblueandSenan Kelly 5e916d0f4c feat: support track level year tags (#661)
* [ PR Year @ Track-level ] This resolves issue #549

* Update db/migrations.go

Co-authored-by: Senan Kelly <senan@senan.xyz>

* [ PR #661 ] Fixes proposed by Sentriz (file indentation, simpler call to functions)

* [ PR #661 ] Fix File indentation for construct_by_folder

* [ PR #661 ] Set known tracks year field to their parent (album) year value ; until next deep scan.

* [ PR #661 ] Fix database field names in sql query

* Update db/migrations.go

Co-authored-by: Senan Kelly <senan@senan.xyz>

* Update db/migrations.go

Co-authored-by: Senan Kelly <senan@senan.xyz>

---------

Co-authored-by: Senan Kelly <senan@senan.xyz>
2026-02-24 21:00:11 +01:00
sentriz b2674f8e5a fix(listenbrainz): disable post-quantum TLS to avoid connection reset errors
listenbrainz's server can't handle the larger TLS ClientHello from
Go's post-quantum key exchange (Kyber). Explicitly set classic curve
preferences to avoid "connection reset by peer" errors.

https://github.com/golang/go/issues/70139
2026-02-24 15:50:38 +01:00
yaemiku a7929ecb38 Merge branch 'master' into default_music_folder 2026-02-19 03:26:10 +01:00
yaemiku a63df166b0 Add default music path flag 2026-02-19 02:51:10 +01:00
sentriz 25a061f44e fix(listenbrainz): disable keep-alive to avoid connection reset errors 2026-02-17 15:36:20 +00:00
38 changed files with 771 additions and 371 deletions

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
version: 2
multi-ecosystem-groups:
all:
schedule:
interval: weekly
updates:
- package-ecosystem: docker
directory: /
multi-ecosystem-group: all
patterns: ["*"]
- package-ecosystem: github-actions
directory: /
multi-ecosystem-group: all
patterns: ["*"]
- package-ecosystem: gomod
directory: /
multi-ecosystem-group: all
patterns: ["*"]
+3
View File
@@ -12,3 +12,6 @@ dist
*.swp
.tags*
*.test
.env
config
genre-tree
+2 -2
View File
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
FROM --platform=$BUILDPLATFORM golang:1.25-alpine3.22 AS builder
FROM --platform=$BUILDPLATFORM golang:1.26-alpine3.23 AS builder
ARG TARGETOS
ARG TARGETARCH
WORKDIR /src
@@ -12,7 +12,7 @@ RUN \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /out/ ./cmd/...
FROM alpine:3.22
FROM alpine:3.23
LABEL org.opencontainers.image.source=https://github.com/sentriz/gonic
RUN apk add -U --no-cache \
ffmpeg \
+2 -1
View File
@@ -24,7 +24,7 @@
- support for the [album-artist](https://mkoby.com/2007/02/18/artist-versus-album-artist/) tag, to not clutter your artist list with compilation album appearances
- written in [go](https://golang.org/), so lightweight and suitable for a raspberry pi, etc. (see ARM images below)
- newer salt and token auth
- tested on [airsonic-refix](https://github.com/tamland/airsonic-refix), [symfonium](https://symfonium.app), [dsub](https://f-droid.org/en/packages/github.daneren2005.dsub/), [jamstash](http://jamstash.com/), [subsonic.el](https://git.sr.ht/~amk/subsonic.el), [sublime music](https://github.com/sublime-music/sublime-music), [soundwaves](https://apps.apple.com/us/app/soundwaves/id736139596), [stmp](https://github.com/wildeyedskies/stmp), [termsonic](https://git.sixfoisneuf.fr/termsonic/), [tempus](https://github.com/eddyizm/tempus/), [strawberry](https://www.strawberrymusicplayer.org/), and [ultrasonic](https://gitlab.com/ultrasonic/ultrasonic)
- tested on [airsonic-refix](https://github.com/tamland/airsonic-refix), [amperfy](https://github.com/BLeeEZ/amperfy), [symfonium](https://symfonium.app), [dsub](https://f-droid.org/en/packages/github.daneren2005.dsub/), [jamstash](https://github.com/sqrlmstr5000/Jamstash), [music-assistant](https://www.music-assistant.io/), [subsonic.el](https://git.sr.ht/~amk/subsonic.el), [sublime music](https://github.com/sublime-music/sublime-music), [soundwaves](https://apps.apple.com/us/app/soundwaves/id736139596), [stmp](https://github.com/wildeyedskies/stmp), [termsonic](https://git.sixfoisneuf.fr/termsonic/), [tempus](https://github.com/eddyizm/tempus/), [strawberry](https://www.strawberrymusicplayer.org/), and [ultrasonic](https://gitlab.com/ultrasonic/ultrasonic)
## installation
@@ -52,6 +52,7 @@ password can then be changed from the web interface
| env var | command line arg | description |
| ----------------------------------- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GONIC_MUSIC_PATH` | `-music-path` | path to your music collection (see also multi-folder support below) |
| `GONIC_DEFAULT_MUSIC_PATH` | `-default-music-path` | default music path for when no folder is selected in client (useful for when client does not support choosing a folder) |
| `GONIC_PODCAST_PATH` | `-podcast-path` | path to a podcasts directory |
| `GONIC_PLAYLISTS_PATH` | `-playlists-path` | path to new or existing directory with m3u files for subsonic playlists. items in the directory should be in the format `<userid>/<name>.m3u`. for example the admin user could have `1/my-playlist.m3u`. gonic create and make changes to these playlists over the subsonic api. |
| `GONIC_CACHE_PATH` | `-cache-path` | path to store audio transcodes, covers, etc |
+2 -1
View File
@@ -62,6 +62,7 @@ func main() {
var confMusicPaths pathAliases
flag.Var(&confMusicPaths, "music-path", "path to music")
defaultMusicPath := flag.String("default-music-path", "", "interval (in minutes) to automatically scan music (optional)")
confPlaylistsPath := flag.String("playlists-path", "", "path to your list of new or existing m3u playlists that gonic can manage")
@@ -256,7 +257,7 @@ func main() {
if err != nil {
log.Panicf("error creating admin controller: %v\n", err)
}
ctrlSubsonic, err := ctrlsubsonic.New(dbc, scannr, musicPaths, *confPodcastPath, cacheDirAudio, cacheDirCovers, jukebx, playlistStore, scrobblers, podcast, transcoder, lastfmClient, artistInfoCache, albumInfoCache, tagReader, resolveProxyPath)
ctrlSubsonic, err := ctrlsubsonic.New(dbc, scannr, musicPaths, *defaultMusicPath, *confPodcastPath, cacheDirAudio, cacheDirCovers, jukebx, playlistStore, scrobblers, podcast, transcoder, lastfmClient, artistInfoCache, albumInfoCache, tagReader, resolveProxyPath)
if err != nil {
log.Panicf("error creating subsonic controller: %v\n", err)
}
+63 -28
View File
@@ -54,19 +54,34 @@ func NewMock(opts url.Values) (*DB, error) {
}
func (db *DB) InsertBulkLeftMany(table string, head []string, left int, col []int) error {
if len(col) == 0 {
rows := make([][]any, len(col))
for i, c := range col {
rows[i] = []any{c}
}
return db.InsertBulkLeftManyRows(table, head, left, rows)
}
func (db *DB) InsertBulkLeftManyRows(table string, head []string, left int, rows [][]any) error {
if len(rows) == 0 {
return nil
}
var rows []string
var values []any
for _, c := range col {
rows = append(rows, "(?, ?)")
values = append(values, left, c)
tail := len(head) - 1
placeholder := "(?" + strings.Repeat(", ?", tail) + ")"
placeholders := make([]string, len(rows))
values := make([]any, 0, len(rows)*len(head))
for i, r := range rows {
if len(r) != tail {
return fmt.Errorf("row %d has %d values, expected %d", i, len(r), tail)
}
placeholders[i] = placeholder
values = append(values, left)
values = append(values, r...)
}
q := fmt.Sprintf("INSERT OR IGNORE INTO %q (%s) VALUES %s",
table,
strings.Join(head, ", "),
strings.Join(rows, ", "),
strings.Join(placeholders, ", "),
)
return db.Exec(q, values...).Error
}
@@ -127,15 +142,15 @@ func (db *DB) TransactionChunked(data []int64, cb func(*DB, []int64) error) erro
}
// https://sqlite.org/limits.html
const size = 999
return db.Transaction(func(tx *DB) error {
for i := 0; i < len(data); i += size {
end := min(i+size, len(data))
if err := cb(tx, data[i:end]); err != nil {
return err
}
for i := 0; i < len(data); i += size {
end := min(i+size, len(data))
if err := db.Transaction(func(tx *DB) error {
return cb(tx, data[i:end])
}); err != nil {
return err
}
return nil
})
}
return nil
}
type SettingKey string
@@ -211,19 +226,21 @@ type Track struct {
Filename string `gorm:"not null; unique_index:idx_folder_filename" sql:"default: null"`
FilenameUDec string `sql:"default: null"`
Album *Album
AlbumID int `gorm:"not null; unique_index:idx_folder_filename" sql:"default: null; type:int REFERENCES albums(id) ON DELETE CASCADE"`
Artists []*Artist `gorm:"many2many:track_artists"`
Genres []*Genre `gorm:"many2many:track_genres"`
Size int `sql:"default: null"`
Length int `sql:"default: null"`
Bitrate int `sql:"default: null"`
TagTitle string `sql:"default: null"`
TagTitleUDec string `sql:"default: null"`
TagTrackArtist string `sql:"default: null"`
TagTrackNumber int `sql:"default: null"`
TagDiscNumber int `sql:"default: null"`
TagBrainzID string `sql:"default: null"`
TagLyrics string `sql:"default: null"`
AlbumID int `gorm:"not null; unique_index:idx_folder_filename" sql:"default: null; type:int REFERENCES albums(id) ON DELETE CASCADE"`
Artists []*Artist `gorm:"many2many:track_artists"`
Contributors []*TrackContributor `gorm:"foreignkey:track_id"`
Genres []*Genre `gorm:"many2many:track_genres"`
Size int `sql:"default: null"`
Length int `sql:"default: null"`
Bitrate int `sql:"default: null"`
TagTitle string `sql:"default: null"`
TagTitleUDec string `sql:"default: null"`
TagTrackArtist string `sql:"default: null"`
TagTrackNumber int `sql:"default: null"`
TagDiscNumber int `sql:"default: null"`
TagBrainzID string `sql:"default: null"`
TagLyrics string `sql:"default: null"`
TagYear int `sql:"default: null"`
ReplayGainTrackGain float32
ReplayGainTrackPeak float32
@@ -403,6 +420,24 @@ type TrackArtist struct {
ArtistID int `gorm:"not null; unique_index:idx_track_id_artist_id" sql:"default: null; type:int REFERENCES artists(id) ON DELETE CASCADE"`
}
type ContributorRole string
const (
ContributorRoleComposer ContributorRole = "composer"
ContributorRoleLyricist ContributorRole = "lyricist"
ContributorRoleRemixer ContributorRole = "remixer"
ContributorRoleConductor ContributorRole = "conductor"
ContributorRoleProducer ContributorRole = "producer"
ContributorRoleArranger ContributorRole = "arranger"
)
type TrackContributor struct {
TrackID int `gorm:"not null; unique_index:idx_track_contributor" sql:"default: null; type:int REFERENCES tracks(id) ON DELETE CASCADE"`
ArtistID int `gorm:"not null; unique_index:idx_track_contributor" sql:"default: null; type:int REFERENCES artists(id) ON DELETE CASCADE"`
Role ContributorRole `gorm:"not null; unique_index:idx_track_contributor" sql:"default: null"`
Artist *Artist
}
type ArtistAppearances struct {
ArtistID int `gorm:"not null; unique_index:idx_artist_id_album_id" sql:"default: null; type:int REFERENCES artists(id) ON DELETE CASCADE"`
AlbumID int `gorm:"not null; unique_index:idx_artist_id_album_id" sql:"default: null; type:int REFERENCES albums(id) ON DELETE CASCADE"`
+25
View File
@@ -83,6 +83,8 @@ func (db *DB) Migrate(ctx MigrationContext) error {
construct(ctx, "202509301448", migrateAddTrackEmbeddedCover),
construct(ctx, "202512021147", migrateAlbumAddIndexOnCreatedAt),
construct(ctx, "202601201000", migrateAddAlbumDiscTitles),
construct(ctx, "202602061800", migrateAddTrackYear),
construct(ctx, "202604231200", migrateAddTrackContributors),
}
return gormigrate.
@@ -879,3 +881,26 @@ func migrateAlbumAddIndexOnCreatedAt(tx *gorm.DB, _ MigrationContext) error {
func migrateAddAlbumDiscTitles(tx *gorm.DB, _ MigrationContext) error {
return tx.AutoMigrate(AlbumDiscTitle{}).Error
}
func migrateAddTrackContributors(tx *gorm.DB, _ MigrationContext) error {
return tx.AutoMigrate(TrackContributor{}).Error
}
func migrateAddTrackYear(tx *gorm.DB, _ MigrationContext) error {
step := tx.AutoMigrate(Track{})
if err := step.Error; err != nil {
return fmt.Errorf("step auto migrate: %w", err)
}
step = tx.Exec(`
UPDATE tracks
SET tag_year=(SELECT tag_year
FROM albums
WHERE tracks.album_id = albums.id)
`)
if err := step.Error; err != nil {
return fmt.Errorf("step set default track year based on album's : %w", err)
}
return nil
}
-1
View File
@@ -7,7 +7,6 @@ import (
// Cgo-free Wasm database
_ "github.com/ncruces/go-sqlite3/driver"
_ "github.com/ncruces/go-sqlite3/embed"
// Cgo-free Wasm tagger
"go.senan.xyz/gonic/tags/taglib"
+14 -13
View File
@@ -1,6 +1,6 @@
module go.senan.xyz/gonic
go 1.25
go 1.26.0
require (
github.com/Masterminds/sprig v2.22.0+incompatible
@@ -19,11 +19,11 @@ require (
github.com/gorilla/sessions v1.4.0
github.com/jinzhu/gorm v1.9.17-0.20211120011537-5c235b72a414
github.com/josephburnett/jd v1.9.2
github.com/mattn/go-sqlite3 v1.14.33
github.com/mattn/go-sqlite3 v1.14.42
github.com/microcosm-cc/bluemonday v1.0.27
github.com/mitchellh/mapstructure v1.5.0
github.com/mmcdole/gofeed v1.3.0
github.com/ncruces/go-sqlite3 v0.30.4
github.com/ncruces/go-sqlite3 v0.33.3
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
github.com/philippta/go-template v0.0.0-20220911145045-4556aca435e4
github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be
@@ -31,20 +31,20 @@ require (
github.com/stretchr/testify v1.11.1
go.senan.xyz/flagconf v0.1.11
go.senan.xyz/taglib v0.11.1
go.senan.xyz/wrtag v0.20.0
golang.org/x/net v0.49.0
golang.org/x/sync v0.19.0
go.senan.xyz/wrtag v0.30.1-0.20260423121427-fec4b6e433cb
golang.org/x/net v0.53.0
golang.org/x/sync v0.20.0
gopkg.in/gormigrate.v1 v1.6.0
)
require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/PuerkitoBio/goquery v1.11.0 // indirect
github.com/PuerkitoBio/goquery v1.12.0 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-openapi/jsonpointer v0.22.4 // indirect
github.com/go-openapi/swag/jsonname v0.25.4 // indirect
github.com/go-openapi/jsonpointer v0.23.1 // indirect
github.com/go-openapi/swag/jsonname v0.26.0 // indirect
github.com/gorilla/context v1.1.2 // indirect
github.com/gorilla/css v1.0.1 // indirect
github.com/huandu/xstrings v1.5.0 // indirect
@@ -59,13 +59,14 @@ require (
github.com/mmcdole/goxpp v1.1.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/ncruces/go-sqlite3-wasm v1.1.1-0.20260409221933-87e4b35a38d0 // indirect
github.com/ncruces/julianday v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/tetratelabs/wazero v1.11.0 // indirect
golang.org/x/crypto v0.47.0 // indirect
golang.org/x/image v0.35.0 // indirect
golang.org/x/sys v0.40.0 // indirect
golang.org/x/text v0.33.0 // indirect
golang.org/x/crypto v0.50.0 // indirect
golang.org/x/image v0.39.0 // indirect
golang.org/x/sys v0.43.0 // indirect
golang.org/x/text v0.36.0 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
+30 -28
View File
@@ -6,8 +6,8 @@ github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF0
github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60=
github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o=
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
github.com/PuerkitoBio/goquery v1.11.0 h1:jZ7pwMQXIITcUXNH83LLk+txlaEy6NVOfTuP43xxfqw=
github.com/PuerkitoBio/goquery v1.11.0/go.mod h1:wQHgxUOU3JGuj3oD/QFfxUdlzW6xPHfqyHre6VMY4DQ=
github.com/PuerkitoBio/goquery v1.12.0 h1:pAcL4g3WRXekcB9AU/y1mbKez2dbY2AajVhtkO8RIBo=
github.com/PuerkitoBio/goquery v1.12.0/go.mod h1:802ej+gV2y7bbIhOIoPY5sT183ZW0YFofScC4q/hIpQ=
github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kktS1LM=
github.com/andybalholm/cascadia v1.3.3/go.mod h1:xNd9bqTn98Ln4DwST8/nG+H0yuB8Hmgu1YHNnWw0GeA=
@@ -37,12 +37,12 @@ github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/go-openapi/jsonpointer v0.22.4 h1:dZtK82WlNpVLDW2jlA1YCiVJFVqkED1MegOUy9kR5T4=
github.com/go-openapi/jsonpointer v0.22.4/go.mod h1:elX9+UgznpFhgBuaMQ7iu4lvvX1nvNsesQ3oxmYTw80=
github.com/go-openapi/swag/jsonname v0.25.4 h1:bZH0+MsS03MbnwBXYhuTttMOqk+5KcQ9869Vye1bNHI=
github.com/go-openapi/swag/jsonname v0.25.4/go.mod h1:GPVEk9CWVhNvWhZgrnvRA6utbAltopbKwDu8mXNUMag=
github.com/go-openapi/testify/v2 v2.0.2 h1:X999g3jeLcoY8qctY/c/Z8iBHTbwLz7R2WXd6Ub6wls=
github.com/go-openapi/testify/v2 v2.0.2/go.mod h1:HCPmvFFnheKK2BuwSA0TbbdxJ3I16pjwMkYkP4Ywn54=
github.com/go-openapi/jsonpointer v0.23.1 h1:1HBACs7XIwR2RcmItfdSFlALhGbe6S92p0ry4d1GWg4=
github.com/go-openapi/jsonpointer v0.23.1/go.mod h1:iWRmZTrGn7XwYhtPt/fvdSFj1OfNBngqRT2UG3BxSqY=
github.com/go-openapi/swag/jsonname v0.26.0 h1:gV1NFX9M8avo0YSpmWogqfQISigCmpaiNci8cGECU5w=
github.com/go-openapi/swag/jsonname v0.26.0/go.mod h1:urBBR8bZNoDYGr653ynhIx+gTeIz0ARZxHkAPktJK2M=
github.com/go-openapi/testify/v2 v2.4.2 h1:tiByHpvE9uHrrKjOszax7ZvKB7QOgizBWGBLuq0ePx4=
github.com/go-openapi/testify/v2 v2.4.2/go.mod h1:SgsVHtfooshd0tublTtJ50FPKhujf47YRqauXXOUxfw=
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
@@ -103,8 +103,8 @@ github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus=
github.com/mattn/go-sqlite3 v1.14.33 h1:A5blZ5ulQo2AtayQ9/limgHEkFreKj1Dv226a1K73s0=
github.com/mattn/go-sqlite3 v1.14.33/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/mattn/go-sqlite3 v1.14.42 h1:MigqEP4ZmHw3aIdIT7T+9TLa90Z6smwcthx+Azv4Cgo=
github.com/mattn/go-sqlite3 v1.14.42/go.mod h1:pjEuOr8IwzLJP2MfGeTb0A35jauH+C2kbHKBr7yXKVQ=
github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk=
github.com/microcosm-cc/bluemonday v1.0.27/go.mod h1:jFi9vgW+H7c3V0lb6nR74Ib/DIB5OBs92Dimizgw2cA=
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
@@ -122,8 +122,10 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/ncruces/go-sqlite3 v0.30.4 h1:j9hEoOL7f9ZoXl8uqXVniaq1VNwlWAXihZbTvhqPPjA=
github.com/ncruces/go-sqlite3 v0.30.4/go.mod h1:7WR20VSC5IZusKhUdiR9y1NsUqnZgqIYCmKKoMEYg68=
github.com/ncruces/go-sqlite3 v0.33.3 h1:6jCR3KuGvJSEwhaQrkHDGeIe2qCQ6nOUDNsPz7ZIotw=
github.com/ncruces/go-sqlite3 v0.33.3/go.mod h1:t2Osfw0wcKzJTgv2EvrkTtVLqlbKTA5Yvwb2ypAlBcY=
github.com/ncruces/go-sqlite3-wasm v1.1.1-0.20260409221933-87e4b35a38d0 h1:ymE9H30x1AyW5VfMNkJC9teuI2W1jjMsQS7kc6zl6Tg=
github.com/ncruces/go-sqlite3-wasm v1.1.1-0.20260409221933-87e4b35a38d0/go.mod h1:/H3+JykPsfSlvKbOxNSx9kKwm3ecqQGzyCs1e9KkNsU=
github.com/ncruces/julianday v1.0.0 h1:fH0OKwa7NWvniGQtxdJRxAgkBMolni2BjDHaWTxqt7M=
github.com/ncruces/julianday v1.0.0/go.mod h1:Dusn2KvZrrovOMJuOt0TNXL6tB7U2E8kvza5fFc9G7g=
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
@@ -152,8 +154,8 @@ go.senan.xyz/flagconf v0.1.11 h1:ApA9DpoSrfVQlLt8spKJC3fOT7oTEZ2/MmBGMnb9mt4=
go.senan.xyz/flagconf v0.1.11/go.mod h1:NqOFfSwJvNWXOTUabcRZ8mPK9+sJmhStJhqtEt74wNQ=
go.senan.xyz/taglib v0.11.1 h1:S3mO5e3HRRG0Ehw1jLUodYbAJK8TtqdOoNgqkC0D3uU=
go.senan.xyz/taglib v0.11.1/go.mod h1:qyTl978MnGeZ/ny4d/t0ErLXxysA+39X4+SNSCk56Zs=
go.senan.xyz/wrtag v0.20.0 h1:Q57ITuEl3TuRuOIkerCL+y4O3WrCqC1lUrewHtluUjc=
go.senan.xyz/wrtag v0.20.0/go.mod h1:1h39mVCOu6mqeQGYVToCvMhegBRCpOt6FO7g69EvuSM=
go.senan.xyz/wrtag v0.30.1-0.20260423121427-fec4b6e433cb h1:hFxxWH6MlgcHZQv2BpkQ1KSp8MSbXMHtN338/HfSzdY=
go.senan.xyz/wrtag v0.30.1-0.20260423121427-fec4b6e433cb/go.mod h1:sWPfwc3FM2O9Ka/l46vDp+/XwLCgywukxgfZipaWrKw=
golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
@@ -163,11 +165,11 @@ golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliY
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/crypto v0.47.0 h1:V6e3FRj+n4dbpw86FJ8Fv7XVOql7TEwpHapKoMJ/GO8=
golang.org/x/crypto v0.47.0/go.mod h1:ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A=
golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI=
golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.35.0 h1:LKjiHdgMtO8z7Fh18nGY6KDcoEtVfsgLDPeLyguqb7I=
golang.org/x/image v0.35.0/go.mod h1:MwPLTVgvxSASsxdLzKrl8BRFuyqMyGhLwmC+TO1Sybk=
golang.org/x/image v0.39.0 h1:skVYidAEVKgn8lZ602XO75asgXBgLj9G/FE3RbuPFww=
golang.org/x/image v0.39.0/go.mod h1:sIbmppfU+xFLPIG0FoVUTvyBMmgng1/XAMhQ2ft0hpA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
@@ -187,8 +189,8 @@ golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o=
golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8=
golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA=
golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -196,8 +198,8 @@ golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -212,8 +214,8 @@ golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI=
golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
@@ -232,16 +234,16 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE=
golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8=
golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg=
golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/tools v0.40.0 h1:yLkxfA+Qnul4cs9QA3KnlFu0lVmd8JJfoq+E41uSutA=
golang.org/x/tools v0.40.0/go.mod h1:Ik/tzLRlbscWpqqMRjyWYDisX8bG13FrdXp3o4Sr9lc=
golang.org/x/tools v0.44.0 h1:UP4ajHPIcuMjT1GqzDWRlalUEoY+uzoZKnhOjbIPD2c=
golang.org/x/tools v0.44.0/go.mod h1:KA0AfVErSdxRZIsOVipbv3rQhVXTnlU6UhKxHd1seDI=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+3 -2
View File
@@ -80,8 +80,9 @@ func (a *ArtistInfoCache) Lookup(ctx context.Context, artist *db.Artist) (*db.Ar
}
artistInfo.SetSimilarArtists(similar)
url, _ := a.lastfmClient.StealArtistImage(info.URL)
artistInfo.ImageURL = url
if url, _ := a.lastfmClient.StealArtistImage(info.URL); url != "" {
artistInfo.ImageURL = url
}
topTracksResponse, err := a.lastfmClient.ArtistGetTopTracks(artist.Name)
if err != nil {
+9 -5
View File
@@ -10,6 +10,7 @@ import (
"net/url"
"sort"
"strconv"
"strings"
"time"
"github.com/andybalholm/cascadia"
@@ -203,6 +204,9 @@ func (c *Client) StealArtistImage(artistURL string) (string, error) {
return "", fmt.Errorf("get artist url: %w", err)
}
defer resp.Body.Close()
if resp.StatusCode/100 != 2 {
return "", fmt.Errorf("get artist url: %s", resp.Status)
}
node, err := html.Parse(resp.Body)
if err != nil {
@@ -340,12 +344,12 @@ func GetParamSignature(params url.Values, secret string) string {
paramKeys = append(paramKeys, k)
}
sort.Strings(paramKeys)
toHash := ""
var toHash strings.Builder
for _, k := range paramKeys {
toHash += k
toHash += params[k][0]
toHash.WriteString(k)
toHash.WriteString(params[k][0])
}
toHash += secret
hash := md5.Sum([]byte(toHash))
toHash.WriteString(secret)
hash := md5.Sum([]byte(toHash.String()))
return hex.EncodeToString(hash[:])
}
+12 -1
View File
@@ -2,6 +2,7 @@ package listenbrainz
import (
"bytes"
"crypto/tls"
"encoding/json"
"errors"
"fmt"
@@ -30,7 +31,17 @@ type Client struct {
}
func NewClient() *Client {
return NewClientCustom(http.DefaultClient)
// disable post-quantum key exchange (Kyber) to avoid "connection reset by peer" errors.
// listenbrainz's server can't handle the larger TLS ClientHello
// https://github.com/golang/go/issues/70139
return NewClientCustom(&http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
MinVersion: tls.VersionTLS12,
CurvePreferences: []tls.CurveID{tls.X25519, tls.CurveP256, tls.CurveP384},
},
},
})
}
func NewClientCustom(httpClient *http.Client) *Client {
+6
View File
@@ -134,6 +134,9 @@ func (s *Store) Read(relPath string) (*Playlist, error) {
if strings.HasPrefix(line, "#") {
continue
}
if !filepath.IsAbs(line) {
line = filepath.Join(filepath.Dir(absPath), line)
}
playlist.Items = append(playlist.Items, line)
}
@@ -186,6 +189,9 @@ func (s *Store) Write(relPath string, playlist *Playlist) error {
fmt.Fprintln(file, encodeAttr(attrCommment, playlist.Comment))
fmt.Fprintln(file, encodeAttr(attrIsPublic, fmt.Sprint(playlist.IsPublic)))
for _, line := range playlist.Items {
if rel, err := filepath.Rel(filepath.Dir(absPath), line); err == nil {
line = rel
}
fmt.Fprintln(file, line)
}
+3 -3
View File
@@ -32,9 +32,9 @@ Example comment
It has multiple lines 👍
`,
Items: []string{
"item 1.flac",
"item 2.flac",
"item 3.flac",
"/music/item 1.flac",
"/music/item 2.flac",
"/music/item 3.flac",
},
IsPublic: true,
}
+17 -9
View File
@@ -81,13 +81,17 @@ func (p *Podcasts) AddNewPodcast(rssURL string, feed *gofeed.Feed) (*db.Podcast,
if err != nil {
return nil, fmt.Errorf("find unique podcast dir: %w", err)
}
var author string
if feed.ITunesExt != nil {
author = feed.ITunesExt.Author
}
podcast := db.Podcast{
Description: feed.Description,
ImageURL: "",
Title: feed.Title,
URL: rssURL,
RootDir: rootDir,
Author: feed.ITunesExt.Author,
Author: author,
}
if feed.Image != nil {
podcast.ImageURL = feed.Image.URL
@@ -226,6 +230,10 @@ func (p *Podcasts) isAudio(rawItemURL string) (bool, error) {
}
func itemToEpisode(podcast *db.Podcast, size, duration int, audio string, item *gofeed.Item) *db.PodcastEpisode {
author := podcast.Author
if item.ITunesExt != nil {
author = cmp.Or(item.ITunesExt.Author, podcast.Author)
}
return &db.PodcastEpisode{
PodcastID: podcast.ID,
Description: item.Description,
@@ -235,7 +243,7 @@ func itemToEpisode(podcast *db.Podcast, size, duration int, audio string, item *
PublishDate: item.PublishedParsed,
AudioURL: audio,
Status: db.PodcastEpisodeStatusSkipped,
Artist: cmp.Or(item.ITunesExt.Author, podcast.Author),
Artist: cmp.Or(author),
Album: podcast.Title,
}
}
@@ -508,6 +516,13 @@ func (p *Podcasts) doPodcastDownload(podcast *db.Podcast, podcastEpisode *db.Pod
}
defer resp.Body.Close()
defer func() {
if err != nil {
podcastEpisode.Status = db.PodcastEpisodeStatusError
_ = p.db.Save(podcastEpisode).Error
}
}()
if resp.StatusCode/100 != 2 {
return fmt.Errorf("fetch podcast audio: unexpected status %s", resp.Status)
}
@@ -529,13 +544,6 @@ func (p *Podcasts) doPodcastDownload(podcast *db.Podcast, podcastEpisode *db.Pod
}
defer file.Close()
defer func() {
if err != nil {
podcastEpisode.Status = db.PodcastEpisodeStatusError
_ = p.db.Save(podcastEpisode).Error
}
}()
if _, err := io.Copy(file, resp.Body); err != nil {
return fmt.Errorf("writing podcast episode: %w", err)
}
+69 -9
View File
@@ -188,6 +188,7 @@ func (s *Scanner) ExecuteWatch(ctx context.Context) error {
case event := <-watcher.Events:
if event.Op&(fsnotify.Remove) == fsnotify.Remove {
batchClean = true
batchT.Reset(batchInterval)
break
}
if event.Op&(fsnotify.Create|fsnotify.Write) == 0 {
@@ -371,20 +372,30 @@ func (s *Scanner) scanDir(st *State, absPath string) error {
return nil
}
// read tags outside the transaction to avoid holding db locks during disk i/o
type trackTagData struct {
trackUpdate
trprops tags.Properties
trags tags.Tags
}
tagData := make([]trackTagData, 0, len(trackUpdates))
for _, t := range trackUpdates {
trprops, trags, err := s.tagReader.Read(t.absPath)
if err != nil {
return fmt.Errorf("read %q: %w: %w", t.basename, err, ErrReadingTags)
}
tagData = append(tagData, trackTagData{trackUpdate: t, trprops: trprops, trags: trags})
}
return s.db.Transaction(func(tx *db.DB) error {
var discTitles = map[int]string{}
for _, t := range trackUpdates {
trprops, trags, err := s.tagReader.Read(t.absPath)
if err != nil {
return fmt.Errorf("read %q: %w: %w", t.basename, err, ErrReadingTags)
}
if err := s.populateTrackAndArtists(tx, st, t.i, &album, t.track, t.timeSpec, trprops, trags, t.basename, t.absPath); err != nil {
for _, t := range tagData {
if err := s.populateTrackAndArtists(tx, st, t.i, &album, t.track, t.timeSpec, t.trprops, t.trags, t.basename, t.absPath); err != nil {
return fmt.Errorf("populate track %q: %w", t.basename, err)
}
discNum := cmp.Or(tags.ParseInt(normtag.Get(trags, normtag.DiscNumber)), 1)
discSubtitle := normtag.Get(trags, "DISCSUBTITLE")
discNum := cmp.Or(tags.ParseInt(normtag.Get(t.trags, normtag.DiscNumber)), 1)
discSubtitle := normtag.Get(t.trags, "DISCSUBTITLE")
if _, exists := discTitles[discNum]; !exists && discSubtitle != "" {
discTitles[discNum] = discSubtitle
@@ -474,6 +485,14 @@ func (s *Scanner) populateTrackAndArtists(tx *db.DB, st *State, i int, album *db
return fmt.Errorf("populate track artists: %w", err)
}
contributorIDs, err := populateTrackContributors(tx, track, trags)
if err != nil {
return fmt.Errorf("populate track contributors: %w", err)
}
if err := populateArtistAppearances(tx, album, contributorIDs); err != nil {
return fmt.Errorf("populate contributor appearances: %w", err)
}
// possible album level embedded covers come only from the first track
if i == 0 {
if err := populateAlbumEmbeddedCover(tx, s.scanEmbeddedCover, album, track, trprops); err != nil {
@@ -569,6 +588,7 @@ func populateTrack(tx *db.DB, scanEmbeddedCover bool, album *db.Album, track *db
track.TagTrackNumber = tags.ParseInt(normtag.Get(trags, normtag.TrackNumber))
track.TagDiscNumber = tags.ParseInt(normtag.Get(trags, normtag.DiscNumber))
track.TagBrainzID = normtag.Get(trags, normtag.MusicBrainzRecordingID)
track.TagYear = tags.MustYear(trags)
track.ReplayGainTrackGain = tags.ParseDB(normtag.Get(trags, normtag.ReplayGainTrackGain))
track.ReplayGainTrackPeak = tags.ParseFloat(normtag.Get(trags, normtag.ReplayGainTrackPeak))
@@ -674,6 +694,46 @@ func populateAlbumArtists(tx *db.DB, album *db.Album, albumArtistIDs []int) erro
return nil
}
//nolint:gochecknoglobals
var contributorTagKeys = []struct {
keys []string
role db.ContributorRole
}{
{[]string{normtag.Remixers, normtag.Remixer}, db.ContributorRoleRemixer},
{[]string{normtag.Composers, normtag.Composer}, db.ContributorRoleComposer},
{[]string{normtag.Lyricists, normtag.Lyricist}, db.ContributorRoleLyricist},
{[]string{normtag.Conductors, normtag.Conductor}, db.ContributorRoleConductor},
{[]string{normtag.Producers, normtag.Producer}, db.ContributorRoleProducer},
{[]string{normtag.Arrangers, normtag.Arranger}, db.ContributorRoleArranger},
}
func populateTrackContributors(tx *db.DB, track *db.Track, trags tags.Tags) ([]int, error) {
if err := tx.Where("track_id=?", track.ID).Delete(db.TrackContributor{}).Error; err != nil {
return nil, fmt.Errorf("delete old track contributors: %w", err)
}
var rows [][]any
var artistIDs []int
for _, rk := range contributorTagKeys {
for _, name := range tags.FirstValues(trags, rk.keys...) {
if name == "" {
continue
}
artist, err := populateArtist(tx, name)
if err != nil {
return nil, fmt.Errorf("populate contributor artist: %w", err)
}
rows = append(rows, []any{artist.ID, string(rk.role)})
artistIDs = append(artistIDs, artist.ID)
}
}
if err := tx.InsertBulkLeftManyRows("track_contributors", []string{"track_id", "artist_id", "role"}, track.ID, rows); err != nil {
return nil, fmt.Errorf("insert bulk track contributors: %w", err)
}
return artistIDs, nil
}
func populateTrackArtists(tx *db.DB, track *db.Track, trackArtistIDs []int) error {
if err := tx.Where("track_id=?", track.ID).Delete(db.TrackArtist{}).Error; err != nil {
return fmt.Errorf("delete old track artists: %w", err)
+1 -1
View File
@@ -26,7 +26,7 @@ func FuzzScanner(f *testing.F) {
m := mockfs.New(t)
const toAdd = 1000
for i := 0; i < toAdd; i++ {
for i := range toAdd {
path := fmt.Sprintf("artist-%d/album-%d/track-%d.flac", i/6, i/3, i)
m.AddTrack(path)
m.SetTags(path, func(tags *mockfs.TagInfo) {
+68
View File
@@ -461,6 +461,74 @@ func TestMultiFolderWithSharedArtist(t *testing.T) {
}
}
func TestTrackContributors(t *testing.T) {
t.Parallel()
m := mockfs.New(t)
m.AddTrack("artist-a/album-a/track-1.flac")
m.SetTags("artist-a/album-a/track-1.flac", func(tags *mockfs.TagInfo) {
normtag.Set(tags.Tags, normtag.Artist, "artist-a")
normtag.Set(tags.Tags, normtag.AlbumArtist, "artist-a")
normtag.Set(tags.Tags, normtag.Album, "album-a")
normtag.Set(tags.Tags, normtag.Title, "track-1")
normtag.Set(tags.Tags, normtag.Composers, "comp-a", "comp-b")
normtag.Set(tags.Tags, normtag.Remixer, "rem-a")
normtag.Set(tags.Tags, "LYRICIST", "lyr-a")
normtag.Set(tags.Tags, "PRODUCER", "prod-a")
})
m.ScanAndClean()
var track db.Track
require.NoError(t, m.DB().Preload("Contributors.Artist").Where("tag_title=?", "track-1").First(&track).Error)
type pair struct {
Role db.ContributorRole
Artist string
}
var got []pair
for _, c := range track.Contributors {
got = append(got, pair{Role: c.Role, Artist: c.Artist.Name})
}
assert.ElementsMatch(t, []pair{
{db.ContributorRoleComposer, "comp-a"},
{db.ContributorRoleComposer, "comp-b"},
{db.ContributorRoleRemixer, "rem-a"},
{db.ContributorRoleLyricist, "lyr-a"},
{db.ContributorRoleProducer, "prod-a"},
}, got)
// contributor artists should also show up on the album via artist_appearances
for _, name := range []string{"comp-a", "comp-b", "rem-a", "lyr-a", "prod-a"} {
var count int
require.NoError(t, m.DB().
Model(&db.ArtistAppearances{}).
Joins("JOIN artists ON artists.id=artist_appearances.artist_id").
Where("artists.name=?", name).
Count(&count).Error)
assert.Equal(t, 1, count, "expected %q in artist_appearances", name)
}
// re-scanning with a changed composer list should clear the stale row (comp-b)
// and add the new one (comp-c). other roles stay since their tags didn't change.
m.SetTags("artist-a/album-a/track-1.flac", func(tags *mockfs.TagInfo) {
normtag.Set(tags.Tags, normtag.Composers, "comp-a", "comp-c")
})
m.ScanAndClean()
require.NoError(t, m.DB().Preload("Contributors.Artist").Where("tag_title=?", "track-1").First(&track).Error)
got = got[:0]
for _, c := range track.Contributors {
got = append(got, pair{Role: c.Role, Artist: c.Artist.Name})
}
assert.ElementsMatch(t, []pair{
{db.ContributorRoleComposer, "comp-a"},
{db.ContributorRoleComposer, "comp-c"},
{db.ContributorRoleRemixer, "rem-a"},
{db.ContributorRoleLyricist, "lyr-a"},
{db.ContributorRoleProducer, "prod-a"},
}, got)
}
func TestSymlinkedAlbum(t *testing.T) {
t.Parallel()
m := mockfs.NewWithDirs(t, []string{"scan"})
+33 -31
View File
@@ -53,44 +53,46 @@ 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
tagReader tags.Reader
dbc *db.DB
scanner *scanner.Scanner
musicPaths []MusicPath
defaultMusicPath string
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, tagReader tags.Reader, resolveProxyPath ProxyPathResolver) (*Controller, error) {
func New(dbc *db.DB, scannr *scanner.Scanner, musicPaths []MusicPath, defaultMusicPath string, 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) (*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,
tagReader: tagReader,
dbc: dbc,
scanner: scannr,
musicPaths: musicPaths,
defaultMusicPath: defaultMusicPath,
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,
}
+1
View File
@@ -44,6 +44,7 @@ func (c *Controller) ServeGetBookmarks(r *http.Request) *spec.Response {
Preload("Album").
Preload("Album.Artists").
Preload("Artists").
Preload("Contributors.Artist").
Find(&track, "id=?", bookmark.EntryID).
Error
if err != nil {
+8 -8
View File
@@ -25,7 +25,7 @@ func (c *Controller) ServeGetIndexes(r *http.Request) *spec.Response {
Select("id").
Model(&db.Album{}).
Where("parent_id IS NULL")
if m := getMusicFolder(c.musicPaths, params); m != "" {
if m := getMusicFolder(c, params); m != "" {
rootQ = rootQ.
Where("root_dir=?", m)
}
@@ -170,7 +170,7 @@ func (c *Controller) ServeGetAlbumList(r *http.Request) *spec.Response {
return spec.NewError(10, "unknown value %q for parameter 'type'", v)
}
if m := getMusicFolder(c.musicPaths, params); m != "" {
if m := getMusicFolder(c, params); m != "" {
q = q.Where("root_dir=?", m)
}
var folders []*db.Album
@@ -220,7 +220,7 @@ func (c *Controller) ServeSearchTwo(r *http.Request) *spec.Response {
Select("id").
Model(&db.Album{}).
Where("parent_id IS NULL")
if m := getMusicFolder(c.musicPaths, params); m != "" {
if m := getMusicFolder(c, params); m != "" {
rootQ = rootQ.Where("root_dir=?", m)
}
@@ -261,7 +261,7 @@ func (c *Controller) ServeSearchTwo(r *http.Request) *spec.Response {
Preload("AlbumRating", "user_id=?", user.ID).
Offset(params.GetOrInt("albumOffset", 0)).
Limit(params.GetOrInt("albumCount", 20))
if m := getMusicFolder(c.musicPaths, params); m != "" {
if m := getMusicFolder(c, params); m != "" {
q = q.Where("root_dir=?", m)
}
if err := q.Find(&albums).Error; err != nil {
@@ -287,7 +287,7 @@ func (c *Controller) ServeSearchTwo(r *http.Request) *spec.Response {
Preload("TrackRating", "user_id=?", user.ID).
Offset(params.GetOrInt("songOffset", 0)).
Limit(params.GetOrInt("songCount", 20))
if m := getMusicFolder(c.musicPaths, params); m != "" {
if m := getMusicFolder(c, params); m != "" {
q = q.
Joins("JOIN albums ON albums.id=tracks.album_id").
Where("albums.root_dir=?", m)
@@ -324,7 +324,7 @@ func (c *Controller) ServeGetStarred(r *http.Request) *spec.Response {
Select("id").
Model(&db.Album{}).
Where("parent_id IS NULL")
if m := getMusicFolder(c.musicPaths, params); m != "" {
if m := getMusicFolder(c, params); m != "" {
rootQ = rootQ.Where("root_dir=?", m)
}
@@ -350,7 +350,7 @@ func (c *Controller) ServeGetStarred(r *http.Request) *spec.Response {
Where("album_stars.user_id=?", user.ID).
Preload("AlbumStar", "user_id=?", user.ID).
Preload("AlbumRating", "user_id=?", user.ID)
if m := getMusicFolder(c.musicPaths, params); m != "" {
if m := getMusicFolder(c, params); m != "" {
q = q.Where("root_dir=?", m)
}
if err := q.Find(&albums).Error; err != nil {
@@ -369,7 +369,7 @@ func (c *Controller) ServeGetStarred(r *http.Request) *spec.Response {
Preload("Artists").
Preload("TrackStar", "user_id=?", user.ID).
Preload("TrackRating", "user_id=?", user.ID)
if m := getMusicFolder(c.musicPaths, params); m != "" {
if m := getMusicFolder(c, params); m != "" {
q = q.
Joins("JOIN albums ON albums.id=tracks.album_id").
Where("albums.root_dir=?", m)
+24 -15
View File
@@ -33,7 +33,7 @@ func (c *Controller) ServeGetArtists(r *http.Request) *spec.Response {
Preload("Info").
Group("artists.id").
Order("artists.name COLLATE NOCASE")
if m := getMusicFolder(c.musicPaths, params); m != "" {
if m := getMusicFolder(c, params); m != "" {
q = q.
Joins("JOIN albums ON albums.id=album_artists.album_id").
Where("albums.root_dir=?", m)
@@ -113,6 +113,7 @@ func (c *Controller) ServeGetAlbum(r *http.Request) *spec.Response {
return db.
Order("tracks.tag_disc_number, tracks.tag_track_number").
Preload("Artists").
Preload("Contributors.Artist").
Preload("TrackStar", "user_id=?", user.ID).
Preload("TrackRating", "user_id=?", user.ID)
}).
@@ -154,24 +155,24 @@ func (c *Controller) ServeGetAlbumListTwo(r *http.Request) *spec.Response {
q = q.Joins("JOIN artists ON artists.id=album_artists.artist_id")
q = q.Order("artists.name")
case "alphabeticalByName":
q = q.Order("tag_title")
q = q.Order("albums.tag_title")
case "byYear":
y1, y2 := params.GetOrInt("fromYear", 1800),
params.GetOrInt("toYear", 2200)
// support some clients sending wrong order like DSub
q = q.Where("tag_year BETWEEN ? AND ?", min(y1, y2), max(y1, y2))
q = q.Order("tag_year DESC")
q = q.Where("albums.tag_year BETWEEN ? AND ?", min(y1, y2), max(y1, y2))
q = q.Order("albums.tag_year DESC")
case "byGenre":
genre, _ := params.Get("genre")
q = q.Joins("JOIN album_genres ON album_genres.album_id=albums.id")
q = q.Joins("JOIN genres ON genres.id=album_genres.genre_id AND genres.name=?", genre)
q = q.Order("tag_title")
q = q.Order("albums.tag_title")
case "frequent":
user := r.Context().Value(CtxUser).(*db.User)
q = q.Joins("JOIN plays ON albums.id=plays.album_id AND plays.user_id=?", user.ID)
q = q.Order("plays.length DESC")
case "newest":
q = q.Order("created_at DESC")
q = q.Order("albums.created_at DESC")
case "random":
q = q.Order(gorm.Expr("random()"))
case "recent":
@@ -179,14 +180,14 @@ func (c *Controller) ServeGetAlbumListTwo(r *http.Request) *spec.Response {
q = q.Order("plays.time DESC")
case "starred":
q = q.Joins("JOIN album_stars ON albums.id=album_stars.album_id AND album_stars.user_id=?", user.ID)
q = q.Order("tag_title")
q = q.Order("albums.tag_title")
case "highest":
q = q.Joins("JOIN album_ratings ON album_ratings.album_id=albums.id AND album_ratings.user_id=?", user.ID)
q = q.Order("album_ratings.rating DESC")
default:
return spec.NewError(10, "unknown value %q for parameter 'type'", listType)
}
if m := getMusicFolder(c.musicPaths, params); m != "" {
if m := getMusicFolder(c, params); m != "" {
q = q.Where("root_dir=?", m)
}
var albums []*db.Album
@@ -254,7 +255,7 @@ func (c *Controller) ServeSearchThree(r *http.Request) *spec.Response {
Preload("Info").
Offset(params.GetOrInt("artistOffset", 0)).
Limit(params.GetOrInt("artistCount", 20))
if m := getMusicFolder(c.musicPaths, params); m != "" {
if m := getMusicFolder(c, params); m != "" {
q = q.Where("albums.root_dir=?", m)
}
if err := q.Find(&artists).Error; err != nil {
@@ -283,7 +284,7 @@ func (c *Controller) ServeSearchThree(r *http.Request) *spec.Response {
q = q.
Offset(params.GetOrInt("albumOffset", 0)).
Limit(params.GetOrInt("albumCount", 20))
if m := getMusicFolder(c.musicPaths, params); m != "" {
if m := getMusicFolder(c, params); m != "" {
q = q.Where("root_dir=?", m)
}
if err := q.Find(&albums).Error; err != nil {
@@ -300,6 +301,7 @@ func (c *Controller) ServeSearchThree(r *http.Request) *spec.Response {
Preload("Album.Artists").
Preload("Genres").
Preload("Artists").
Preload("Contributors.Artist").
Preload("TrackStar", "user_id=?", user.ID).
Preload("TrackRating", "user_id=?", user.ID)
switch {
@@ -311,7 +313,7 @@ func (c *Controller) ServeSearchThree(r *http.Request) *spec.Response {
}
q = q.Offset(params.GetOrInt("songOffset", 0)).
Limit(params.GetOrInt("songCount", 20))
if m := getMusicFolder(c.musicPaths, params); m != "" {
if m := getMusicFolder(c, params); m != "" {
q = q.
Joins("JOIN albums ON albums.id=tracks.album_id").
Where("albums.root_dir=?", m)
@@ -452,6 +454,7 @@ func (c *Controller) ServeGetGenres(_ *http.Request) *spec.Response {
(SELECT count(1) FROM album_genres WHERE genre_id=genres.id) album_count,
(SELECT count(1) FROM track_genres WHERE genre_id=genres.id) track_count`).
Group("genres.id").
Order("genres.name").
Find(&genres)
sub := spec.NewResponse()
sub.Genres = &spec.Genres{
@@ -478,11 +481,12 @@ func (c *Controller) ServeGetSongsByGenre(r *http.Request) *spec.Response {
Preload("Album").
Preload("Album.Artists").
Preload("Artists").
Preload("Contributors.Artist").
Preload("TrackStar", "user_id=?", user.ID).
Preload("TrackRating", "user_id=?", user.ID).
Offset(params.GetOrInt("offset", 0)).
Limit(params.GetOrInt("count", 10))
if m := getMusicFolder(c.musicPaths, params); m != "" {
if m := getMusicFolder(c, params); m != "" {
q = q.Where("albums.root_dir=?", m)
}
q = q.Group("tracks.id")
@@ -523,7 +527,7 @@ func (c *Controller) ServeGetStarredTwo(r *http.Request) *spec.Response {
Preload("ArtistRating", "user_id=?", user.ID).
Preload("Info").
Group("artists.id")
if m := getMusicFolder(c.musicPaths, params); m != "" {
if m := getMusicFolder(c, params); m != "" {
q = q.Where("albums.root_dir=?", m)
}
if err := q.Find(&artists).Error; err != nil {
@@ -544,7 +548,7 @@ func (c *Controller) ServeGetStarredTwo(r *http.Request) *spec.Response {
Preload("AlbumStar", "user_id=?", user.ID).
Preload("AlbumRating", "user_id=?", user.ID).
Preload("Play", "user_id=?", user.ID)
if m := getMusicFolder(c.musicPaths, params); m != "" {
if m := getMusicFolder(c, params); m != "" {
q = q.Where("albums.root_dir=?", m)
}
if err := q.Find(&albums).Error; err != nil {
@@ -563,9 +567,10 @@ func (c *Controller) ServeGetStarredTwo(r *http.Request) *spec.Response {
Preload("Album").
Preload("Album.Artists").
Preload("Artists").
Preload("Contributors.Artist").
Preload("TrackStar", "user_id=?", user.ID).
Preload("TrackRating", "user_id=?", user.ID)
if m := getMusicFolder(c.musicPaths, params); m != "" {
if m := getMusicFolder(c, params); m != "" {
q = q.
Joins("JOIN albums ON albums.id=tracks.album_id").
Where("albums.root_dir=?", m)
@@ -636,6 +641,7 @@ func (c *Controller) ServeGetTopSongs(r *http.Request) *spec.Response {
Where("artists.id=?", artist.ID).
Preload("Album").
Preload("Artists").
Preload("Contributors.Artist").
Preload("TrackStar", "user_id=?", user.ID).
Preload("TrackRating", "user_id=?", user.ID).
Group("tracks.id").
@@ -745,6 +751,7 @@ func getSimilarSongsFromTrack(c *Controller, id specid.ID, params params.Params,
Select("tracks.*").
Preload("Album").
Preload("Artists").
Preload("Contributors.Artist").
Preload("TrackStar", "user_id=?", user.ID).
Preload("TrackRating", "user_id=?", user.ID).
Where("tracks.tag_title IN (?)", similarTrackNames).
@@ -798,6 +805,7 @@ func getSimilarSongsFromArtist(c *Controller, id specid.ID, params params.Params
err = c.dbc.
Preload("Album").
Preload("Artists").
Preload("Contributors.Artist").
Preload("TrackStar", "user_id=?", user.ID).
Preload("TrackRating", "user_id=?", user.ID).
Joins("JOIN track_artists ON track_artists.track_id=tracks.id").
@@ -866,6 +874,7 @@ func getSimilarSongsFromAlbum(c *Controller, id specid.ID, params params.Params,
Select("tracks.*").
Preload("Album").
Preload("Artists").
Preload("Contributors.Artist").
Preload("TrackStar", "user_id=?", user.ID).
Preload("TrackRating", "user_id=?", user.ID).
Where("tracks.tag_title IN (?)", similarTrackNames).
+8 -5
View File
@@ -100,7 +100,7 @@ func (c *Controller) ServeScrobble(r *http.Request) *spec.Response {
return spec.NewError(0, "error updating stats: %v", err)
}
default:
return spec.NewError(10, "can't scrobble type %s", id.Type)
return spec.NewError(0, "can't scrobble type %s", id.Type)
}
if scrobbleTrack.Track == "" {
@@ -293,6 +293,7 @@ func (c *Controller) ServeGetSong(r *http.Request) *spec.Response {
Preload("Album").
Preload("Album.Artists").
Preload("Artists").
Preload("Contributors.Artist").
Preload("TrackStar", "user_id=?", user.ID).
Preload("TrackRating", "user_id=?", user.ID).
First(&track).
@@ -320,6 +321,7 @@ func (c *Controller) ServeGetRandomSongs(r *http.Request) *spec.Response {
Preload("Album").
Preload("Album.Artists").
Preload("Artists").
Preload("Contributors.Artist").
Preload("TrackStar", "user_id=?", user.ID).
Preload("TrackRating", "user_id=?", user.ID).
Joins("JOIN albums ON tracks.album_id=albums.id").
@@ -334,7 +336,7 @@ func (c *Controller) ServeGetRandomSongs(r *http.Request) *spec.Response {
q = q.Joins("JOIN track_genres ON track_genres.track_id=tracks.id")
q = q.Joins("JOIN genres ON genres.id=track_genres.genre_id AND genres.name=?", genre)
}
if m := getMusicFolder(c.musicPaths, params); m != "" {
if m := getMusicFolder(c, params); m != "" {
q = q.Where("albums.root_dir=?", m)
}
if err := q.Find(&tracks).Error; err != nil {
@@ -398,7 +400,7 @@ func (c *Controller) ServeJukebox(r *http.Request) *spec.Response { // nolint:go
switch id.Type {
case specid.Track:
var track db.Track
if err := c.dbc.Where("id=?", id.Value).Preload("Album").Preload("Album.Artists").Preload("Artists").Find(&track).Error; err != nil {
if err := c.dbc.Where("id=?", id.Value).Preload("Album").Preload("Album.Artists").Preload("Artists").Preload("Contributors.Artist").Find(&track).Error; err != nil {
return nil, fmt.Errorf("load track: %w", err)
}
ret = append(ret, spec.NewTrackByTags(&track, track.Album))
@@ -777,10 +779,11 @@ func scrobbleStatsUpdatePodcastEpisode(dbc *db.DB, peID int) error {
return nil
}
func getMusicFolder(musicPaths []MusicPath, p params.Params) string {
func getMusicFolder(c *Controller, p params.Params) string {
musicPaths := c.musicPaths
idx, err := p.GetInt("musicFolderId")
if err != nil {
return ""
return c.defaultMusicPath
}
if idx < 0 || idx >= len(musicPaths) {
return os.DevNull
+12 -9
View File
@@ -14,11 +14,14 @@ import (
func (c *Controller) ServeGetPodcasts(r *http.Request) *spec.Response {
params := r.Context().Value(CtxParams).(params.Params)
isIncludeEpisodes := params.GetOrBool("includeEpisodes", true)
id, _ := params.GetID("id")
podcasts, err := c.podcasts.GetPodcastOrAll(id.Value, isIncludeEpisodes)
id, err := params.GetID("id")
if err != nil {
return spec.NewError(10, "failed get podcast(s): %s", err)
}
podcasts, err := c.podcasts.GetPodcastOrAll(id.Value, isIncludeEpisodes)
if err != nil {
return spec.NewError(70, "failed get podcast(s): %s", err)
}
sub := spec.NewResponse()
sub.Podcasts = &spec.Podcasts{}
for _, podcast := range podcasts {
@@ -33,7 +36,7 @@ func (c *Controller) ServeGetNewestPodcasts(r *http.Request) *spec.Response {
count := params.GetOrInt("count", 10)
episodes, err := c.podcasts.GetNewestPodcastEpisodes(count)
if err != nil {
return spec.NewError(10, "failed get podcast(s): %s", err)
return spec.NewError(0, "failed get podcast(s): %s", err)
}
sub := spec.NewResponse()
sub.NewestPodcasts = &spec.NewestPodcasts{}
@@ -50,7 +53,7 @@ func (c *Controller) ServeDownloadPodcastEpisode(r *http.Request) *spec.Response
return spec.NewError(10, "please provide a valid podcast episode id")
}
if err := c.podcasts.DownloadEpisode(id.Value); err != nil {
return spec.NewError(10, "failed to download episode: %s", err)
return spec.NewError(0, "failed to download episode: %s", err)
}
return spec.NewResponse()
}
@@ -65,10 +68,10 @@ func (c *Controller) ServeCreatePodcastChannel(r *http.Request) *spec.Response {
fp := gofeed.NewParser()
feed, err := fp.ParseURL(rssURL)
if err != nil {
return spec.NewError(10, "failed to parse feed: %s", err)
return spec.NewError(0, "failed to parse feed: %s", err)
}
if _, err = c.podcasts.AddNewPodcast(rssURL, feed); err != nil {
return spec.NewError(10, "failed to add feed: %s", err)
return spec.NewError(0, "failed to add feed: %s", err)
}
return spec.NewResponse()
}
@@ -79,7 +82,7 @@ func (c *Controller) ServeRefreshPodcasts(r *http.Request) *spec.Response {
return spec.NewError(50, "user not admin")
}
if err := c.podcasts.RefreshPodcasts(); err != nil {
return spec.NewError(10, "failed to refresh feeds: %s", err)
return spec.NewError(0, "failed to refresh feeds: %s", err)
}
return spec.NewResponse()
}
@@ -95,7 +98,7 @@ func (c *Controller) ServeDeletePodcastChannel(r *http.Request) *spec.Response {
return spec.NewError(10, "please provide a valid podcast id")
}
if err := c.podcasts.DeletePodcast(id.Value); err != nil {
return spec.NewError(10, "failed to delete podcast: %s", err)
return spec.NewError(70, "failed to delete podcast: %s", err)
}
return spec.NewResponse()
}
@@ -111,7 +114,7 @@ func (c *Controller) ServeDeletePodcastEpisode(r *http.Request) *spec.Response {
return spec.NewError(10, "please provide a valid podcast episode id")
}
if err := c.podcasts.DeletePodcastEpisode(id.Value); err != nil {
return spec.NewError(10, "failed to delete podcast: %s", err)
return spec.NewError(70, "failed to delete podcast: %s", err)
}
return spec.NewResponse()
}
+2 -2
View File
@@ -82,7 +82,7 @@ func (c *Controller) ServeGetCoverArt(w http.ResponseWriter, r *http.Request) *s
reader, err := coverFor(c.dbc, c.artistInfoCache, c.playlistStore, c.tagReader, id)
if err != nil {
return spec.NewError(10, "couldn't find cover %q: %v", id, err)
return spec.NewError(70, "couldn't find cover %q: %v", id, err)
}
defer reader.Close()
@@ -107,7 +107,7 @@ func (c *Controller) ServeGetCoverArt(w http.ResponseWriter, r *http.Request) *s
resized := imaging.Fit(img, minSize, minSize, imaging.Lanczos)
if err := imaging.Save(resized, cachePath); err != nil {
return spec.NewError(10, "saving cover %q: %v", id, err)
return spec.NewError(0, "saving cover %q: %v", id, err)
}
serve(cachePath)
@@ -20,7 +20,7 @@ func NewAlbumByFolder(f *db.Album) *Album {
TrackCount: f.ChildCount,
Duration: f.Duration,
Created: f.CreatedAt,
AverageRating: formatRating(f.AverageRating),
AverageRating: f.AverageRating,
ReleaseTypes: []string{},
}
if f.AlbumStar != nil {
@@ -44,7 +44,7 @@ func NewTCAlbumByFolder(f *db.Album) *TrackChild {
Title: f.RightPath,
ParentID: f.ParentSID(),
CreatedAt: f.CreatedAt,
AverageRating: formatRating(f.AverageRating),
AverageRating: f.AverageRating,
Year: f.TagYear,
}
if f.AlbumStar != nil {
@@ -79,13 +79,13 @@ func NewTCTrackByFolder(t *db.Track, parent *db.Album) *TrackChild {
),
ParentID: parent.SID(),
Duration: t.Length,
Year: parent.TagYear,
Bitrate: t.Bitrate,
IsDir: false,
Type: "music",
MusicBrainzID: t.TagBrainzID,
CreatedAt: t.CreatedAt,
AverageRating: formatRating(t.AverageRating),
AverageRating: t.AverageRating,
Year: t.TagYear,
}
if trCh.Title == "" {
trCh.Title = t.Filename
@@ -170,7 +170,7 @@ func NewArtistByFolder(f *db.Album) *Artist {
ID: f.SID(),
Name: f.RightPath,
AlbumCount: f.ChildCount,
AverageRating: formatRating(f.AverageRating),
AverageRating: f.AverageRating,
}
if f.AlbumStar != nil {
a.Starred = &f.AlbumStar.StarDate
@@ -192,7 +192,7 @@ func NewDirectoryByFolder(f *db.Album, children []*TrackChild) *Directory {
Name: f.RightPath,
Children: children,
ParentID: f.ParentSID(),
AverageRating: formatRating(f.AverageRating),
AverageRating: f.AverageRating,
}
if f.AlbumStar != nil {
d.Starred = &f.AlbumStar.StarDate
+31 -10
View File
@@ -3,7 +3,9 @@ package spec
import (
"cmp"
"path/filepath"
"slices"
"sort"
"strings"
"go.senan.xyz/gonic/db"
)
@@ -22,7 +24,7 @@ func NewAlbumByTags(a *db.Album, artists []*db.Artist) *Album {
Genres: []*GenreRef{},
Year: a.TagYear,
Tracks: []*TrackChild{},
AverageRating: formatRating(a.AverageRating),
AverageRating: a.AverageRating,
IsCompilation: a.TagCompilation,
ReleaseTypes: formatReleaseTypes(a.TagReleaseType),
DiscTitles: []*DiscTitle{},
@@ -97,9 +99,9 @@ func NewTrackByTags(t *db.Track, album *db.Album) *TrackChild {
DiscNumber: t.TagDiscNumber,
Type: "music",
MusicBrainzID: t.TagBrainzID,
Year: album.TagYear,
AverageRating: formatRating(t.AverageRating),
AverageRating: t.AverageRating,
TranscodeMeta: TranscodeMeta{},
Year: t.TagYear,
}
switch {
@@ -118,12 +120,8 @@ func NewTrackByTags(t *db.Track, album *db.Album) *TrackChild {
ret.UserRating = t.TrackRating.Rating
}
sort.Slice(t.Artists, func(i, j int) bool {
return t.Artists[i].ID < t.Artists[j].ID
})
sort.Slice(album.Artists, func(i, j int) bool {
return album.Artists[i].ID < album.Artists[j].ID
})
slices.SortFunc(t.Artists, func(a, b *db.Artist) int { return cmp.Compare(a.ID, b.ID) })
slices.SortFunc(album.Artists, func(a, b *db.Artist) int { return cmp.Compare(a.ID, b.ID) })
switch {
case len(t.Artists) > 0:
@@ -145,6 +143,29 @@ func NewTrackByTags(t *db.Track, album *db.Album) *TrackChild {
for _, a := range album.Artists {
ret.AlbumArtists = append(ret.AlbumArtists, &ArtistRef{ID: a.SID(), Name: a.Name})
}
slices.SortStableFunc(t.Contributors, func(a, b *db.TrackContributor) int {
return cmp.Or(
cmp.Compare(a.Role, b.Role),
cmp.Compare(a.ArtistID, b.ArtistID),
)
})
var composers []string
for _, c := range t.Contributors {
if c.Artist == nil {
continue
}
ret.Contributors = append(ret.Contributors, &Contributor{
Role: string(c.Role),
Artist: &ArtistRef{ID: c.Artist.SID(), Name: c.Artist.Name},
})
if c.Role == db.ContributorRoleComposer {
composers = append(composers, c.Artist.Name)
}
}
ret.DisplayComposer = strings.Join(composers, ", ")
if t.ReplayGainTrackGain != 0 || t.ReplayGainAlbumGain != 0 {
ret.ReplayGain = &ReplayGain{
TrackGain: t.ReplayGainTrackGain,
@@ -162,7 +183,7 @@ func NewArtistByTags(a *db.Artist) *Artist {
Name: a.Name,
AlbumCount: a.AlbumCount,
Albums: []*Album{},
AverageRating: formatRating(a.AverageRating),
AverageRating: a.AverageRating,
}
if a.Info != nil && a.Info.ImageURL != "" {
r.CoverID = a.SID()
+14 -12
View File
@@ -125,6 +125,12 @@ type GenreRef struct {
Name string `xml:"name,attr" json:"name"`
}
// https://opensubsonic.netlify.app/docs/responses/contributor/
type Contributor struct {
Role string `xml:"role,attr" json:"role"`
Artist *ArtistRef `xml:"artist" json:"artist"`
}
type DiscTitle struct {
Disc int `xml:"disc,attr" json:"disc"`
Title string `xml:"title,attr" json:"title"`
@@ -165,7 +171,7 @@ type Album struct {
// star / rating
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`
AverageRating string `xml:"averageRating,attr,omitempty" json:"averageRating,omitempty"`
AverageRating float64 `xml:"averageRating,attr,omitempty" json:"averageRating,omitempty"`
}
type RandomTracks struct {
@@ -204,6 +210,9 @@ type TrackChild struct {
AlbumArtists []*ArtistRef `xml:"albumArtists" json:"albumArtists"`
AlbumDisplayArtist string `xml:"displayAlbumArtist,attr" json:"displayAlbumArtist"`
Contributors []*Contributor `xml:"contributors" json:"contributors"`
DisplayComposer string `xml:"displayComposer,attr" json:"displayComposer"`
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"`
@@ -228,7 +237,7 @@ type TrackChild struct {
// star / rating
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`
AverageRating string `xml:"averageRating,attr,omitempty" json:"averageRating,omitempty"`
AverageRating float64 `xml:"averageRating,attr,omitempty" json:"averageRating,omitempty"`
ReplayGain *ReplayGain `xml:"replayGain" json:"replayGain"`
@@ -249,7 +258,7 @@ type Artist struct {
// star / rating
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`
AverageRating string `xml:"averageRating,attr,omitempty" json:"averageRating,omitempty"`
AverageRating float64 `xml:"averageRating,attr,omitempty" json:"averageRating,omitempty"`
}
type Indexes struct {
@@ -269,7 +278,7 @@ type Directory struct {
Name string `xml:"name,attr,omitempty" json:"name"`
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`
AverageRating string `xml:"averageRating,attr,omitempty" json:"averageRating,omitempty"`
AverageRating float64 `xml:"averageRating,attr,omitempty" json:"averageRating,omitempty"`
Children []*TrackChild `xml:"child,omitempty" json:"child,omitempty"`
}
@@ -473,7 +482,7 @@ type InternetRadioStation struct {
ID *specid.ID `xml:"id,attr" json:"id"`
Name string `xml:"name,attr" json:"name"`
StreamURL string `xml:"streamUrl,attr" json:"streamUrl"`
HomepageURL string `xml:"homepageUrl,attr" json:"homepageUrl"`
HomepageURL string `xml:"homePageUrl,attr" json:"homePageUrl"`
}
type Lyrics struct {
@@ -507,13 +516,6 @@ type OpenSubsonicExtension struct {
type OpenSubsonicExtensions []OpenSubsonicExtension
func formatRating(rating float64) string {
if rating == 0 {
return ""
}
return fmt.Sprintf("%.2f", rating)
}
func formatExt(ext string) string {
return strings.TrimPrefix(ext, ".")
}
+74 -74
View File
@@ -8,55 +8,17 @@
"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": [],
"discTitles": null
},
{
"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": [],
"discTitles": null
},
{
"id": "al-7",
"id": "al-8",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-1",
"artists": null,
"displayArtist": "",
"title": "album-0",
"album": "album-0",
"title": "album-1",
"album": "album-1",
"parent": "al-6",
"isDir": true,
"coverArt": "al-7",
"name": "album-0",
"coverArt": "al-8",
"name": "album-1",
"songCount": 3,
"duration": 300,
"playCount": 0,
@@ -84,17 +46,17 @@
"discTitles": null
},
{
"id": "al-4",
"id": "al-11",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-0",
"artist": "artist-2",
"artists": null,
"displayArtist": "",
"title": "album-1",
"album": "album-1",
"parent": "al-2",
"title": "album-0",
"album": "album-0",
"parent": "al-10",
"isDir": true,
"coverArt": "al-4",
"name": "album-1",
"coverArt": "al-11",
"name": "album-0",
"songCount": 3,
"duration": 300,
"playCount": 0,
@@ -103,17 +65,17 @@
"discTitles": null
},
{
"id": "al-8",
"id": "al-7",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-1",
"artists": null,
"displayArtist": "",
"title": "album-1",
"album": "album-1",
"title": "album-0",
"album": "album-0",
"parent": "al-6",
"isDir": true,
"coverArt": "al-8",
"name": "album-1",
"coverArt": "al-7",
"name": "album-0",
"songCount": 3,
"duration": 300,
"playCount": 0,
@@ -140,25 +102,6 @@
"releaseTypes": [],
"discTitles": null
},
{
"id": "al-12",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-2",
"artists": null,
"displayArtist": "",
"title": "album-1",
"album": "album-1",
"parent": "al-10",
"isDir": true,
"coverArt": "al-12",
"name": "album-1",
"songCount": 3,
"duration": 300,
"playCount": 0,
"isCompilation": false,
"releaseTypes": [],
"discTitles": null
},
{
"id": "al-3",
"created": "2019-11-30T00:00:00Z",
@@ -177,6 +120,63 @@
"isCompilation": false,
"releaseTypes": [],
"discTitles": null
},
{
"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": [],
"discTitles": null
},
{
"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": [],
"discTitles": null
},
{
"id": "al-12",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-2",
"artists": null,
"displayArtist": "",
"title": "album-1",
"album": "album-1",
"parent": "al-10",
"isDir": true,
"coverArt": "al-12",
"name": "album-1",
"songCount": 3,
"duration": 300,
"playCount": 0,
"isCompilation": false,
"releaseTypes": [],
"discTitles": null
}
]
}
+83 -83
View File
@@ -8,79 +8,16 @@
"albumList2": {
"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"],
"discTitles": []
},
{
"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"],
"discTitles": []
},
{
"id": "al-9",
"id": "al-8",
"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"],
"discTitles": []
},
{
"id": "al-3",
"created": "2019-11-30T00:00:00Z",
"artistId": "ar-1",
"artist": "artist-0",
"artists": [{ "id": "ar-1", "name": "artist-0" }],
"displayArtist": "artist-0",
"title": "album-0",
"album": "album-0",
"coverArt": "al-3",
"name": "album-0",
"title": "album-1",
"album": "album-1",
"coverArt": "al-8",
"name": "album-1",
"songCount": 3,
"duration": 300,
"playCount": 0,
@@ -134,16 +71,16 @@
"discTitles": []
},
{
"id": "al-8",
"id": "al-3",
"created": "2019-11-30T00:00:00Z",
"artistId": "ar-2",
"artist": "artist-1",
"artists": [{ "id": "ar-2", "name": "artist-1" }],
"displayArtist": "artist-1",
"title": "album-1",
"album": "album-1",
"coverArt": "al-8",
"name": "album-1",
"artistId": "ar-1",
"artist": "artist-0",
"artists": [{ "id": "ar-1", "name": "artist-0" }],
"displayArtist": "artist-0",
"title": "album-0",
"album": "album-0",
"coverArt": "al-3",
"name": "album-0",
"songCount": 3,
"duration": 300,
"playCount": 0,
@@ -155,15 +92,15 @@
"discTitles": []
},
{
"id": "al-4",
"id": "al-12",
"created": "2019-11-30T00:00:00Z",
"artistId": "ar-1",
"artist": "artist-0",
"artists": [{ "id": "ar-1", "name": "artist-0" }],
"displayArtist": "artist-0",
"artistId": "ar-3",
"artist": "artist-2",
"artists": [{ "id": "ar-3", "name": "artist-2" }],
"displayArtist": "artist-2",
"title": "album-1",
"album": "album-1",
"coverArt": "al-4",
"coverArt": "al-12",
"name": "album-1",
"songCount": 3,
"duration": 300,
@@ -195,6 +132,69 @@
"isCompilation": false,
"releaseTypes": ["Album"],
"discTitles": []
},
{
"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"],
"discTitles": []
},
{
"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"],
"discTitles": []
},
{
"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"],
"discTitles": []
}
]
}
@@ -33,6 +33,8 @@
"displayArtist": "artist-0",
"albumArtists": [{ "id": "ar-1", "name": "artist-0" }],
"displayAlbumArtist": "artist-0",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-3",
@@ -61,6 +63,8 @@
"displayArtist": "artist-0",
"albumArtists": [{ "id": "ar-1", "name": "artist-0" }],
"displayAlbumArtist": "artist-0",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-3",
@@ -89,6 +93,8 @@
"displayArtist": "artist-0",
"albumArtists": [{ "id": "ar-1", "name": "artist-0" }],
"displayAlbumArtist": "artist-0",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-3",
@@ -20,6 +20,8 @@
"displayArtist": "artist-0",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-3",
@@ -48,6 +50,8 @@
"displayArtist": "artist-0",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-3",
@@ -76,6 +80,8 @@
"displayArtist": "artist-0",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-3",
@@ -17,6 +17,8 @@
"displayArtist": "",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"coverArt": "al-3",
"created": "2019-11-30T00:00:00Z",
"isDir": true,
@@ -34,6 +36,8 @@
"displayArtist": "",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"coverArt": "al-4",
"created": "2019-11-30T00:00:00Z",
"isDir": true,
@@ -51,6 +55,8 @@
"displayArtist": "",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"coverArt": "al-5",
"created": "2019-11-30T00:00:00Z",
"isDir": true,
+40
View File
@@ -17,6 +17,8 @@
"displayArtist": "artist-0",
"albumArtists": [{ "id": "ar-1", "name": "artist-0" }],
"displayAlbumArtist": "artist-0",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-3",
@@ -47,6 +49,8 @@
"displayArtist": "artist-0",
"albumArtists": [{ "id": "ar-1", "name": "artist-0" }],
"displayAlbumArtist": "artist-0",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-3",
@@ -77,6 +81,8 @@
"displayArtist": "artist-0",
"albumArtists": [{ "id": "ar-1", "name": "artist-0" }],
"displayAlbumArtist": "artist-0",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-3",
@@ -107,6 +113,8 @@
"displayArtist": "artist-0",
"albumArtists": [{ "id": "ar-1", "name": "artist-0" }],
"displayAlbumArtist": "artist-0",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-4",
@@ -137,6 +145,8 @@
"displayArtist": "artist-0",
"albumArtists": [{ "id": "ar-1", "name": "artist-0" }],
"displayAlbumArtist": "artist-0",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-4",
@@ -167,6 +177,8 @@
"displayArtist": "artist-0",
"albumArtists": [{ "id": "ar-1", "name": "artist-0" }],
"displayAlbumArtist": "artist-0",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-4",
@@ -197,6 +209,8 @@
"displayArtist": "artist-0",
"albumArtists": [{ "id": "ar-1", "name": "artist-0" }],
"displayAlbumArtist": "artist-0",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-5",
@@ -227,6 +241,8 @@
"displayArtist": "artist-0",
"albumArtists": [{ "id": "ar-1", "name": "artist-0" }],
"displayAlbumArtist": "artist-0",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-5",
@@ -257,6 +273,8 @@
"displayArtist": "artist-0",
"albumArtists": [{ "id": "ar-1", "name": "artist-0" }],
"displayAlbumArtist": "artist-0",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-5",
@@ -287,6 +305,8 @@
"displayArtist": "artist-1",
"albumArtists": [{ "id": "ar-2", "name": "artist-1" }],
"displayAlbumArtist": "artist-1",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-7",
@@ -317,6 +337,8 @@
"displayArtist": "artist-1",
"albumArtists": [{ "id": "ar-2", "name": "artist-1" }],
"displayAlbumArtist": "artist-1",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-7",
@@ -347,6 +369,8 @@
"displayArtist": "artist-1",
"albumArtists": [{ "id": "ar-2", "name": "artist-1" }],
"displayAlbumArtist": "artist-1",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-7",
@@ -377,6 +401,8 @@
"displayArtist": "artist-1",
"albumArtists": [{ "id": "ar-2", "name": "artist-1" }],
"displayAlbumArtist": "artist-1",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-8",
@@ -407,6 +433,8 @@
"displayArtist": "artist-1",
"albumArtists": [{ "id": "ar-2", "name": "artist-1" }],
"displayAlbumArtist": "artist-1",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-8",
@@ -437,6 +465,8 @@
"displayArtist": "artist-1",
"albumArtists": [{ "id": "ar-2", "name": "artist-1" }],
"displayAlbumArtist": "artist-1",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-8",
@@ -467,6 +497,8 @@
"displayArtist": "artist-1",
"albumArtists": [{ "id": "ar-2", "name": "artist-1" }],
"displayAlbumArtist": "artist-1",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-9",
@@ -497,6 +529,8 @@
"displayArtist": "artist-1",
"albumArtists": [{ "id": "ar-2", "name": "artist-1" }],
"displayAlbumArtist": "artist-1",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-9",
@@ -527,6 +561,8 @@
"displayArtist": "artist-1",
"albumArtists": [{ "id": "ar-2", "name": "artist-1" }],
"displayAlbumArtist": "artist-1",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-9",
@@ -557,6 +593,8 @@
"displayArtist": "artist-2",
"albumArtists": [{ "id": "ar-3", "name": "artist-2" }],
"displayAlbumArtist": "artist-2",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-11",
@@ -587,6 +625,8 @@
"displayArtist": "artist-2",
"albumArtists": [{ "id": "ar-3", "name": "artist-2" }],
"displayAlbumArtist": "artist-2",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-11",
+18
View File
@@ -14,6 +14,8 @@
"displayArtist": "",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"coverArt": "al-3",
"created": "2019-11-30T00:00:00Z",
"isDir": true,
@@ -31,6 +33,8 @@
"displayArtist": "",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"coverArt": "al-4",
"created": "2019-11-30T00:00:00Z",
"isDir": true,
@@ -48,6 +52,8 @@
"displayArtist": "",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"coverArt": "al-5",
"created": "2019-11-30T00:00:00Z",
"isDir": true,
@@ -65,6 +71,8 @@
"displayArtist": "",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"coverArt": "al-7",
"created": "2019-11-30T00:00:00Z",
"isDir": true,
@@ -82,6 +90,8 @@
"displayArtist": "",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"coverArt": "al-8",
"created": "2019-11-30T00:00:00Z",
"isDir": true,
@@ -99,6 +109,8 @@
"displayArtist": "",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"coverArt": "al-9",
"created": "2019-11-30T00:00:00Z",
"isDir": true,
@@ -116,6 +128,8 @@
"displayArtist": "",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"coverArt": "al-11",
"created": "2019-11-30T00:00:00Z",
"isDir": true,
@@ -133,6 +147,8 @@
"displayArtist": "",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"coverArt": "al-12",
"created": "2019-11-30T00:00:00Z",
"isDir": true,
@@ -150,6 +166,8 @@
"displayArtist": "",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"coverArt": "al-13",
"created": "2019-11-30T00:00:00Z",
"isDir": true,
+40
View File
@@ -17,6 +17,8 @@
"displayArtist": "artist-0",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-3",
@@ -45,6 +47,8 @@
"displayArtist": "artist-0",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-3",
@@ -73,6 +77,8 @@
"displayArtist": "artist-0",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-3",
@@ -101,6 +107,8 @@
"displayArtist": "artist-0",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-4",
@@ -129,6 +137,8 @@
"displayArtist": "artist-0",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-4",
@@ -157,6 +167,8 @@
"displayArtist": "artist-0",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-4",
@@ -185,6 +197,8 @@
"displayArtist": "artist-0",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-5",
@@ -213,6 +227,8 @@
"displayArtist": "artist-0",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-5",
@@ -241,6 +257,8 @@
"displayArtist": "artist-0",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-5",
@@ -269,6 +287,8 @@
"displayArtist": "artist-1",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-7",
@@ -297,6 +317,8 @@
"displayArtist": "artist-1",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-7",
@@ -325,6 +347,8 @@
"displayArtist": "artist-1",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-7",
@@ -353,6 +377,8 @@
"displayArtist": "artist-1",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-8",
@@ -381,6 +407,8 @@
"displayArtist": "artist-1",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-8",
@@ -409,6 +437,8 @@
"displayArtist": "artist-1",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-8",
@@ -437,6 +467,8 @@
"displayArtist": "artist-1",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-9",
@@ -465,6 +497,8 @@
"displayArtist": "artist-1",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-9",
@@ -493,6 +527,8 @@
"displayArtist": "artist-1",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-9",
@@ -521,6 +557,8 @@
"displayArtist": "artist-2",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-11",
@@ -549,6 +587,8 @@
"displayArtist": "artist-2",
"albumArtists": null,
"displayAlbumArtist": "",
"contributors": null,
"displayComposer": "",
"bitRate": 100,
"contentType": "audio/flac",
"coverArt": "al-11",
+12 -12
View File
@@ -33,6 +33,15 @@ const (
FallbackGenre = "Unknown Genre"
)
func FirstValues(p Tags, keys ...string) []string {
for _, k := range keys {
if v := normtag.Values(p, k); len(v) > 0 {
return v
}
}
return nil
}
func MustAlbum(p Tags) string {
if r := normtag.Get(p, normtag.Album); r != "" {
return r
@@ -48,10 +57,7 @@ func MustArtist(p Tags) string {
}
func MustArtists(p Tags) []string {
if r := normtag.Values(p, normtag.Artists); len(r) > 0 {
return r
}
if r := normtag.Values(p, normtag.Artist); len(r) > 0 {
if r := FirstValues(p, normtag.Artists, normtag.Artist); len(r) > 0 {
return r
}
return []string{FallbackArtist}
@@ -65,10 +71,7 @@ func MustAlbumArtist(p Tags) string {
}
func MustAlbumArtists(p Tags) []string {
if r := normtag.Values(p, normtag.AlbumArtists); len(r) > 0 {
return r
}
if r := normtag.Values(p, normtag.AlbumArtist); len(r) > 0 {
if r := FirstValues(p, normtag.AlbumArtists, normtag.AlbumArtist); len(r) > 0 {
return r
}
return []string{MustArtist(p)}
@@ -82,10 +85,7 @@ func MustGenre(p Tags) string {
}
func MustGenres(p Tags) []string {
if r := normtag.Values(p, normtag.Genres); len(r) > 0 {
return r
}
if r := normtag.Values(p, normtag.Genre); len(r) > 0 {
if r := FirstValues(p, normtag.Genres, normtag.Genre); len(r) > 0 {
return r
}
return []string{FallbackGenre}