~ubuntu-branches/debian/squeeze/gnome-do-plugins/squeeze

« back to all changes in this revision

Viewing changes to Exaile/src/MusicItems.cs

  • Committer: Bazaar Package Importer
  • Author(s): Christopher James Halse Rogers
  • Date: 2009-06-27 16:11:49 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090627161149-b74nc297di2842u1
* New upstream release
  + Pidgin plugin now supports initial text for messages (LP: #338608)
  + Pidgin plugin opens conversations on the correct IM network (LP: #370965)
* debian/rules:
  + Update get-orig-source target.  Upstream no longer ships gdata* binaries,
    so we no longer need to strip them
* debian/patches/00_use_system_gdata
  + Drop.  Upstream now builds against system libgdata.
* debian/patches/04_fix_pidgin_dbus_ints
* debian/patches/10_fix_rhythmbox_file
* debian/patches/15_twitter_api
* debian/patches/20_twitter_overflow:
  + Drop.  Included upstream.
* debian/patches/01_firefox_iceweasel_rename:
  + Refresh for new version
* debian/patches/02_fix_banshee_plugin:
  + Drop refernce to /usr/lib/banshee-1/Banshee.CollectionIndexer.dll.
    This is unnecessary, and causes errors when Banshee isn't installed.
* debian/patches/00_debian_default_plugins:
  + Enable a bunch of useful plugins that do not require configuration from 
    the "Official" plugin set by default.  Makes Do more useful out of the 
    box.
* debian/control:
  + Bump versioned build-dep on gnome-do to 0.8.2
  + Split out gnome-do-plugin-evolution package, now that this is possible.
    libevolution5.0-cil has an annoyingly large dependency stack.
    (LP: #351535) (Closes: #524993).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//  MusicItems.cs
 
2
//
 
3
//  GNOME Do is the legal property of its developers, whose names are too
 
4
//  numerous to list here.  Please refer to the COPYRIGHT file distributed with
 
5
//  this source distribution.
 
6
//
 
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.
 
11
//
 
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.
 
16
//
 
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/>.
 
19
 
 
20
using System;
 
21
using System.Collections.Generic;
 
22
 
 
23
using Mono.Addins;
 
24
 
 
25
using Do.Universe;
 
26
 
 
27
namespace Exaile
 
28
{
 
29
 
 
30
        public abstract class MusicItem : Item
 
31
        {
 
32
                protected string name, artist, year, cover;
 
33
 
 
34
                public MusicItem ()
 
35
                {
 
36
                }
 
37
 
 
38
                public MusicItem (string name, string artist, string year, string cover):
 
39
                        this ()
 
40
                {
 
41
                        this.name = name;
 
42
                        this.artist = artist;
 
43
                        this.year = year;
 
44
                        this.cover = cover;
 
45
                }
 
46
 
 
47
                public override string Name { get { return name; } }
 
48
                public override string Description { get { return artist; } }
 
49
                public override string Icon { get { return Cover ?? "gtk-cdrom"; } }
 
50
 
 
51
                public virtual string Artist { get { return artist; } }
 
52
                public virtual string Year { get { return year; } }
 
53
                public virtual string Cover { get { return cover; } }
 
54
 
 
55
        }
 
56
 
 
57
        public class AlbumMusicItem : MusicItem
 
58
        {
 
59
                public AlbumMusicItem (string name, string artist, string year, string cover):
 
60
                        base (name, artist, year, cover)
 
61
                {
 
62
                }
 
63
        }
 
64
 
 
65
        public class ArtistMusicItem : MusicItem
 
66
        {
 
67
                public ArtistMusicItem (string artist, string cover):
 
68
                        base ()
 
69
                {
 
70
                        this.artist = this.name = artist;
 
71
                        this.cover = cover;
 
72
                }
 
73
 
 
74
                public override string Description
 
75
                {
 
76
                        get {
 
77
                                return string.Format (AddinManager.CurrentLocalizer.GetString ("All music by") + " {0}", artist);
 
78
                        }
 
79
                }
 
80
        }
 
81
 
 
82
        public class SongMusicItem : MusicItem, IComparable<SongMusicItem>
 
83
        {
 
84
                string file, album;
 
85
                int track;
 
86
 
 
87
                public SongMusicItem (string name, string artist, string album, string year, string cover, string file, int track):
 
88
                        base (name, artist, year, cover)
 
89
                {
 
90
                        this.file = file;
 
91
                        this.album = album;
 
92
                        this.track = track;
 
93
                }
 
94
 
 
95
                public override string Icon { get { return "gnome-mime-audio"; } }
 
96
                public override string Description
 
97
                {
 
98
                        get {
 
99
                                return string.Format ("{0} - {1}", artist, album);
 
100
                        }
 
101
                }
 
102
 
 
103
                public virtual string File { get { return file; } }
 
104
                public virtual string Album { get { return album; } }
 
105
                public virtual int Track { get { return track; } }
 
106
                
 
107
                public int CompareTo (SongMusicItem other)
 
108
                {
 
109
                        if (album.CompareTo (other.Album) == 0)
 
110
                                return track - other.Track;
 
111
                        return album.CompareTo (other.Album);
 
112
                }
 
113
        }
 
114
}