/// <summary> /// Gets (parses) the discog identifier from an <see cref="Id3.Id3Tag"/> /// </summary> /// <param name="tag">The tag.</param> /// <returns></returns> private Discog GetDiscogId(Id3.Id3Tag tag) { string _discogsId = "0"; Id3Frame discogsFrame = tag.Frames.Where(x => x.ToString().ToUpper().Contains("DISCOGS_RELEASE_ID\0")).FirstOrDefault(); Discog discog = new Discog(); if (discogsFrame != null) { _discogsId = discogsFrame.ToString().ToUpper().Replace("DISCOGS_RELEASE_ID\0", ""); } else { //Try get release Id other search discogsFrame = tag.Frames.Where(x => x.ToString().ToUpper().Contains("DISCOGSID\0")).FirstOrDefault(); if (discogsFrame != null) { _discogsId = discogsFrame.ToString().ToUpper().Replace("DISCOGSID\0", ""); } else { discogsFrame = tag.Frames.Where(x => x.ToString().ToUpper().Contains("DISCOGS-ID\0")).FirstOrDefault(); if (discogsFrame == null) { return(discog); } _discogsId = discogsFrame.ToString().ToUpper().Replace("DISCOGS-ID\0", ""); } } if (!string.IsNullOrEmpty(_discogsId)) { int i; int.TryParse(_discogsId, out i); if (i != 0) { discog.ReleaseId = i; } else { discog.ReleaseId = 0; } } return(discog); }
/// <summary> /// Gets the country name from the file tag /// </summary> /// <param name="tag">The tag.</param> /// <returns></returns> private string GetCountry(Id3.Id3Tag tag) { Id3Frame countryFrame = tag.Frames.Where(x => x.ToString().ToUpper().Contains("DISCOGS_COUNTRY\0")).FirstOrDefault(); if (countryFrame != null) { return(countryFrame.ToString().ToUpper().Replace("DISCOGS_COUNTRY\0", "")); } else { countryFrame = tag.Frames.Where(x => x.ToString().ToUpper().Contains("COUNTRY\0")).FirstOrDefault(); if (countryFrame != null) { return(countryFrame.ToString().ToUpper().Replace("COUNTRY\0", "")); } } return(null); }