Example #1
0
        public void RemoveMusicBrainzTags(string path)
        {
            var tags = new AudioTag(path);

            tags.MusicBrainzReleaseCountry  = null;
            tags.MusicBrainzReleaseStatus   = null;
            tags.MusicBrainzReleaseType     = null;
            tags.MusicBrainzReleaseId       = null;
            tags.MusicBrainzArtistId        = null;
            tags.MusicBrainzReleaseArtistId = null;
            tags.MusicBrainzReleaseGroupId  = null;
            tags.MusicBrainzTrackId         = null;
            tags.MusicBrainzAlbumComment    = null;
            tags.MusicBrainzReleaseTrackId  = null;

            tags.Write(path);
        }
Example #2
0
        public void RemoveMusicBrainzTags(string path)
        {
            var tags = new AudioTag(path);

            tags.MusicBrainzReleaseCountry  = null;
            tags.MusicBrainzReleaseStatus   = null;
            tags.MusicBrainzReleaseType     = null;
            tags.MusicBrainzReleaseId       = null;
            tags.MusicBrainzArtistId        = null;
            tags.MusicBrainzReleaseArtistId = null;
            tags.MusicBrainzReleaseGroupId  = null;
            tags.MusicBrainzTrackId         = null;
            tags.MusicBrainzAlbumComment    = null;
            tags.MusicBrainzReleaseTrackId  = null;

            _rootFolderWatchingService.ReportFileSystemChangeBeginning(path);
            tags.Write(path);
        }
Example #3
0
        public Dictionary <string, Tuple <string, string> > Diff(AudioTag other)
        {
            var output = new Dictionary <string, Tuple <string, string> >();

            if (!IsValid || !other.IsValid)
            {
                return(output);
            }

            if (Title != other.Title)
            {
                output.Add("Title", Tuple.Create(Title, other.Title));
            }

            if ((Performers != null && Performers.Any()) ^
                (other.Performers != null && other.Performers.Any()) || (
                    other.Performers != null && other.Performers.Any() &&
                    Performers != null && Performers.Any() &&
                    !Performers.SequenceEqual(other.Performers)))
            {
                var oldValue = Performers != null && Performers.Any() ? string.Join(" / ", Performers) : null;
                var newValue = other.Performers != null && other.Performers.Any() ? string.Join(" / ", other.Performers) : null;

                output.Add("Artist", Tuple.Create(oldValue, newValue));
            }

            if (Album != other.Album && other.Album != null)
            {
                output.Add("Album", Tuple.Create(Album, other.Album));
            }

            if ((AlbumArtists != null && AlbumArtists.Any()) ^
                (other.AlbumArtists != null && other.AlbumArtists.Any()) || (
                    other.AlbumArtists != null && other.AlbumArtists.Any() &&
                    AlbumArtists != null && AlbumArtists.Any() &&
                    !AlbumArtists.SequenceEqual(other.AlbumArtists)))
            {
                var oldValue = AlbumArtists != null && AlbumArtists.Any() ? string.Join(" / ", AlbumArtists) : null;
                var newValue = other.AlbumArtists != null && other.AlbumArtists.Any() ? string.Join(" / ", other.AlbumArtists) : null;

                output.Add("Album Artist", Tuple.Create(oldValue, newValue));
            }

            if (Track != other.Track)
            {
                output.Add("Track", Tuple.Create(Track.ToString(), other.Track.ToString()));
            }

            if (TrackCount != other.TrackCount)
            {
                output.Add("Track Count", Tuple.Create(TrackCount.ToString(), other.TrackCount.ToString()));
            }

            if (Disc != other.Disc)
            {
                output.Add("Disc", Tuple.Create(Disc.ToString(), other.Disc.ToString()));
            }

            if (DiscCount != other.DiscCount)
            {
                output.Add("Disc Count", Tuple.Create(DiscCount.ToString(), other.DiscCount.ToString()));
            }

            if (Media != other.Media)
            {
                output.Add("Media Format", Tuple.Create(Media, other.Media));
            }

            if (Date != other.Date)
            {
                var oldValue = Date.HasValue ? Date.Value.ToString("yyyy-MM-dd") : null;
                var newValue = other.Date.HasValue ? other.Date.Value.ToString("yyyy-MM-dd") : null;
                output.Add("Date", Tuple.Create(oldValue, newValue));
            }

            if (OriginalReleaseDate != other.OriginalReleaseDate)
            {
                // Id3v2.3 tags can only store the year, not the full date
                if (OriginalReleaseDate.HasValue &&
                    OriginalReleaseDate.Value.Month == 1 &&
                    OriginalReleaseDate.Value.Day == 1)
                {
                    if (OriginalReleaseDate.Value.Year != other.OriginalReleaseDate.Value.Year)
                    {
                        output.Add("Original Year", Tuple.Create(OriginalReleaseDate.Value.Year.ToString(), other.OriginalReleaseDate.Value.Year.ToString()));
                    }
                }
                else
                {
                    var oldValue = OriginalReleaseDate.HasValue ? OriginalReleaseDate.Value.ToString("yyyy-MM-dd") : null;
                    var newValue = other.OriginalReleaseDate.HasValue ? other.OriginalReleaseDate.Value.ToString("yyyy-MM-dd") : null;
                    output.Add("Original Release Date", Tuple.Create(oldValue, newValue));
                }
            }

            if (Publisher != other.Publisher)
            {
                output.Add("Label", Tuple.Create(Publisher, other.Publisher));
            }

            if ((Genres != null && Genres.Any()) ^
                (other.Genres != null && other.Genres.Any()) || (
                    other.Genres != null && other.Genres.Any() &&
                    Genres != null && Genres.Any() &&
                    !Genres.SequenceEqual(other.Genres)))
            {
                var oldValue = Genres != null && Genres.Any() ? string.Join(" / ", Genres) : null;
                var newValue = other.Genres != null && other.Genres.Any() ? string.Join(" / ", other.Genres) : null;

                output.Add("Genres", Tuple.Create(oldValue, newValue));
            }

            if (ImageSize != other.ImageSize)
            {
                output.Add("Image Size", Tuple.Create(ImageSize.ToString(), other.ImageSize.ToString()));
            }

            return(output);
        }