public void AddDisc(XmlDisc o) { if (!Discs.ContainsKey(o.Key)) { Discs.Add(o.Key, o); } }
public void RemoveDisc(XmlDisc o) { if (Discs.ContainsKey(o.Key)) { Discs.Remove(o.Key); } }
public void ValidateDisc(XmlDisc disc) { DebugHelper.WriteLine("Validating --> " + disc.Location); disc.Tracks.Sort(XmlTrackComparer.XmlTrackComparerMethods.CompareByTrackNumber); foreach (XmlTrack track in disc.Tracks) { ValidateTrack(track); } }
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; } } }
public void ValidateDisc(XmlDisc disc) { DebugHelper.WriteLine("Validating --> " + disc.Location); disc.Tracks.Sort(XmlTrackComparer.XmlTrackComparerMethods.CompareByTrackNumber); Parallel.ForEach(disc.Tracks, track => { ValidateTrack(track); } ); }
/// <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); } }
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("; ")); } }
public void AddDisc(XmlDisc o) { if (!Discs.ContainsKey(o.Key)) Discs.Add(o.Key, o); }
public void RemoveDisc(XmlDisc o) { if (Discs.ContainsKey(o.Key)) Discs.Remove(o.Key); }
/// <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); } }
public void ValidateDisc(XmlDisc disc) { DebugHelper.WriteLine("Validating --> " + disc.Location); disc.Tracks.Sort(XmlTrackComparer.XmlTrackComparerMethods.CompareByTrackNumber); foreach (XmlTrack track in disc.Tracks) { ValidateTrack(track); } }
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]; }
private XmlDisc GetDiscFromFolder(string dirPath) { List<XmlTrack> tracks = new List<XmlTrack>(); foreach (string ext in Program.Config.SupportedFileTypes) { Directory.GetFiles(dirPath, string.Format("*.{0}", ext), SearchOption.TopDirectoryOnly).ToList().ForEach(delegate(string fp) { tracks.Add(new XmlTrack(fp)); }); } XmlDisc tempDisc = new XmlDisc(tracks); Discs.Add(tempDisc); this.Tracks.AddRange(tempDisc.Tracks.ToArray()); return tempDisc; }