Beispiel #1
0
        public void ValidateAlbum(XmlAlbum album)
        {
            if (Config.UI.FileSystem_SearchArtworkUsingAAD)
            {
                string pathArtwork = Path.Combine(album.Location, Config.ArtworkFileNameWithoutExtension) + ".jpg";
                if (!File.Exists(pathArtwork))
                {
                    DebugHelper.WriteLine("Searching for artwork --> " + album.Name);
                    album.SaveArtworkUsingAAD(Config.AlbumArtworkDownloaderPath, pathArtwork, Config.LowResArtworkSize);
                }
            }

            IEnumerator e = album.Discs.GetEnumerator();

            while (e.MoveNext())
            {
                ValidateDisc(((KeyValuePair <string, XmlDisc>)e.Current).Value);
            }

            if (Config.UI.FileSystem_ArtworkJpgExport)
            {
                foreach (XmlTrack track in album.GetTracks().Where(track => track.ExportArtwork(Config)))
                {
                    break;
                }
            }
        }
Beispiel #2
0
 public void RemoveAlbum(XmlAlbum o)
 {
     if (Albums.ContainsKey(o.Key))
     {
         Albums.Remove(o.Key);
     }
 }
Beispiel #3
0
 public void AddAlbum(XmlAlbum o)
 {
     if (!Albums.ContainsKey(o.Key))
     {
         Albums.Add(o.Key, o);
     }
 }
Beispiel #4
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;
                }
            }
        }
Beispiel #5
0
        public void ValidateAlbum(XmlAlbum album)
        {
            IEnumerator e = album.Discs.GetEnumerator();

            while (e.MoveNext())
            {
                ValidateDisc(((KeyValuePair <string, XmlDisc>)e.Current).Value);
            }

            if (this.Config.UI.FileSystem_ArtworkJpgExport)
            {
                foreach (XmlTrack track in album.GetTracks())
                {
                    if (track.ExportArtwork(Config))
                    {
                        break;
                    }
                }
            }
        }
Beispiel #6
0
        /// <summary>
        /// Method to add a track to Player
        /// </summary>
        /// <param name="track"></param>
        private void AddTrack(XmlTrack track)
        {
            string albumName = track.AlbumArtist;

            if (string.IsNullOrEmpty(albumName))
            {
                albumName = Path.GetFileName(Path.GetDirectoryName(track.Location));
            }

            XmlAlbumArtist tempBand = GetBand(albumName);

            if (tempBand == null)
            {
                tempBand = new XmlAlbumArtist(albumName);
                Library.Add(tempBand.Name, tempBand);
                AlbumArtists.Add(tempBand);
            }

            XmlAlbum tempAlbum = tempBand.GetAlbum(track.GetAlbumKey());

            if (tempAlbum == null)
            {
                tempAlbum = new XmlAlbum(track.GetAlbumKey());
                Library[albumName].AddAlbum(tempAlbum);
                Albums.Add(tempAlbum);
            }

            XmlDisc tempDisc = tempAlbum.GetDisc(track.GetDiscKey());

            if (tempDisc == null)
            {
                tempDisc = new XmlDisc(track.GetDiscKey());
                Library[albumName].GetAlbum(track.GetAlbumKey()).AddDisc(tempDisc);
                Discs.Add(tempDisc);
            }

            if (Library[albumName].GetAlbum(track.GetAlbumKey()).GetDisc(track.GetDiscKey()).AddTrack(track))
            {
                Tracks.Add(track);
            }
        }
Beispiel #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("; "));
            }
        }
Beispiel #8
0
 public void RemoveAlbum(XmlAlbum o)
 {
     if (Albums.ContainsKey(o.Key))
         Albums.Remove(o.Key);
 }
Beispiel #9
0
 public void AddAlbum(XmlAlbum o)
 {
     if (!Albums.ContainsKey(o.Key))
         Albums.Add(o.Key, o);
 }
Beispiel #10
0
        /// <summary>
        /// Method to add a track to Player
        /// </summary>
        /// <param name="track"></param>
        private void AddTrack(XmlTrack track)
        {
            string albumName = track.AlbumArtist;
            if (string.IsNullOrEmpty(albumName))
                albumName = Path.GetFileName(Path.GetDirectoryName(track.Location));

            XmlAlbumArtist tempBand = GetBand(albumName);
            if (tempBand == null)
            {
                tempBand = new XmlAlbumArtist(albumName);
                Library.Add(tempBand.Name, tempBand);
                AlbumArtists.Add(tempBand);
            }

            XmlAlbum tempAlbum = tempBand.GetAlbum(track.GetAlbumKey());
            if (tempAlbum == null)
            {
                tempAlbum = new XmlAlbum(track.GetAlbumKey());
                Library[albumName].AddAlbum(tempAlbum);
                Albums.Add(tempAlbum);
            }

            XmlDisc tempDisc = tempAlbum.GetDisc(track.GetDiscKey());
            if (tempDisc == null)
            {
                tempDisc = new XmlDisc(track.GetDiscKey());
                Library[albumName].GetAlbum(track.GetAlbumKey()).AddDisc(tempDisc);
                Discs.Add(tempDisc);
            }

            if (Library[albumName].GetAlbum(track.GetAlbumKey()).GetDisc(track.GetDiscKey()).AddTrack(track))
            {
                Tracks.Add(track);
            }
        }
Beispiel #11
0
        public void ValidateAlbum(XmlAlbum album)
        {
            IEnumerator e = album.Discs.GetEnumerator();
            while (e.MoveNext())
            {
                ValidateDisc(((KeyValuePair<string, XmlDisc>)e.Current).Value);
            }

            if (this.Config.UI.FileSystem_ArtworkJpgExport)
            {
                foreach (XmlTrack track in album.GetTracks())
                {
                    if (track.ExportArtwork(Config))
                    {
                        break;
                    }
                }
            }
        }