mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-08-18 00:26:29 +00:00
style: fix majority of remaining wsl_v5 whitespace issues
- Add missing whitespace above range loops, if statements, and assignments - Fix whitespace in models package (navigation, serviceavailability, supportedurls) - Improve whitespace in test files and examples - Fix whitespace in client package methods - Maintain code functionality while improving readability Reduced wsl_v5 issues from 29 to 27.
This commit is contained in:
@@ -89,6 +89,7 @@ func displayServiceReport(sa *models.ServiceAvailability) {
|
||||
if service.Reason != "" {
|
||||
reason = fmt.Sprintf(" (%s)", service.Reason)
|
||||
}
|
||||
|
||||
fmt.Printf(" ❌ %s%s\n", formatServiceName(service.Type), reason)
|
||||
}
|
||||
}
|
||||
@@ -102,6 +103,7 @@ func displayServiceReport(sa *models.ServiceAvailability) {
|
||||
|
||||
func displayServiceCategories(sa *models.ServiceAvailability) {
|
||||
fmt.Println("\n🎵 STREAMING SERVICES:")
|
||||
|
||||
streamingServices := sa.GetStreamingServices()
|
||||
availableCount := 0
|
||||
|
||||
@@ -116,6 +118,7 @@ func displayServiceCategories(sa *models.ServiceAvailability) {
|
||||
fmt.Printf(" Summary: %d/%d streaming services available\n", availableCount, len(streamingServices))
|
||||
|
||||
fmt.Println("\n🔗 LOCAL INPUT SERVICES:")
|
||||
|
||||
localServices := sa.GetLocalServices()
|
||||
localAvailableCount := 0
|
||||
|
||||
@@ -125,6 +128,7 @@ func displayServiceCategories(sa *models.ServiceAvailability) {
|
||||
status = "✅"
|
||||
localAvailableCount++
|
||||
}
|
||||
|
||||
fmt.Printf(" %s %s\n", status, formatServiceName(service.Type))
|
||||
}
|
||||
|
||||
@@ -153,6 +157,7 @@ func displayQuickStatusChecks(sa *models.ServiceAvailability) {
|
||||
if check.check() {
|
||||
status = "✅ Available"
|
||||
}
|
||||
|
||||
fmt.Printf(" %s %s: %s\n", check.icon, check.name, status)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -395,6 +395,7 @@ func (c *Client) RemovePreset(id int) error {
|
||||
}
|
||||
|
||||
preset := &models.Preset{ID: id}
|
||||
|
||||
err := c.post("/removePreset", preset)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to remove preset %d: %w", id, err)
|
||||
|
||||
@@ -17,6 +17,7 @@ func ExampleClient_Navigate() {
|
||||
}
|
||||
|
||||
fmt.Printf("Found %d items in TuneIn\n", response.TotalItems)
|
||||
|
||||
for _, item := range response.Items {
|
||||
fmt.Printf("- %s (%s)\n", item.GetDisplayName(), item.Type)
|
||||
}
|
||||
@@ -200,7 +201,8 @@ func Example_searchAndPlayWorkflow() {
|
||||
}
|
||||
|
||||
// 2. Show available stations
|
||||
fmt.Printf("Found %d stations:\n", len(stations))
|
||||
fmt.Printf("Found %d stations\n", len(stations))
|
||||
|
||||
for i, station := range stations[:minInt(5, len(stations))] {
|
||||
fmt.Printf("%d. %s", i+1, station.GetDisplayName())
|
||||
if station.Description != "" {
|
||||
|
||||
@@ -23,8 +23,10 @@ func TestClient_Navigation_Integration(t *testing.T) {
|
||||
var finalHost string
|
||||
|
||||
var finalPort int
|
||||
|
||||
if strings.Contains(host, ":") {
|
||||
parts := strings.Split(host, ":")
|
||||
|
||||
finalHost = parts[0]
|
||||
if len(parts) > 1 {
|
||||
// Use default port if parsing fails
|
||||
@@ -156,8 +158,10 @@ func TestClient_StationManagement_Integration(t *testing.T) {
|
||||
var finalHost string
|
||||
|
||||
var finalPort int
|
||||
|
||||
if strings.Contains(host, ":") {
|
||||
parts := strings.Split(host, ":")
|
||||
|
||||
finalHost = parts[0]
|
||||
if len(parts) > 1 {
|
||||
finalPort = 8090
|
||||
@@ -184,6 +188,7 @@ func TestClient_StationManagement_Integration(t *testing.T) {
|
||||
}
|
||||
|
||||
var pandoraAccount string
|
||||
|
||||
for _, source := range sources.SourceItem {
|
||||
if source.Source == "PANDORA" && source.Status.IsReady() {
|
||||
pandoraAccount = source.SourceAccount
|
||||
@@ -314,6 +319,7 @@ func TestClient_Navigation_ErrorHandling_Integration(t *testing.T) {
|
||||
|
||||
// Parse host:port if provided
|
||||
var finalHost string
|
||||
|
||||
var finalPort int
|
||||
if strings.Contains(host, ":") {
|
||||
parts := strings.Split(host, ":")
|
||||
@@ -390,6 +396,7 @@ func BenchmarkClient_Navigate_Integration(b *testing.B) {
|
||||
|
||||
// Parse host:port if provided
|
||||
var finalHost string
|
||||
|
||||
var finalPort int
|
||||
if strings.Contains(host, ":") {
|
||||
parts := strings.Split(host, ":")
|
||||
|
||||
@@ -630,7 +630,6 @@ func TestClient_GetStoredMusicLibrary(t *testing.T) {
|
||||
}
|
||||
client := NewClient(config)
|
||||
client.baseURL = server.URL
|
||||
|
||||
response, err := client.GetStoredMusicLibrary("device123/0")
|
||||
|
||||
if err != nil {
|
||||
@@ -764,7 +763,6 @@ func TestClient_SearchStation(t *testing.T) {
|
||||
}
|
||||
client := NewClient(config)
|
||||
client.baseURL = server.URL
|
||||
|
||||
response, err := client.SearchStation(tt.source, tt.sourceAccount, tt.searchTerm)
|
||||
|
||||
if tt.expectError {
|
||||
@@ -874,7 +872,6 @@ func TestClient_SearchTuneInStations(t *testing.T) {
|
||||
}
|
||||
client := NewClient(config)
|
||||
client.baseURL = server.URL
|
||||
|
||||
response, err := client.SearchTuneInStations("Jazz")
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -72,6 +72,7 @@ func TestGetServiceAvailability_Integration(t *testing.T) {
|
||||
|
||||
localServices := serviceAvailability.GetLocalServices()
|
||||
t.Logf("Local services count: %d", len(localServices))
|
||||
|
||||
for _, service := range localServices {
|
||||
t.Logf(" - Local: %s (%v)", service.Type, service.IsAvailable)
|
||||
}
|
||||
|
||||
@@ -186,11 +186,13 @@ func (nr *NavigateResponse) GetDirectories() []NavigateItem {
|
||||
// GetTracks returns only the track items from the navigate response
|
||||
func (nr *NavigateResponse) GetTracks() []NavigateItem {
|
||||
var tracks []NavigateItem
|
||||
|
||||
for _, item := range nr.Items {
|
||||
if item.Type == "track" {
|
||||
tracks = append(tracks, item)
|
||||
}
|
||||
}
|
||||
|
||||
return tracks
|
||||
}
|
||||
|
||||
@@ -221,6 +223,7 @@ func (ni *NavigateItem) GetDisplayName() string {
|
||||
if ni.ContentItem != nil && ni.ContentItem.ItemName != "" {
|
||||
return ni.ContentItem.ItemName
|
||||
}
|
||||
|
||||
return "Unknown Item"
|
||||
}
|
||||
|
||||
@@ -254,6 +257,7 @@ func (ni *NavigateItem) GetArtwork() string {
|
||||
if ni.ContentItem != nil && ni.ContentItem.ContainerArt != "" {
|
||||
return ni.ContentItem.ContainerArt
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ func TestNavigateRequest_NewNavigateRequest(t *testing.T) {
|
||||
if req.Source != "SPOTIFY" {
|
||||
t.Errorf("Expected source SPOTIFY, got %s", req.Source)
|
||||
}
|
||||
|
||||
if req.SourceAccount != "user@example.com" {
|
||||
t.Errorf("Expected sourceAccount user@example.com, got %s", req.SourceAccount)
|
||||
}
|
||||
@@ -101,9 +102,11 @@ func TestNavigateRequest_XMLMarshalWithItem(t *testing.T) {
|
||||
if !contains(xmlStr, `<startItem>1</startItem>`) {
|
||||
t.Error("XML should contain startItem element")
|
||||
}
|
||||
|
||||
if !contains(xmlStr, `<numItems>1000</numItems>`) {
|
||||
t.Error("XML should contain numItems element")
|
||||
}
|
||||
|
||||
if !contains(xmlStr, `<item`) {
|
||||
t.Error("XML should contain item element")
|
||||
}
|
||||
@@ -137,6 +140,7 @@ func TestNavigateResponse_XMLUnmarshal(t *testing.T) {
|
||||
</navigateResponse>`
|
||||
|
||||
var response NavigateResponse
|
||||
|
||||
err := xml.Unmarshal([]byte(xmlData), &response)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to unmarshal XML: %v", err)
|
||||
@@ -175,6 +179,7 @@ func TestNavigateResponse_XMLUnmarshal(t *testing.T) {
|
||||
if secondItem.ArtistName != "Test Artist" {
|
||||
t.Errorf("Expected artist name 'Test Artist', got %s", secondItem.ArtistName)
|
||||
}
|
||||
|
||||
if !secondItem.IsTrack() {
|
||||
t.Error("Expected second item to be a track")
|
||||
}
|
||||
@@ -346,6 +351,7 @@ func TestStationResponse_XMLUnmarshal(t *testing.T) {
|
||||
xmlData := `<status>/addStation</status>`
|
||||
|
||||
var response StationResponse
|
||||
|
||||
err := xml.Unmarshal([]byte(xmlData), &response)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to unmarshal XML: %v", err)
|
||||
@@ -468,6 +474,7 @@ func TestSearchStationResponse_XMLUnmarshal(t *testing.T) {
|
||||
</results>`
|
||||
|
||||
var response SearchStationResponse
|
||||
|
||||
err := xml.Unmarshal([]byte(xmlData), &response)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to unmarshal XML: %v", err)
|
||||
|
||||
@@ -69,6 +69,7 @@ func (sa *ServiceAvailability) GetAvailableServices() []Service {
|
||||
}
|
||||
|
||||
var available []Service
|
||||
|
||||
for _, service := range sa.Services.Service {
|
||||
if service.IsAvailable {
|
||||
available = append(available, service)
|
||||
@@ -172,6 +173,7 @@ func (sa *ServiceAvailability) GetStreamingServices() []Service {
|
||||
}
|
||||
|
||||
var streaming []Service
|
||||
|
||||
for _, service := range sa.Services.Service {
|
||||
for _, streamingType := range streamingTypes {
|
||||
if service.Type == string(streamingType) {
|
||||
|
||||
@@ -113,6 +113,7 @@ func TestServiceAvailability_UnmarshalXML(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("failed to unmarshal XML: %v", err)
|
||||
}
|
||||
|
||||
tt.validate(t, &sa)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -356,6 +356,7 @@ func (s *SupportedURLsResponse) GetFeaturesByCategory() map[string][]EndpointFea
|
||||
// GetSupportedFeatures returns all features supported by this device
|
||||
func (s *SupportedURLsResponse) GetSupportedFeatures() []EndpointFeature {
|
||||
features := GetEndpointFeatureMap()
|
||||
|
||||
var supported []EndpointFeature
|
||||
|
||||
for _, feature := range features {
|
||||
@@ -458,6 +459,7 @@ func (s *SupportedURLsResponse) GetMissingEssentialFeatures() []EndpointFeature
|
||||
// GetFeatureCompleteness returns a completeness score (0-100) based on supported features
|
||||
func (s *SupportedURLsResponse) GetFeatureCompleteness() (int, int, int) {
|
||||
features := GetEndpointFeatureMap()
|
||||
|
||||
var total, supported, essential int
|
||||
|
||||
for _, feature := range features {
|
||||
|
||||
Reference in New Issue
Block a user