Buggy code:
public class SonosHelper { public static final String SUBSONIC_CLIENT_ID = "sonos" ; private MediaFileService mediaFileService ; private PlaylistService playlistService ; private PlayerService playerService ; private TranscodingService transcodingService ; private SettingsService settingsService ; private MusicIndexService musicIndexService ; private SearchService searchService ; private MediaFileDao mediaFileDao ; private RatingService ratingService ; private LastFmService lastFmService ; private PodcastService podcastService ; public List < AbstractMedia > forRoot ( ) { } public List < AbstractMedia > forShuffle ( int count , String username ) { } public List < AbstractMedia > forShuffleMusicFolder ( int id , int count , String username ) { } private List < AbstractMedia > forShuffleMusicFolder ( List < MusicFolder > musicFolders , int count , String username ) { } public List < AbstractMedia > forShuffleArtist ( int mediaFileId , int count , String username ) { } public List < AbstractMedia > forShuffleAlbumList ( AlbumListType albumListType , int count , String username ) { } public List < AbstractMedia > forRadioArtist ( int mediaFileId , int count , String username ) { } public List < AbstractMedia > forLibrary ( String username ) { } public List < AbstractMedia > forMusicFolder ( int musicFolderId , String username ) { } public List < AbstractMedia > forMusicFolder ( MusicFolder musicFolder , String username ) { } public List < AbstractMedia > forDirectoryContent ( int mediaFileId , String username ) { } private MediaCollection forDirectory ( MediaFile dir ) { } public List < MediaCollection > forPlaylists ( String username ) { } public List < MediaCollection > forAlbumLists ( ) { } public List < MediaCollection > forPodcastChannels ( ) { } public List < AbstractMedia > forPodcastChannel ( int channelId , String username ) { } public MediaList forAlbumList ( AlbumListType albumListType , int offset , int count , String username ) { } private AlbumList createAlbumList ( AlbumListType albumListType , int offset , int count , String username ) { } private MediaList forDecades ( int offset , int count ) { } private MediaList forGenres ( int offset , int count ) { } public List < MediaCollection > forDecade ( int decade , String username ) { } public List < MediaCollection > forGenre ( int genreIndex , String username ) { } public List < MediaMetadata > forPlaylist ( int playlistId , String username ) { } public List < MediaCollection > forStarred ( ) { } public List < MediaCollection > forStarredArtists ( String username ) { } public List < MediaCollection > forStarredAlbums ( String username ) { } public List < MediaMetadata > forStarredSongs ( String username ) { } public List < MediaCollection > forSearchCategories ( ) { } public MediaList forSearch ( String query , int offset , int count , String username , SearchService . IndexType indexType ) { } public List < AbstractMedia > forSimilarArtists ( int mediaFileId , String username ) { } private List < AbstractMedia > forMediaFiles ( List < MediaFile > mediaFiles , String username ) { } public AbstractMedia forMediaFile ( MediaFile mediaFile , String username ) { } public MediaMetadata forSong ( MediaFile song , String username ) { Player player = createPlayerIfNecessary ( username ) ; String suffix = transcodingService . getSuffix ( player , song , null ) ; MediaMetadata result = new MediaMetadata ( ) ; result . setId ( String . valueOf ( song . getId ( ) ) ) ; result . setItemType ( TRACK ) ; <START_BUG> result . setMimeType ( StringUtil . getMimeType ( suffix ) ) ; <END_BUG> result . setTitle ( song . getTitle ( ) ) ; result . setGenre ( song . getGenre ( ) ) ; AlbumArtUrl albumArtURI = new AlbumArtUrl ( ) ; albumArtURI . setValue ( getCoverArtUrl ( String . valueOf ( song . getId ( ) ) ) ) ; TrackMetadata trackMetadata = new TrackMetadata ( ) ; trackMetadata . setArtist ( song . getArtist ( ) ) ; trackMetadata . setAlbumArtist ( song . getAlbumArtist ( ) ) ; trackMetadata . setAlbum ( song . getAlbumName ( ) ) ; trackMetadata . setAlbumArtURI ( albumArtURI ) ; trackMetadata . setDuration ( song . getDurationSeconds ( ) ) ; MediaFile parent = mediaFileService . getParentOf ( song ) ; if ( ( parent != null ) && ( parent . isAlbum ( ) ) ) { trackMetadata . setAlbumId ( String . valueOf ( parent . getId ( ) ) ) ; } result . setTrackMetadata ( trackMetadata ) ; return result ; } public void star ( int id , String username ) { } public void unstar ( int id , String username ) { } private String getCoverArtUrl ( String id ) { } public static MediaList createSubList ( int index , int count , List < ? extends AbstractMedia > mediaCollections ) { } private List < MediaFile > filterMusic ( List < MediaFile > files ) { } public void setPlaylistService ( PlaylistService playlistService ) { } public void setPlayerService ( PlayerService playerService ) { } public void setTranscodingService ( TranscodingService transcodingService ) { } public String getMediaURI ( int mediaFileId , String username ) { } private Player createPlayerIfNecessary ( String username ) { } public String getBaseUrl ( ) { } public void setMediaFileService ( MediaFileService mediaFileService ) { } public void setSettingsService ( SettingsService settingsService ) { } public void setMusicIndexService ( MusicIndexService musicIndexService ) { } public void setMediaFileDao ( MediaFileDao mediaFileDao ) { } public void setSearchService ( SearchService searchService ) { } public void setRatingService ( RatingService ratingService ) { } public void setLastFmService ( LastFmService lastFmService ) { } public void setPodcastService ( PodcastService podcastService ) { } }

Fix:
result . setMimeType ( StringUtil . getMimeType ( suffix , true ) ) ;