Skip to content

🎧 Your Personal Streaming Service

Add OpenSubsonic channelCount

Deluanf7fc17c0f7d2
diff --git a/server/subsonic/helpers.go b/server/subsonic/helpers.go
index 517416d5b..189c07d47 100644
--- a/server/subsonic/helpers.go
+++ b/server/subsonic/helpers.go
@@ -183,6 +183,7 @@ func childFromMediaFile(ctx context.Context, mf model.MediaFile) responses.Child
TrackPeak: mf.RgTrackPeak,
AlbumPeak: mf.RgAlbumPeak,
}
+ child.ChannelCount = int32(mf.Channels)
return child
}
diff --git a/server/subsonic/responses/.snapshots/Responses AlbumList with data should match .JSON b/server/subsonic/responses/.snapshots/Responses AlbumList with data should match .JSON
index 2d3bc3b7c..6a2e1839a 100644
--- a/server/subsonic/responses/.snapshots/Responses AlbumList with data should match .JSON
+++ b/server/subsonic/responses/.snapshots/Responses AlbumList with data should match .JSON
@@ -17,7 +17,8 @@
"mediaType": "",
"musicBrainzId": "",
"genres": [],
- "replayGain": {}
+ "replayGain": {},
+ "channelCount": 0
}
]
}
diff --git a/server/subsonic/responses/.snapshots/Responses AlbumList with data should match .XML b/server/subsonic/responses/.snapshots/Responses AlbumList with data should match .XML
index 8787b4239..bc453309e 100644
--- a/server/subsonic/responses/.snapshots/Responses AlbumList with data should match .XML
+++ b/server/subsonic/responses/.snapshots/Responses AlbumList with data should match .XML
@@ -1,6 +1,6 @@
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true">
<albumList>
- <album id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="">
+ <album id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0">
<replayGain></replayGain>
</album>
</albumList>
diff --git a/server/subsonic/responses/.snapshots/Responses AlbumWithSongsID3 with data should match .JSON b/server/subsonic/responses/.snapshots/Responses AlbumWithSongsID3 with data should match .JSON
index c5f1ea141..3c4ade733 100644
--- a/server/subsonic/responses/.snapshots/Responses AlbumWithSongsID3 with data should match .JSON
+++ b/server/subsonic/responses/.snapshots/Responses AlbumWithSongsID3 with data should match .JSON
@@ -85,7 +85,8 @@
"albumPeak": 4,
"baseGain": 5,
"fallbackGain": 6
- }
+ },
+ "channelCount": 0
}
]
}
diff --git a/server/subsonic/responses/.snapshots/Responses AlbumWithSongsID3 with data should match .XML b/server/subsonic/responses/.snapshots/Responses AlbumWithSongsID3 with data should match .XML
index f7bcf1f13..6ef1897f7 100644
--- a/server/subsonic/responses/.snapshots/Responses AlbumWithSongsID3 with data should match .XML
+++ b/server/subsonic/responses/.snapshots/Responses AlbumWithSongsID3 with data should match .XML
@@ -7,7 +7,7 @@
<discTitles disc="3" title=""></discTitles>
<originalReleaseDate year="1994" month="2" day="4"></originalReleaseDate>
<releaseDate year="2000" month="5" day="10"></releaseDate>
- <song id="1" isDir="true" title="title" album="album" artist="artist" track="1" year="1985" genre="Rock" coverArt="1" size="8421341" contentType="audio/flac" suffix="flac" starred="2016-03-02T20:30:00Z" transcodedContentType="audio/mpeg" transcodedSuffix="mp3" duration="146" bitRate="320" isVideo="false" bpm="127" comment="a comment" sortName="sorted song" mediaType="song" musicBrainzId="4321">
+ <song id="1" isDir="true" title="title" album="album" artist="artist" track="1" year="1985" genre="Rock" coverArt="1" size="8421341" contentType="audio/flac" suffix="flac" starred="2016-03-02T20:30:00Z" transcodedContentType="audio/mpeg" transcodedSuffix="mp3" duration="146" bitRate="320" isVideo="false" bpm="127" comment="a comment" sortName="sorted song" mediaType="song" musicBrainzId="4321" channelCount="0">
<genres name="rock"></genres>
<genres name="progressive"></genres>
<replayGain trackGain="1" albumGain="2" trackPeak="3" albumPeak="4" baseGain="5" fallbackGain="6"></replayGain>
diff --git a/server/subsonic/responses/.snapshots/Responses Bookmarks with data should match .JSON b/server/subsonic/responses/.snapshots/Responses Bookmarks with data should match .JSON
index 3edf0cfd5..18ddd2ad0 100644
--- a/server/subsonic/responses/.snapshots/Responses Bookmarks with data should match .JSON
+++ b/server/subsonic/responses/.snapshots/Responses Bookmarks with data should match .JSON
@@ -18,7 +18,8 @@
"mediaType": "",
"musicBrainzId": "",
"genres": [],
- "replayGain": {}
+ "replayGain": {},
+ "channelCount": 0
},
"position": 123,
"username": "user2",
diff --git a/server/subsonic/responses/.snapshots/Responses Bookmarks with data should match .XML b/server/subsonic/responses/.snapshots/Responses Bookmarks with data should match .XML
index db7c67102..289d47a71 100644
--- a/server/subsonic/responses/.snapshots/Responses Bookmarks with data should match .XML
+++ b/server/subsonic/responses/.snapshots/Responses Bookmarks with data should match .XML
@@ -1,7 +1,7 @@
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true">
<bookmarks>
<bookmark position="123" username="user2" comment="a comment" created="0001-01-01T00:00:00Z" changed="0001-01-01T00:00:00Z">
- <entry id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="">
+ <entry id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0">
<replayGain></replayGain>
</entry>
</bookmark>
diff --git a/server/subsonic/responses/.snapshots/Responses Child with data should match .JSON b/server/subsonic/responses/.snapshots/Responses Child with data should match .JSON
index 8abef4a64..3b9727837 100644
--- a/server/subsonic/responses/.snapshots/Responses Child with data should match .JSON
+++ b/server/subsonic/responses/.snapshots/Responses Child with data should match .JSON
@@ -45,7 +45,8 @@
"albumPeak": 4,
"baseGain": 5,
"fallbackGain": 6
- }
+ },
+ "channelCount": 2
}
],
"id": "1",
diff --git a/server/subsonic/responses/.snapshots/Responses Child with data should match .XML b/server/subsonic/responses/.snapshots/Responses Child with data should match .XML
index fe858081f..dce540063 100644
--- a/server/subsonic/responses/.snapshots/Responses Child with data should match .XML
+++ b/server/subsonic/responses/.snapshots/Responses Child with data should match .XML
@@ -1,6 +1,6 @@
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true">
<directory id="1" name="N">
- <child id="1" isDir="true" title="title" album="album" artist="artist" track="1" year="1985" genre="Rock" coverArt="1" size="8421341" contentType="audio/flac" suffix="flac" starred="2016-03-02T20:30:00Z" transcodedContentType="audio/mpeg" transcodedSuffix="mp3" duration="146" bitRate="320" isVideo="false" bpm="127" comment="a comment" sortName="" mediaType="song" musicBrainzId="4321">
+ <child id="1" isDir="true" title="title" album="album" artist="artist" track="1" year="1985" genre="Rock" coverArt="1" size="8421341" contentType="audio/flac" suffix="flac" starred="2016-03-02T20:30:00Z" transcodedContentType="audio/mpeg" transcodedSuffix="mp3" duration="146" bitRate="320" isVideo="false" bpm="127" comment="a comment" sortName="" mediaType="song" musicBrainzId="4321" channelCount="2">
<genres name="rock"></genres>
<genres name="progressive"></genres>
<replayGain trackGain="1" albumGain="2" trackPeak="3" albumPeak="4" baseGain="5" fallbackGain="6"></replayGain>
diff --git a/server/subsonic/responses/.snapshots/Responses Child without data should match .JSON b/server/subsonic/responses/.snapshots/Responses Child without data should match .JSON
index 57cf62d39..7b77a24ce 100644
--- a/server/subsonic/responses/.snapshots/Responses Child without data should match .JSON
+++ b/server/subsonic/responses/.snapshots/Responses Child without data should match .JSON
@@ -16,7 +16,8 @@
"mediaType": "",
"musicBrainzId": "",
"genres": [],
- "replayGain": {}
+ "replayGain": {},
+ "channelCount": 0
}
],
"id": "",
diff --git a/server/subsonic/responses/.snapshots/Responses Child without data should match .XML b/server/subsonic/responses/.snapshots/Responses Child without data should match .XML
index aa1636899..fa5f3b1dc 100644
--- a/server/subsonic/responses/.snapshots/Responses Child without data should match .XML
+++ b/server/subsonic/responses/.snapshots/Responses Child without data should match .XML
@@ -1,6 +1,6 @@
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true">
<directory id="" name="">
- <child id="1" isDir="false" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="">
+ <child id="1" isDir="false" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0">
<replayGain></replayGain>
</child>
</directory>
diff --git a/server/subsonic/responses/.snapshots/Responses Directory with data should match .JSON b/server/subsonic/responses/.snapshots/Responses Directory with data should match .JSON
index 6d16805c6..cdd600751 100644
--- a/server/subsonic/responses/.snapshots/Responses Directory with data should match .JSON
+++ b/server/subsonic/responses/.snapshots/Responses Directory with data should match .JSON
@@ -17,7 +17,8 @@
"mediaType": "",
"musicBrainzId": "",
"genres": [],
- "replayGain": {}
+ "replayGain": {},
+ "channelCount": 0
}
],
"id": "1",
diff --git a/server/subsonic/responses/.snapshots/Responses Directory with data should match .XML b/server/subsonic/responses/.snapshots/Responses Directory with data should match .XML
index 11c9b381a..79bdca646 100644
--- a/server/subsonic/responses/.snapshots/Responses Directory with data should match .XML
+++ b/server/subsonic/responses/.snapshots/Responses Directory with data should match .XML
@@ -1,6 +1,6 @@
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true">
<directory id="1" name="N">
- <child id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="">
+ <child id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0">
<replayGain></replayGain>
</child>
</directory>
diff --git a/server/subsonic/responses/.snapshots/Responses PlayQueue with data should match .JSON b/server/subsonic/responses/.snapshots/Responses PlayQueue with data should match .JSON
index 42ea7de59..05c1761bf 100644
--- a/server/subsonic/responses/.snapshots/Responses PlayQueue with data should match .JSON
+++ b/server/subsonic/responses/.snapshots/Responses PlayQueue with data should match .JSON
@@ -17,7 +17,8 @@
"mediaType": "",
"musicBrainzId": "",
"genres": [],
- "replayGain": {}
+ "replayGain": {},
+ "channelCount": 0
}
],
"current": "111",
diff --git a/server/subsonic/responses/.snapshots/Responses PlayQueue with data should match .XML b/server/subsonic/responses/.snapshots/Responses PlayQueue with data should match .XML
index c37f61698..6120b859d 100644
--- a/server/subsonic/responses/.snapshots/Responses PlayQueue with data should match .XML
+++ b/server/subsonic/responses/.snapshots/Responses PlayQueue with data should match .XML
@@ -1,6 +1,6 @@
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true">
<playQueue current="111" position="243" username="user1" changed="0001-01-01T00:00:00Z" changedBy="a_client">
- <entry id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="">
+ <entry id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0">
<replayGain></replayGain>
</entry>
</playQueue>
diff --git a/server/subsonic/responses/.snapshots/Responses Shares with data should match .JSON b/server/subsonic/responses/.snapshots/Responses Shares with data should match .JSON
index 34af86c26..71c154f29 100644
--- a/server/subsonic/responses/.snapshots/Responses Shares with data should match .JSON
+++ b/server/subsonic/responses/.snapshots/Responses Shares with data should match .JSON
@@ -22,7 +22,8 @@
"mediaType": "",
"musicBrainzId": "",
"genres": [],
- "replayGain": {}
+ "replayGain": {},
+ "channelCount": 0
},
{
"id": "2",
@@ -38,7 +39,8 @@
"mediaType": "",
"musicBrainzId": "",
"genres": [],
- "replayGain": {}
+ "replayGain": {},
+ "channelCount": 0
}
],
"id": "ABC123",
diff --git a/server/subsonic/responses/.snapshots/Responses Shares with data should match .XML b/server/subsonic/responses/.snapshots/Responses Shares with data should match .XML
index d8863b6d8..527aa486d 100644
--- a/server/subsonic/responses/.snapshots/Responses Shares with data should match .XML
+++ b/server/subsonic/responses/.snapshots/Responses Shares with data should match .XML
@@ -1,10 +1,10 @@
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true">
<shares>
<share id="ABC123" url="http://localhost/p/ABC123" description="Check it out!" username="deluan" created="0001-01-01T00:00:00Z" expires="0001-01-01T00:00:00Z" lastVisited="0001-01-01T00:00:00Z" visitCount="2">
- <entry id="1" isDir="false" title="title" album="album" artist="artist" duration="120" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="">
+ <entry id="1" isDir="false" title="title" album="album" artist="artist" duration="120" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0">
<replayGain></replayGain>
</entry>
- <entry id="2" isDir="false" title="title 2" album="album" artist="artist" duration="300" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="">
+ <entry id="2" isDir="false" title="title 2" album="album" artist="artist" duration="300" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0">
<replayGain></replayGain>
</entry>
</share>
diff --git a/server/subsonic/responses/.snapshots/Responses SimilarSongs with data should match .JSON b/server/subsonic/responses/.snapshots/Responses SimilarSongs with data should match .JSON
index 7a42f091c..e743905bc 100644
--- a/server/subsonic/responses/.snapshots/Responses SimilarSongs with data should match .JSON
+++ b/server/subsonic/responses/.snapshots/Responses SimilarSongs with data should match .JSON
@@ -17,7 +17,8 @@
"mediaType": "",
"musicBrainzId": "",
"genres": [],
- "replayGain": {}
+ "replayGain": {},
+ "channelCount": 0
}
]
}
diff --git a/server/subsonic/responses/.snapshots/Responses SimilarSongs with data should match .XML b/server/subsonic/responses/.snapshots/Responses SimilarSongs with data should match .XML
index 78c41a770..2bf633e4a 100644
--- a/server/subsonic/responses/.snapshots/Responses SimilarSongs with data should match .XML
+++ b/server/subsonic/responses/.snapshots/Responses SimilarSongs with data should match .XML
@@ -1,6 +1,6 @@
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true">
<similarSongs>
- <song id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="">
+ <song id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0">
<replayGain></replayGain>
</song>
</similarSongs>
diff --git a/server/subsonic/responses/.snapshots/Responses SimilarSongs2 with data should match .JSON b/server/subsonic/responses/.snapshots/Responses SimilarSongs2 with data should match .JSON
index 74b6c2323..ac1659f6c 100644
--- a/server/subsonic/responses/.snapshots/Responses SimilarSongs2 with data should match .JSON
+++ b/server/subsonic/responses/.snapshots/Responses SimilarSongs2 with data should match .JSON
@@ -17,7 +17,8 @@
"mediaType": "",
"musicBrainzId": "",
"genres": [],
- "replayGain": {}
+ "replayGain": {},
+ "channelCount": 0
}
]
}
diff --git a/server/subsonic/responses/.snapshots/Responses SimilarSongs2 with data should match .XML b/server/subsonic/responses/.snapshots/Responses SimilarSongs2 with data should match .XML
index bf98df70b..683a4626e 100644
--- a/server/subsonic/responses/.snapshots/Responses SimilarSongs2 with data should match .XML
+++ b/server/subsonic/responses/.snapshots/Responses SimilarSongs2 with data should match .XML
@@ -1,6 +1,6 @@
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true">
<similarSongs2>
- <song id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="">
+ <song id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0">
<replayGain></replayGain>
</song>
</similarSongs2>
diff --git a/server/subsonic/responses/.snapshots/Responses TopSongs with data should match .JSON b/server/subsonic/responses/.snapshots/Responses TopSongs with data should match .JSON
index 226b4ab13..c9038e132 100644
--- a/server/subsonic/responses/.snapshots/Responses TopSongs with data should match .JSON
+++ b/server/subsonic/responses/.snapshots/Responses TopSongs with data should match .JSON
@@ -17,7 +17,8 @@
"mediaType": "",
"musicBrainzId": "",
"genres": [],
- "replayGain": {}
+ "replayGain": {},
+ "channelCount": 0
}
]
}
diff --git a/server/subsonic/responses/.snapshots/Responses TopSongs with data should match .XML b/server/subsonic/responses/.snapshots/Responses TopSongs with data should match .XML
index 3a5977984..bbd2d5b45 100644
--- a/server/subsonic/responses/.snapshots/Responses TopSongs with data should match .XML
+++ b/server/subsonic/responses/.snapshots/Responses TopSongs with data should match .XML
@@ -1,6 +1,6 @@
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true">
<topSongs>
- <song id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="">
+ <song id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0">
<replayGain></replayGain>
</song>
</topSongs>
diff --git a/server/subsonic/responses/responses.go b/server/subsonic/responses/responses.go
index 3e6267c31..9e5587fbe 100644
--- a/server/subsonic/responses/responses.go
+++ b/server/subsonic/responses/responses.go
@@ -163,6 +163,7 @@ type Child struct {
MusicBrainzId string `xml:"musicBrainzId,attr" json:"musicBrainzId"`
Genres ItemGenres `xml:"genres" json:"genres"`
ReplayGain ReplayGain `xml:"replayGain" json:"replayGain"`
+ ChannelCount int32 `xml:"channelCount,attr" json:"channelCount"`
}
type Songs struct {
diff --git a/server/subsonic/responses/responses_test.go b/server/subsonic/responses/responses_test.go
index b4af4a0ec..cdc614090 100644
--- a/server/subsonic/responses/responses_test.go
+++ b/server/subsonic/responses/responses_test.go
@@ -142,7 +142,7 @@ var _ = Describe("Responses", func() {
Year: 1985, Genre: "Rock", CoverArt: "1", Size: 8421341, ContentType: "audio/flac",
Suffix: "flac", TranscodedContentType: "audio/mpeg", TranscodedSuffix: "mp3",
Duration: 146, BitRate: 320, Starred: &t, Genres: []ItemGenre{{Name: "rock"}, {Name: "progressive"}},
- Comment: "a comment", Bpm: 127, MediaType: MediaTypeSong, MusicBrainzId: "4321",
+ Comment: "a comment", Bpm: 127, MediaType: MediaTypeSong, MusicBrainzId: "4321", ChannelCount: 2,
ReplayGain: ReplayGain{TrackGain: 1, AlbumGain: 2, TrackPeak: 3, AlbumPeak: 4, BaseGain: 5, FallbackGain: 6},
}
response.Directory.Child = child