Skip to content

Commit

Permalink
imp - Better compatibility for some Icecast server...
Browse files Browse the repository at this point in the history
...s

---

We've extended compatibility for some Icecast servers.

This is done by fixing two issues: checking for icy- variables when querying radio info when none is necessary for Shoutcast, and checking if the Server variable is just "Icecast".

---

Type: imp
Breaking: False
Doc Required: False
Backport Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Jun 29, 2024
1 parent 489fccf commit c76c004
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions BassBoom.Basolia/Radio/RadioTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,10 @@ public static async Task<IRadioServer> GetRadioInfoAsync(string radioUrl)
client.DefaultRequestHeaders.Remove("Icy-MetaData");
if (!reply.IsSuccessStatusCode)
throw new BasoliaMiscException($"This radio station doesn't exist. Error code: {(int)reply.StatusCode} ({reply.StatusCode}).");

// Check to see if there are any ICY headers
if (!reply.Headers.Any((kvp) => kvp.Key.StartsWith("icy-")))
throw new BasoliaMiscException("This doesn't look like a radio station. Are you sure?");

// Now, check the server type
RadioServerType type = RadioServerType.Unknown;
if (reply.Headers.Server.ToString().Equals("icecast", StringComparison.OrdinalIgnoreCase))
if (reply.Headers.Server.ToString().ToLower().Contains("icecast"))
type = RadioServerType.Icecast;
else if (reply.Headers.Contains("icy-notice2") && reply.Headers.GetValues("icy-notice2").First().ToLower().Contains("shoutcast"))
type = RadioServerType.Shoutcast;
Expand Down

0 comments on commit c76c004

Please sign in to comment.