/// <summary> /// Removes an audiobook from this library and removes the link to it from the audiobook. /// The link is only removed if it points to this library. /// </summary> /// <param name="audiobook">audiobook to be removed</param> public void RemoveAudiobook(Audiobook audiobook) { if (Contains(audiobook)) { Audiobooks.Remove(audiobook.ID); if (audiobook.Library.Equals(this)) { audiobook.Library = null; } DeleteMetadataFolder(audiobook.Metadata.MetadataPath); } }
/// <summary> /// Adds an audiobook to the Library. If it is already added the audiobook is updated. /// Every audiobook that is new to the library gets a new metadata path. /// </summary> public void UpdateAudiobook(Audiobook audiobook) { if (Contains(audiobook)) { ClearChapterMetadata(audiobook); Audiobooks.Remove(audiobook.ID); } else { audiobook.Metadata.MetadataPath = Path.Combine(MetadataFolder, Guid.NewGuid().ToString()); } AddAudiobook(audiobook); }