~moovida-developers/moovida/widget_demo

« back to all changes in this revision

Viewing changes to elisa-plugins/elisa/plugins/base/models/audio.py

  • Committer: Guido Amoruso
  • Date: 2008-06-27 10:01:54 UTC
  • mfrom: (59.8.290 upicek)
  • Revision ID: guidonte@fluendo.com-20080627100154-xq7jqpj6y6qyhy4g
MergedĀ fromĀ upicek.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
# agreement from Fluendo.
14
14
# See "LICENSE.Elisa" in the root directory of this distribution package
15
15
# for details on that license.
 
16
#
 
17
# Authors: Benjamin Kampmann <benjamin@fluendo.com>
 
18
#          Olivier Tilloy <olivier@fluendo.com>
 
19
#          Philippe Normand <philippe@fluendo.com>
 
20
 
 
21
"""
 
22
Common models related to audio.
 
23
"""
16
24
 
17
25
from elisa.core.components.model import Model
18
26
 
19
 
class AudioAlbumModel(Model):
 
27
 
 
28
class AlbumModel(Model):
 
29
 
20
30
    """
 
31
    Representation of an audio album.
 
32
 
21
33
    An audio album model may contain metadata associated to an audio album,
22
34
    such as the name of the artist, name of the album, list of the tracks,
23
35
    etc...
24
36
 
25
 
    @ivar artist: the name of the artist
26
 
    @type artist: C{unicode}
27
 
    @ivar album:  the name of the audio album
28
 
    @type album:  C{unicode}
29
 
    @ivar tracks: a list of the names of the audio tracks on the audio album
30
 
    @type tracks: C{list} of C{unicode}
31
 
    """
32
 
    pass
 
37
    @ivar artist:         the name of the artist
 
38
    @type artist:         C{unicode}
 
39
    @ivar album:          the name of the audio album
 
40
    @type album:          C{unicode}
 
41
    @ivar musicbrainz_id: a unique id to request more information from
 
42
                          musicbrainz.org
 
43
    @type musicbrainz_id: C{unicode}
 
44
    @ivar cover:          the cover art for the album
 
45
    @type cover:          L{elisa.plugins.base.models.image.ImageModel}
 
46
    @ivar tracks:         the list of tracks on the album
 
47
    @type tracks:         C{list} of
 
48
                          L{elisa.plugins.base.models.audio.TrackModel}
 
49
    """
 
50
 
 
51
    def __init__(self):
 
52
        """
 
53
        Constructor. Initialize all the fields.
 
54
        """
 
55
        super(AlbumModel, self).__init__()
 
56
        self.artist = None
 
57
        self.album = None
 
58
        self.musicbrainz_id = None
 
59
        self.cover = None
 
60
        self.tracks = []
 
61
 
 
62
 
 
63
class TrackModel(Model):
 
64
 
 
65
    """
 
66
    Representation of an audio track on an album.
 
67
 
 
68
    @ivar title:        the title of the track
 
69
    @type title:        C{unicode}
 
70
    @ivar artist:       the name of the artist of the track
 
71
    @type artist:       C{unicode}
 
72
    @ivar duration:     the duration of the track (in seconds)
 
73
    @type duration:     C{int}
 
74
    @ivar track_number: the number of the track on the album
 
75
    @type track_number: C{int}
 
76
    @ivar playable_uri: the URI to query the resource provider with to get a
 
77
                        playable model containing the real URI of the audio
 
78
                        file
 
79
    @type playable_uri: L{elisa.core.media_uri.MediaUri}
 
80
    """
 
81
 
 
82
    def __init__(self):
 
83
        super(TrackModel, self).__init__()
 
84
        self.title = None
 
85
        self.artist = None
 
86
        self.duration = None
 
87
        self.track_number = None
 
88
        self.playable_uri = None
 
89
 
 
90
 
 
91
class ArtistModel(Model):
 
92
 
 
93
    """
 
94
    Representation of an artist.
 
95
 
 
96
    @ivar name:           name of the artist
 
97
    @type name:           C{unicode}
 
98
    @ivar musicbrainz_id: a unique id to request more information from
 
99
                          musicbrainz.org
 
100
    @type musicbrainz_id: C{unicode}
 
101
    @ivar images:         visual representations of the artist
 
102
    @type images:         C{list} of
 
103
                          {elisa.plugins.base.models.image.ImageModel}
 
104
    """
 
105
 
 
106
    def __init__(self):
 
107
        super(ArtistModel, self).__init__()
 
108
        self.name = None
 
109
        self.musicbrainz_id = None
 
110
        self.images = []