diff --git a/BassBoom.Basolia/Radio/RadioTools.cs b/BassBoom.Basolia/Radio/RadioTools.cs index b28d9e0..c901b85 100644 --- a/BassBoom.Basolia/Radio/RadioTools.cs +++ b/BassBoom.Basolia/Radio/RadioTools.cs @@ -114,7 +114,7 @@ public static bool IsRadio(string radioUrl, out string streamType) { // Check to see if we provided a path if (string.IsNullOrEmpty(radioUrl)) - throw new BasoliaMiscException("Provide a path to a radio station"); + return ("", false); var uri = new Uri(radioUrl); // Check to see if the radio station exists @@ -124,11 +124,11 @@ public static bool IsRadio(string radioUrl, out string streamType) var reply = await client.GetAsync(radioUrl, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false); client.DefaultRequestHeaders.Remove("Icy-MetaData"); if (!reply.IsSuccessStatusCode) - throw new BasoliaMiscException($"This radio station doesn't exist. Error code: {(int)reply.StatusCode} ({reply.StatusCode})."); + return ("", false); // Check for radio statio and get the MIME type if (!reply.Headers.Any((kvp) => kvp.Key.StartsWith("icy-"))) - throw new BasoliaMiscException("This doesn't look like a radio station. Are you sure?"); + return ("", false); var contentType = reply.Content.Headers.ContentType; string streamType = contentType.MediaType;