Exemple #1
0
        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);
        }
Exemple #2
0
        private static void GetAllTrees(ILogger <Program> logger, IArtistProcessor artistProcessor, ClassifierConfiguration config, List <FileWithTags> allFilesWithTags,
                                        List <ArtistWithTracks> allArtists, List <AlbumWithLocationAndTracks> allAlbums, List <TrackWithFile> allTracks)
        {
            logger.LogInformation("Extracting information from Tags...");

            var done = 0;

            foreach (var tag in allFilesWithTags)
            {
                logger.LogInformation("Processing file: {1} of {2}", done++, allFilesWithTags.Count);
                var trackWithFile = tag.ExtractTrack();
                allArtists.Merge(tag.ExtractArtists(artistProcessor, trackWithFile));
                allAlbums.Merge(tag.ExtractAlbum(trackWithFile));
                allTracks.Add(trackWithFile);
                logger.LogInformation("Artists Found: {0}, Albums Found: {1}; Tracks Found: {2}",
                                      allArtists.Count, allAlbums.Count, allTracks.Count);
            }
            logger.LogInformation("Artists Found: {0}, Albums Found: {1}; Tracks Found: {2}",
                                  allArtists.Count, allAlbums.Count, allTracks.Count);
        }