diff --git a/examples/service-availability/main.go b/examples/service-availability/main.go
index 0128d5a..027be8a 100644
--- a/examples/service-availability/main.go
+++ b/examples/service-availability/main.go
@@ -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)
}
}
diff --git a/pkg/client/client.go b/pkg/client/client.go
index ee82e11..66a5485 100644
--- a/pkg/client/client.go
+++ b/pkg/client/client.go
@@ -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)
diff --git a/pkg/client/navigation_examples_test.go b/pkg/client/navigation_examples_test.go
index a8a48c3..180d4f7 100644
--- a/pkg/client/navigation_examples_test.go
+++ b/pkg/client/navigation_examples_test.go
@@ -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 != "" {
diff --git a/pkg/client/navigation_integration_test.go b/pkg/client/navigation_integration_test.go
index 86e3bd8..e9f4b67 100644
--- a/pkg/client/navigation_integration_test.go
+++ b/pkg/client/navigation_integration_test.go
@@ -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, ":")
diff --git a/pkg/client/navigation_test.go b/pkg/client/navigation_test.go
index e4fd485..8e1e853 100644
--- a/pkg/client/navigation_test.go
+++ b/pkg/client/navigation_test.go
@@ -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 {
diff --git a/pkg/client/serviceavailability_integration_test.go b/pkg/client/serviceavailability_integration_test.go
index fcaba92..fe07862 100644
--- a/pkg/client/serviceavailability_integration_test.go
+++ b/pkg/client/serviceavailability_integration_test.go
@@ -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)
}
diff --git a/pkg/models/navigation.go b/pkg/models/navigation.go
index b40438e..00c27b5 100644
--- a/pkg/models/navigation.go
+++ b/pkg/models/navigation.go
@@ -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 ""
}
diff --git a/pkg/models/navigation_test.go b/pkg/models/navigation_test.go
index f3d317a..fc7cc43 100644
--- a/pkg/models/navigation_test.go
+++ b/pkg/models/navigation_test.go
@@ -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, `1`) {
t.Error("XML should contain startItem element")
}
+
if !contains(xmlStr, `1000`) {
t.Error("XML should contain numItems element")
}
+
if !contains(xmlStr, `- `
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 := `/addStation`
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) {
`
var response SearchStationResponse
+
err := xml.Unmarshal([]byte(xmlData), &response)
if err != nil {
t.Fatalf("Failed to unmarshal XML: %v", err)
diff --git a/pkg/models/serviceavailability.go b/pkg/models/serviceavailability.go
index 641f323..c1df534 100644
--- a/pkg/models/serviceavailability.go
+++ b/pkg/models/serviceavailability.go
@@ -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) {
diff --git a/pkg/models/serviceavailability_test.go b/pkg/models/serviceavailability_test.go
index 95d8f8e..185c904 100644
--- a/pkg/models/serviceavailability_test.go
+++ b/pkg/models/serviceavailability_test.go
@@ -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)
})
}
diff --git a/pkg/models/supportedurls.go b/pkg/models/supportedurls.go
index f8f5121..4200b0a 100644
--- a/pkg/models/supportedurls.go
+++ b/pkg/models/supportedurls.go
@@ -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 {