Example #1
0
        internal void FillGenre(List <XmlDisc> Discs, ReportWriter reportWriter)
        {
            XmlDisc disc = Discs.FirstOrDefault(x => x.Key == this.GetDiscKey());

            if (disc != null)
            {
                if (this.Tags.Genres.Length == 0)
                {
                    this.Genre = disc.Genre;
                }
            }
        }
Example #2
0
        public XmlLibrary(Settings config)
        {
            Report       = new ReportWriter();
            AlbumArtists = new List <XmlAlbumArtist>();
            Albums       = new List <XmlAlbum>();
            Discs        = new List <XmlDisc>();
            Tracks       = new List <XmlTrack>();

            Config = config;

            Worker.DoWork += Worker_DoWork;
        }
Example #3
0
        internal void FillAlbumArtist(List <XmlAlbum> Albums, ReportWriter reportWriter)
        {
            XmlAlbum album = Albums.FirstOrDefault(x => x.Key == this.GetAlbumKey());

            if (album != null)
            {
                if (this.Tags.AlbumArtists.Length == 0)
                {
                    this.AlbumArtist = album.AlbumArtist;
                }
            }
        }
Example #4
0
        public XmlLibrary(XMLSettings config)
        {
            Report = new ReportWriter();
            AlbumArtists = new List<XmlAlbumArtist>();
            Albums = new List<XmlAlbum>();
            Discs = new List<XmlDisc>();
            Tracks = new List<XmlTrack>();

            Config = config;

            Worker.DoWork += Worker_DoWork;
        }
Example #5
0
 internal void EmbedArtwork(XMLSettings xMLSettings, ReportWriter reportWriter)
 {
     if (this.Tags.Pictures.Length == 0)
     {
         foreach (string fileName in xMLSettings.ArtworkLookupFileNames)
         {
             string fp = Path.Combine(Path.GetDirectoryName(this.Location), fileName);
             if (AddArtwork(fp))
             {
                 break;
             }
         }
     }
 }
Example #6
0
        internal void CheckLowResArtwork(XMLSettings xMLSettings, ReportWriter reportWriter)
        {
            List <string> artwork_low = new List <string>();

            if (this.Artwork.Width > 0 && this.Artwork.Width < xMLSettings.LowResArtworkSize)
            {
                artwork_low.Add(this.Artwork.Width.ToString());
            }

            if (this.Artwork.Height > 0 && this.Artwork.Height < xMLSettings.LowResArtworkSize)
            {
                artwork_low.Add(this.Artwork.Height.ToString());
            }

            if (artwork_low.Count > 0)
            {
                reportWriter.AddTrackLowResArtwork(this, artwork_low);
            }
        }
Example #7
0
        internal void FillTrackCount(List <XmlAlbum> Albums, List <XmlDisc> Discs, ReportWriter reportWriter)
        {
            XmlDisc       disc       = Discs.FirstOrDefault(x => x.Key == this.GetDiscKey());
            List <string> filledTags = new List <string>();

            if (disc != null)
            {
                if (this.Tags.TrackCount == 0)
                {
                    this.Tags.TrackCount = (uint)disc.Tracks.Count;
                    IsModified           = true;
                    filledTags.Add("TrackCount");
                }
            }

            XmlAlbum album = Albums.FirstOrDefault(x => x.Key == this.GetAlbumKey());

            if (album != null)
            {
                if (this.Tags.Disc == 0 && album.Discs.Count == 1)
                {
                    this.Tags.Disc = 1; // for single disc albums you can specify DiscNumber
                    IsModified     = true;
                    filledTags.Add("DiscNumber");
                }

                if (this.Tags.DiscCount == 0)
                {
                    this.Tags.DiscCount = (uint)album.Discs.Count;
                    IsModified          = true;
                    filledTags.Add("DiscCount");
                }
            }

            if (filledTags.Count > 0)
            {
                DebugHelper.WriteLine(this.FileName + " --> filled " + filledTags.ToArray().Join("; "));
            }
        }
Example #8
0
        public bool CheckMissingTags(ReportWriter report)
        {
            List <string> missingTags = new List <string>();

            if (string.IsNullOrEmpty(this.Tags.Title))
            {
                missingTags.Add("Title");
            }

            if (string.IsNullOrEmpty(this.Artist))
            {
                missingTags.Add("Artist");
            }

            if (string.IsNullOrEmpty(this.AlbumArtist))
            {
                missingTags.Add("Album Artist");
            }

            if (string.IsNullOrEmpty(this.Genre))
            {
                missingTags.Add("Genre");
            }

            if (this.Tags.Pictures.Length == 0)
            {
                missingTags.Add("Artwork");
            }

            if (this.Tags.Track == 0)
            {
                missingTags.Add("Track Number");
            }

            if (this.Tags.TrackCount == 0)
            {
                missingTags.Add("Track Count");
            }

            if (this.Tags.Disc == 0)
            {
                missingTags.Add("Disc Number");
            }

            if (this.Tags.DiscCount == 0)
            {
                missingTags.Add("Disc Count");
            }

            if (this.Tags.Year == 0)
            {
                missingTags.Add("Year");
            }

            if (missingTags.Count > 0)
            {
                report.AddTrackMissingTags(this, missingTags);
            }

            return(missingTags.Count == 0);
        }
