Example #1
0
        // Methods :: Public :: Remove
        /// <summary>
        ///     Remove a <see cref="Song" /> from the album.
        /// </summary>
        /// <param name="song">
        ///	The <see cref="Song" /> to remove.
        /// </param>
        /// <param name="changed">
        ///	Return location for whether anything changed.
        /// </param>
        /// <param name="empty">
        ///	Return location for whether the album is now empty.
        /// </param>
        public void Remove(Song song, out bool changed, out bool empty)
        {
            changed = false;

            lock (this) {
                n_tracks--;

                // Complete?
                bool complete_changed = CheckCompleteness();
                if (complete_changed)
                {
                    changed = true;
                }

                // Remove Song
                songs.Remove(song);

                // Artists
                bool artists_changed = RemoveArtistsAndPerformers(song);
                if (artists_changed)
                {
                    changed = true;
                }

                // Remove if empty
                empty = (n_tracks == 0);
                if (empty && !FileUtils.IsFromRemovableMedia(folder))
                {
                    Global.CoverDB.RemoveCover(this.Key);
                }
            }
        }
Example #2
0
        // Methods :: Public :: Deregister
        public override void Deregister()
        {
            dead = true;

            pointers.Remove(this.Handle);

            foreach (IntPtr extra_handle in handles)
            {
                pointers.Remove(extra_handle);
            }

            if (!HasAlbum && !FileUtils.IsFromRemovableMedia(filename))
            {
                Global.CoverDB.RemoveCover(filename);
            }
        }