From 2f563c3406191c3ee9f6c6a364c2c8aaa6c974f2 Mon Sep 17 00:00:00 2001 From: Duncan Overbruck Date: Mon, 2 Mar 2020 18:31:15 +0100 Subject: [PATCH 1/3] spec: add IgnoredArticles attribute to Index responses This attribute is required as per spec and keeping it empty, complies the spec as long as articles are not ignored while indexing. In the future, this could maybe be a user setting that could be supported. With this change, the aurial client works now. * https://shrimpza.github.io/aurial/ * https://github.com/shrimpza/aurial --- server/ctrlsubsonic/spec/spec.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/ctrlsubsonic/spec/spec.go b/server/ctrlsubsonic/spec/spec.go index cdd8bfe..9f979ef 100644 --- a/server/ctrlsubsonic/spec/spec.go +++ b/server/ctrlsubsonic/spec/spec.go @@ -134,7 +134,8 @@ type TrackChild struct { } type Artists struct { - List []*Index `xml:"index" json:"index"` + IgnoredArticles string `xml:"ignoredArticles,attr" json:"ignoredArticles"` + List []*Index `xml:"index" json:"index"` } type Artist struct { @@ -146,8 +147,9 @@ type Artist struct { } type Indexes struct { - LastModified int `xml:"lastModified,attr,omitempty" json:"lastModified"` - Index []*Index `xml:"index" json:"index"` + LastModified int `xml:"lastModified,attr,omitempty" json:"lastModified"` + IgnoredArticles string `xml:"ignoredArticles,attr" json:"ignoredArticles"` + Index []*Index `xml:"index" json:"index"` } type Index struct { From 754bc74bc764f923d1f7c10e505694d32eef53a4 Mon Sep 17 00:00:00 2001 From: sentriz Date: Tue, 3 Mar 2020 12:30:26 +0000 Subject: [PATCH 2/3] bump to v0.7.5 --- server/ctrlsubsonic/testdata/db | Bin 143360 -> 143360 bytes .../testdata/test_get_album_list_alpha_artist | 2 +- .../testdata/test_get_album_list_alpha_name | 2 +- .../testdata/test_get_album_list_newest | 2 +- .../testdata/test_get_album_list_random | 154 +++++++++--------- .../test_get_album_list_two_alpha_artist | 2 +- .../test_get_album_list_two_alpha_name | 2 +- .../testdata/test_get_album_list_two_newest | 2 +- .../testdata/test_get_album_list_two_random | 140 ++++++++-------- .../testdata/test_get_album_with_cover | 2 +- .../testdata/test_get_album_without_cover | 2 +- .../testdata/test_get_artist_id_one | 2 +- .../testdata/test_get_artist_id_three | 2 +- .../testdata/test_get_artist_id_two | 2 +- .../testdata/test_get_artists_no_args | 3 +- .../testdata/test_get_indexes_no_args | 3 +- .../test_get_music_directory_with_tracks | 2 +- .../test_get_music_directory_without_tracks | 2 +- .../testdata/test_search_three_q_13 | 2 +- .../testdata/test_search_three_q_ani | 2 +- .../testdata/test_search_three_q_cert | 2 +- .../testdata/test_search_two_q_13 | 2 +- .../testdata/test_search_two_q_ani | 2 +- .../testdata/test_search_two_q_cert | 2 +- version/version.go | 4 +- 25 files changed, 172 insertions(+), 170 deletions(-) diff --git a/server/ctrlsubsonic/testdata/db b/server/ctrlsubsonic/testdata/db index 8e27e2288411e216849f06e80a0d915eb614be14..539b17a777729cb8cb593fc7da5aa3c452088dd9 100644 GIT binary patch delta 25 gcmZp8z|ru4V}dke-$WT_#=gdc)&$0_2}}$00e>P1Hvj+t delta 25 gcmZp8z|ru4V}dke&qNt##-7H6)&$0_2}}$00e Date: Tue, 3 Mar 2020 15:08:35 +0000 Subject: [PATCH 3/3] scrobble with brainz trackid, not album id --- db/model.go | 1 + scanner/scanner.go | 1 + scanner/tags/tags.go | 1 + server/lastfm/lastfm.go | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/db/model.go b/db/model.go index 9690b4b..3ca1463 100644 --- a/db/model.go +++ b/db/model.go @@ -67,6 +67,7 @@ type Track struct { TagTrackArtist string `sql:"default: null"` TagTrackNumber int `sql:"default: null"` TagDiscNumber int `sql:"default: null"` + TagBrainzID string `sql:"default: null"` } func (t *Track) Ext() string { diff --git a/scanner/scanner.go b/scanner/scanner.go index 3bacbbf..b5bec06 100644 --- a/scanner/scanner.go +++ b/scanner/scanner.go @@ -336,6 +336,7 @@ func (s *Scanner) handleTrack(it *item) error { track.TagTrackArtist = trTags.Artist() track.TagTrackNumber = trTags.TrackNumber() track.TagDiscNumber = trTags.DiscNumber() + track.TagBrainzID = trTags.BrainzID() track.Length = trTags.Length() // these two should be calculated track.Bitrate = trTags.Bitrate() // ...from the file instead of tags // diff --git a/scanner/tags/tags.go b/scanner/tags/tags.go index 437f38b..04059fb 100644 --- a/scanner/tags/tags.go +++ b/scanner/tags/tags.go @@ -34,6 +34,7 @@ func (t *Tags) firstTag(keys ...string) string { } func (t *Tags) Title() string { return t.firstTag("title") } +func (t *Tags) BrainzID() string { return t.firstTag("musicbrainz_trackid") } func (t *Tags) Artist() string { return t.firstTag("artist") } func (t *Tags) Album() string { return t.firstTag("album") } func (t *Tags) AlbumArtist() string { return t.firstTag("albumartist", "album artist") } diff --git a/server/lastfm/lastfm.go b/server/lastfm/lastfm.go index a996ba8..ce44923 100644 --- a/server/lastfm/lastfm.go +++ b/server/lastfm/lastfm.go @@ -95,7 +95,7 @@ func Scrobble(apiKey, secret, session string, opts ScrobbleOpts) error { params.Add("track", opts.Track.TagTitle) params.Add("trackNumber", strconv.Itoa(opts.Track.TagTrackNumber)) params.Add("album", opts.Track.Album.TagTitle) - params.Add("mbid", opts.Track.Album.TagBrainzID) + params.Add("mbid", opts.Track.TagBrainzID) params.Add("albumArtist", opts.Track.Artist.Name) params.Add("api_sig", getParamSignature(params, secret)) _, err := makeRequest("POST", params)