Пример #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;
                }
            }
        }
Пример #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;
        }
Пример #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;
                }
            }
        }
Пример #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;
        }
Пример #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;
             }
         }
     }
 }
Пример #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);
            }
        }
Пример #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("; "));
            }
        }
Пример #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);
        }
Пример #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("; "));
        }
Пример #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;
         }
     }
 }
Пример #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;
         }
     }
 }
Пример #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;
         }
     }
 }
Пример #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);
        }
Пример #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;
        }