Banshee.Dap.Mtp.MtpSource.DeleteTrack C# (CSharp) Method

DeleteTrack() protected method

protected DeleteTrack ( DatabaseTrackInfo track ) : bool
track Banshee.Collection.Database.DatabaseTrackInfo
return bool
        protected override bool DeleteTrack (DatabaseTrackInfo track)
        {
            lock (mtp_device) {
                Track mtp_track = track_map [track.TrackId];
                track_map.Remove (track.TrackId);

                // Remove from device
                mtp_device.Remove (mtp_track);

                // Remove track from album, and remove album from device if it no longer has tracks
                string key = MakeAlbumKey (track.ArtistName, track.AlbumTitle);
                if (album_cache.ContainsKey (key)) {
                    Album album = album_cache[key];
                    album.RemoveTrack (mtp_track);
                    if (album.Count == 0) {
                        album.Remove ();
                        album_cache.Remove (key);
                    }
                }

                return true;
            }
        }