public static AlbumWithLocationAndTracks ExtractAlbum(this FileWithTags input, TrackWithFile trackWithFile) { return(new AlbumWithLocationAndTracks { Name = input.Album, Location = Path.GetDirectoryName(input.FilePath)?.Trim().ToLower(), Tracks = new List <TrackWithFile> { trackWithFile } }); }
public static TrackWithArtists ExtractArtists(this FileWithTags input, IArtistProcessor artistProcessor, TrackWithFile trackWithFile) { var trackWithArtistsWithRoles = new TrackWithArtists { File = trackWithFile.File, Name = trackWithFile.Name, TrackId = trackWithFile.TrackId, Artists = new List <Artist>(), TrackNo = trackWithFile.TrackNo, Year = trackWithFile.Year }; if (!string.IsNullOrEmpty(input.Composers)) { var composers = artistProcessor.GetArtists(input.Composers, false, true); if (composers != null) { trackWithArtistsWithRoles.Artists.AddRange(composers); } } if (!string.IsNullOrEmpty(input.Artists)) { var artists = artistProcessor.GetArtists(input.Artists, false, false); if (artists != null) { trackWithArtistsWithRoles.Artists.AddRange(artists); } } if (!string.IsNullOrEmpty(input.AlbumArtists)) { var albumArtists = artistProcessor.GetArtists(input.AlbumArtists, false, false); if (albumArtists != null) { trackWithArtistsWithRoles.Artists.AddRange(albumArtists); } } if (!string.IsNullOrEmpty(input.Title)) { var featuredArtists = artistProcessor.GetArtists(input.Title, true, false); if (featuredArtists != null) { trackWithArtistsWithRoles.Artists.AddRange(featuredArtists); } } return(trackWithArtistsWithRoles); }