Example #1
0
 public bool HasTrack(XmlTrack track)
 {
     // 5.32.0.4 iTSfv showed duplicated tracklists if the same album was added to iTunes multiple times
     foreach (XmlTrack oTrack in Tracks)
     {
         if (track.FileName == oTrack.FileName)
         {
             return(true);
         }
     }
     return(false);
 }
Example #2
0
        public XmlDisc(List <string> filePaths)
            : this()
        {
            foreach (string p in filePaths)
            {
                XmlTrack xt = new XmlTrack(p);
                this.Tracks.Add(xt);
            }

            if (this.Tracks.Count > 0)
            {
                this.Key = Tracks[0].GetDiscKey();
            }
        }
Example #3
0
        public XmlDisc(List<string> filePaths)
            : this()
        {
            foreach (string p in filePaths)
            {
                XmlTrack xt = new XmlTrack(p);
                this.Tracks.Add(xt);
            }

            if (this.Tracks.Count > 0)
            {
                this.Key = Tracks[0].GetDiscKey();
            }
        }
Example #4
0
        public void ValidateTrack(XmlTrack track)
        {
            if (this.Config.UI.Tracks_ArtworkFill)
            {
                track.EmbedArtwork(this.Config, this.Report);
            }

            if (this.Config.UI.Tracks_AlbumArtistFill)
            {
                track.FillAlbumArtist(Albums, this.Report);
            }

            if (this.Config.UI.Tracks_GenreFill)
            {
                track.FillGenre(Discs, this.Report);
            }

            if (this.Config.UI.Tracks_TrackCountFill)
            {
                track.FillTrackCount(Albums, Discs, this.Report);
            }

            // do checks after updating tracks

            if (this.Config.UI.Checks_MissingTags)
            {
                track.CheckMissingTags(this.Report);
            }

            if (this.Config.UI.Checks_ArtworkLowRes)
            {
                track.CheckLowResArtwork(this.Config, this.Report);
            }

            // write tags if modified

            if (track.IsModified)
            {
                track.WriteTagsToFile();
            }

            Worker.ReportProgress(this.Progress, track);
        }
Example #5
0
        private void Write(string fp, Dictionary <XmlTrack, List <string> > dic)
        {
            if (dic.Count > 0)
            {
                using (StreamWriter sw = new StreamWriter(fp, false))
                {
                    IEnumerator i = dic.GetEnumerator();
                    KeyValuePair <XmlTrack, List <string> > kvp = new KeyValuePair <XmlTrack, List <string> >();

                    while (i.MoveNext())
                    {
                        kvp = (KeyValuePair <XmlTrack, List <string> >)i.Current;
                        XmlTrack      track       = kvp.Key;
                        List <string> missingTags = kvp.Value;
                        string        errors      = string.Join("; ", missingTags.ToArray());
                        sw.WriteLine(track.Location + " --> " + errors);
                    }
                }
            }
        }
Example #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);
            }
        }
Example #7
0
        public bool AddTrack(XmlTrack track)
        {
            bool success = false;

            if (!HasTrack(track))
            {
                Tracks.Add(track);

                if (DiscNumber == 0)
                {
                    this.DiscNumber = Math.Max(track.DiscNumber, 1);
                }

                if (string.IsNullOrEmpty(Key))
                {
                    this.Key = track.GetDiscKey();
                }

                success = true;
            }

            return(success);
        }
Example #8
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);
            }
        }
Example #9
0
 public static int CompareByArtworkSize(XmlTrack x, XmlTrack y)
 {
     return(string.Compare(x.Artwork.Width.ToString("0000"), y.Artwork.Width.ToString("0000")));
 }
Example #10
0
        private void AddFilesWizard_Load(object sender, EventArgs e)
        {
            foreach (string pfd in FilesDirs.ToArray<string>())
            {
                if (Directory.Exists(pfd))
                {
                    AddDirToNode(pfd, tvBands.Nodes);
                }
                else if (File.Exists(pfd))
                {
                    XmlTrack track = new XmlTrack(pfd);
                    Tracks.Add(track);
                    TracksOrphaned.Add(track);
                }
            }

            XmlDisc discOrphaned = new XmlDisc(TracksOrphaned);
            foreach (XmlTrack track in TracksOrphaned)
            {
                TreeNode tnOrphaned = new TreeNode("Orphaned Tracks");
                tnOrphaned.Tag = discOrphaned;
                tvBands.Nodes.Add(tnOrphaned);
            }

            if (tvBands.Nodes.Count > 0 && tvBands.Nodes[0].Nodes.Count > 0)
                tvBands.SelectedNode = tvBands.Nodes[0].Nodes[0];
            else if (tvBands.Nodes.Count > 0)
                tvBands.SelectedNode = tvBands.Nodes[0];
        }
Example #11
0
 public static int CompareByLocation(XmlTrack x, XmlTrack y)
 {
     return(string.Compare(x.Location, y.Location));
 }
Example #12
0
 public static int CompareByTrackNumber(XmlTrack x, XmlTrack y)
 {
     return(string.Compare(x.TrackNumber.ToString("000"), y.TrackNumber.ToString("000")));
 }
Example #13
0
        public bool AddTrack(XmlTrack track)
        {
            bool success = false;

            if (!HasTrack(track))
            {
                Tracks.Add(track);

                if (DiscNumber == 0)
                {
                    this.DiscNumber = Math.Max(track.DiscNumber, 1);
                }

                if (string.IsNullOrEmpty(Key))
                {
                    this.Key = track.GetDiscKey();
                }

                success = true;
            }

            return success;
        }
Example #14
0
 public void AddTrackMissingTags(XmlTrack track, List <string> missingTags)
 {
     TracksMissingTags.Add(track, missingTags);
 }
Example #15
0
 public bool HasTrack(XmlTrack track)
 {
     // 5.32.0.4 iTSfv showed duplicated tracklists if the same album was added to iTunes multiple times
     foreach (XmlTrack oTrack in Tracks)
     {
         if (track.FileName == oTrack.FileName)
         {
             return true;
         }
     }
     return false;
 }
Example #16
0
 public void AddTrackLowResArtwork(XmlTrack track, List<string> artwork_dimensions)
 {
     TracksLowResArtwork.Add(track, artwork_dimensions);
 }
Example #17
0
        public void ValidateTrack(XmlTrack track)
        {
            if (this.Config.UI.Tracks_ArtworkFill)
                track.EmbedArtwork(this.Config, this.Report);

            if (this.Config.UI.Tracks_AlbumArtistFill)
                track.FillAlbumArtist(Albums, this.Report);

            if (this.Config.UI.Tracks_GenreFill)
                track.FillGenre(Discs, this.Report);

            if (this.Config.UI.Tracks_TrackCountFill)
                track.FillTrackCount(Albums, Discs, this.Report);

            // do checks after updating tracks

            if (this.Config.UI.Checks_MissingTags)
                track.CheckMissingTags(this.Report);

            if (this.Config.UI.Checks_ArtworkLowRes)
                track.CheckLowResArtwork(this.Config, this.Report);

            // write tags if modified

            if (track.IsModified)
                track.WriteTagsToFile();

            Worker.ReportProgress(this.Progress, track);
        }
Example #18
0
 public void AddTrackMissingTags(XmlTrack track, List<string> missingTags)
 {
     TracksMissingTags.Add(track, missingTags);
 }
Example #19
0
 public void AddTrackLowResArtwork(XmlTrack track, List <string> artwork_dimensions)
 {
     TracksLowResArtwork.Add(track, artwork_dimensions);
 }