diff --git a/src/App/Modules/ShareMusicCommandModule/commands/HandleFindAlbumAsync.cs b/src/App/Modules/ShareMusicCommandModule/commands/HandleFindAlbumAsync.cs index 3fdcb319..bc509fa0 100644 --- a/src/App/Modules/ShareMusicCommandModule/commands/HandleFindAlbumAsync.cs +++ b/src/App/Modules/ShareMusicCommandModule/commands/HandleFindAlbumAsync.cs @@ -152,7 +152,14 @@ await FollowupAsync( } catch { - var streamingEntityWithThumbnailUrl = musicEntityItem.EntitiesByUniqueId!.FirstOrDefault(entity => entity.Value.ThumbnailUrl is not null).Value.ApiProvider; + /* + Temporary fix: + + Amazon is being excluded from the fallback for the time being, + because the "apiProvider" value doesn't cleanly match it's platform + entity link key. + */ + var streamingEntityWithThumbnailUrl = musicEntityItem.EntitiesByUniqueId!.FirstOrDefault(entity => entity.Value.ThumbnailUrl is not null && entity.Value.ApiProvider != "amazon").Value.ApiProvider; if (!string.IsNullOrEmpty(streamingEntityWithThumbnailUrl)) { diff --git a/src/App/Modules/ShareMusicCommandModule/commands/HandleFindSongAsync.cs b/src/App/Modules/ShareMusicCommandModule/commands/HandleFindSongAsync.cs index fc2e6930..2827aa10 100644 --- a/src/App/Modules/ShareMusicCommandModule/commands/HandleFindSongAsync.cs +++ b/src/App/Modules/ShareMusicCommandModule/commands/HandleFindSongAsync.cs @@ -155,7 +155,14 @@ await FollowupAsync( } catch { - var streamingEntityWithThumbnailUrl = musicEntityItem.EntitiesByUniqueId!.FirstOrDefault(entity => entity.Value.ThumbnailUrl is not null).Value.ApiProvider; + /* + Temporary fix: + + Amazon is being excluded from the fallback for the time being, + because the "apiProvider" value doesn't cleanly match it's platform + entity link key. + */ + var streamingEntityWithThumbnailUrl = musicEntityItem.EntitiesByUniqueId!.FirstOrDefault(entity => entity.Value.ThumbnailUrl is not null && entity.Value.ApiProvider != "amazon").Value.ApiProvider; if (!string.IsNullOrEmpty(streamingEntityWithThumbnailUrl)) { diff --git a/src/App/Modules/ShareMusicCommandModule/commands/HandleGetLinksFromPostAsync.cs b/src/App/Modules/ShareMusicCommandModule/commands/HandleGetLinksFromPostAsync.cs index f5596373..975afd62 100644 --- a/src/App/Modules/ShareMusicCommandModule/commands/HandleGetLinksFromPostAsync.cs +++ b/src/App/Modules/ShareMusicCommandModule/commands/HandleGetLinksFromPostAsync.cs @@ -35,7 +35,7 @@ private async Task HandleGetLinksFromPostAsync(IMessage message) { "channel_Name", Context.Channel.Name } } ); - + try { Regex linkRegex = new(@"(?'musicLink'(?>https|http):\/\/(?>[A-Za-z0-9\.]+)(?>\/\S*[^\.\s]|))(?> |)", RegexOptions.Multiline); @@ -89,7 +89,14 @@ await FollowupAsync( } catch { - var streamingEntityWithThumbnailUrl = musicEntityItem.EntitiesByUniqueId!.FirstOrDefault(entity => entity.Value.ThumbnailUrl is not null).Value.ApiProvider; + /* + Temporary fix: + + Amazon is being excluded from the fallback for the time being, + because the "apiProvider" value doesn't cleanly match it's platform + entity link key. + */ + var streamingEntityWithThumbnailUrl = musicEntityItem.EntitiesByUniqueId!.FirstOrDefault(entity => entity.Value.ThumbnailUrl is not null && entity.Value.ApiProvider != "amazon").Value.ApiProvider; if (!string.IsNullOrEmpty(streamingEntityWithThumbnailUrl)) { diff --git a/src/App/Modules/ShareMusicCommandModule/commands/HandleMusicShareAsync.cs b/src/App/Modules/ShareMusicCommandModule/commands/HandleMusicShareAsync.cs index 76e465dc..43e6d1c2 100644 --- a/src/App/Modules/ShareMusicCommandModule/commands/HandleMusicShareAsync.cs +++ b/src/App/Modules/ShareMusicCommandModule/commands/HandleMusicShareAsync.cs @@ -76,7 +76,14 @@ await FollowupAsync( } catch (Exception ex) { - var streamingEntityWithThumbnailUrl = musicEntityItem.EntitiesByUniqueId!.FirstOrDefault(entity => entity.Value.ThumbnailUrl is not null).Value.ApiProvider; + /* + Temporary fix: + + Amazon is being excluded from the fallback for the time being, + because the "apiProvider" value doesn't cleanly match it's platform + entity link key. + */ + var streamingEntityWithThumbnailUrl = musicEntityItem.EntitiesByUniqueId!.FirstOrDefault(entity => entity.Value.ThumbnailUrl is not null && entity.Value.ApiProvider != "amazon").Value.ApiProvider; if (!string.IsNullOrEmpty(streamingEntityWithThumbnailUrl)) {