Example #9
0
        internal void FillTrackCount(List<XmlAlbum> Albums, List<XmlDisc> Discs, ReportWriter reportWriter)
        {
            XmlDisc disc = Discs.FirstOrDefault(x => x.Key == this.GetDiscKey());
            List<string> filledTags = new List<string>();

            if (disc != null)
            {
                if (this.Tags.TrackCount == 0)
                {
                    this.Tags.TrackCount = (uint)disc.Tracks.Count;
                    IsModified = true;
                    filledTags.Add("TrackCount");
                }
            }

            XmlAlbum album = Albums.FirstOrDefault(x => x.Key == this.GetAlbumKey());
            if (album != null)
            {
                if (this.Tags.Disc == 0 && album.Discs.Count == 1)
                {
                    this.Tags.Disc = 1; // for single disc albums you can specify DiscNumber
                    IsModified = true;
                    filledTags.Add("DiscNumber");
                }

                if (this.Tags.DiscCount == 0)
                {
                    this.Tags.DiscCount = (uint)album.Discs.Count;
                    IsModified = true;
                    filledTags.Add("DiscCount");
                }
            }

            if (filledTags.Count > 0)
                DebugHelper.WriteLine(this.FileName + " --> filled " + filledTags.ToArray().Join("; "));
        }
Example #10
0
 internal void FillGenre(List<XmlDisc> Discs, ReportWriter reportWriter)
 {
     XmlDisc disc = Discs.FirstOrDefault(x => x.Key == this.GetDiscKey());
     if (disc != null)
     {
         if (this.Tags.Genres.Length == 0)
         {
             this.Genre = disc.Genre;
         }
     }
 }
Example #11
0
 internal void FillAlbumArtist(List<XmlAlbum> Albums, ReportWriter reportWriter)
 {
     XmlAlbum album = Albums.FirstOrDefault(x => x.Key == this.GetAlbumKey());
     if (album != null)
     {
         if (this.Tags.AlbumArtists.Length == 0)
         {
             this.AlbumArtist = album.AlbumArtist;
         }
     }
 }
Example #12
0
 internal void EmbedArtwork(XMLSettings xMLSettings, ReportWriter reportWriter)
 {
     if (this.Tags.Pictures.Length == 0)
     {
         foreach (string fileName in xMLSettings.ArtworkLookupFileNames)
         {
             string fp = Path.Combine(Path.GetDirectoryName(this.Location), fileName);
             if (AddArtwork(fp))
                 break;
         }
     }
 }
Example #13
0
        internal void CheckLowResArtwork(XMLSettings xMLSettings, ReportWriter reportWriter)
        {
            List<string> artwork_low = new List<string>();

            if (this.Artwork.Width > 0 && this.Artwork.Width < xMLSettings.LowResArtworkSize)
            {
                artwork_low.Add(this.Artwork.Width.ToString());
            }

            if (this.Artwork.Height > 0 && this.Artwork.Height < xMLSettings.LowResArtworkSize)
            {
                artwork_low.Add(this.Artwork.Height.ToString());
            }

            if (artwork_low.Count > 0)
                reportWriter.AddTrackLowResArtwork(this, artwork_low);
        }
Example #14
0
        public bool CheckMissingTags(ReportWriter report)
        {
            List<string> missingTags = new List<string>();

            if (string.IsNullOrEmpty(this.Tags.Title))
            {
                missingTags.Add("Title");
            }

            if (string.IsNullOrEmpty(this.Artist))
            {
                missingTags.Add("Artist");
            }

            if (string.IsNullOrEmpty(this.AlbumArtist))
            {
                missingTags.Add("Album Artist");
            }

            if (string.IsNullOrEmpty(this.Genre))
            {
                missingTags.Add("Genre");
            }

            if (this.Tags.Pictures.Length == 0)
            {
                missingTags.Add("Artwork");
            }

            if (this.Tags.Track == 0)
            {
                missingTags.Add("Track Number");
            }

            if (this.Tags.TrackCount == 0)
            {
                missingTags.Add("Track Count");
            }

            if (this.Tags.Disc == 0)
            {
                missingTags.Add("Disc Number");
            }

            if (this.Tags.DiscCount == 0)
            {
                missingTags.Add("Disc Count");
            }

            if (this.Tags.Year == 0)
            {
                missingTags.Add("Year");
            }

            if (missingTags.Count > 0)
            {
                report.AddTrackMissingTags(this, missingTags);
            }

            return missingTags.Count == 0;
        }