3
// GNOME Do is the legal property of its developers, whose names are too numerous
4
// to list here. Please refer to the COPYRIGHT file distributed with this
5
// source distribution.
7
// This program is free software: you can redistribute it and/or modify
8
// it under the terms of the GNU General Public License as published by
9
// the Free Software Foundation, either version 3 of the License, or
10
// (at your option) any later version.
12
// This program is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
17
// You should have received a copy of the GNU General Public License
18
// along with this program. If not, see <http://www.gnu.org/licenses/>.
21
using System.Collections.Generic;
26
namespace Do.Addins.xmms2
29
public abstract class MusicItem : Item
31
protected string name, artist, cover;
37
public MusicItem (string name, string artist,string cover):
45
public override string Name { get { return name; } }
46
public override string Description { get { return artist; } }
47
public override string Icon { get { return Cover ?? "gtk-cdrom"; } }
49
public virtual string Artist { get { return artist; } }
50
public virtual string Cover { get { return cover; } }
54
public class AlbumMusicItem : MusicItem
56
public AlbumMusicItem (string name, string artist, string cover):
57
base (name, artist, cover)
62
public class ArtistMusicItem : MusicItem
64
public ArtistMusicItem (string artist, string cover):
67
this.artist = this.name = artist;
71
public override string Description
74
return string.Format ("All music by {0}", artist);
79
public class SongMusicItem : MusicItem, IComparable
84
public SongMusicItem (int id, string artist, string album, string name):
85
base (name, artist, null)
91
public override string Icon { get { return "gnome-mime-audio"; } }
92
public override string Description
95
return string.Format ("{0} - {1}", artist, album);
99
public virtual string Album { get { return album; } }
100
public virtual int Id { get { return id; } }
102
public int CompareTo (object o)
104
SongMusicItem other = o as SongMusicItem;
105
if (album.CompareTo (other.Album) == 0)
106
return id - other.Id;
107
return album.CompareTo (other.Album);