]> kaliko git repositories - mpd-sima.git/blob - sima/lib/player.py
751e464ba7a3c551aabf3ff0dd2c974028fb3e82
[mpd-sima.git] / sima / lib / player.py
1 # -*- coding: utf-8 -*-
2
3 # TODO:
4 # Add decorator to filter through history?
5
6 # standard library import
7 import logging
8
9 # local import
10 #from sima.lib.track import Track
11
12
13 class Player(object):
14
15     """Player interface to inherit from.
16
17     When querying player music library for tracks, Player instance *must* return
18     Track objects (usually a list of them)
19
20     Player instance should expose the following immutable attributes:
21         * artists
22         * state
23         * current
24         * queue
25         * playlist
26         *
27     """
28
29     def __init__(self):
30         super().__init__()
31         self.log = logging.getLogger('sima')
32
33     def monitor(self):
34         """Monitor player for change
35         Returns :
36             * database  player media library has changed
37             * playlist  playlist modified
38             * options   player options changed: repeat mode, etc…
39             * player    player state changed: paused, stopped, skip track…
40         """
41         raise NotImplementedError
42
43     def remove(self, position=0):
44         """Removes the oldest element of the playlist (index 0)
45         """
46         raise NotImplementedError
47
48     def find_track(self, artist, title=None):
49         """
50         Find tracks for a specific artist or filtering with a track title
51             >>> player.find_track('The Beatles')
52             >>> player.find_track('Nirvana', title='Smells Like Teen Spirit')
53
54         Returns a list of Track objects
55         """
56         raise NotImplementedError
57
58     def find_album(self, artist, album):
59         """
60         Find tracks by track's album name
61             >>> player.find_album('Nirvana', 'Nevermind')
62
63         Returns a list of Track objects
64         """
65         raise NotImplementedError
66
67     def find_albums(self, artist):
68         """
69         Find albums by artist's name
70             >>> player.find_alums('Nirvana')
71
72         Returns a list of string objects
73         """
74         raise NotImplementedError
75
76     def fuzzy_find_artist(self, artist):
77         """
78         Find artists based on a fuzzy search in the media library
79             >>> bea = player.fuzzy_find_artist('beatles')
80             >>> print(bea)
81             >>> ['The Beatles']
82
83         Returns a list of strings (artist names)
84         """
85         raise NotImplementedError
86
87     def disconnect(self):
88         """Closing client connection with the Player
89         """
90         raise NotImplementedError
91
92     def connect(self):
93         """Connect client to the Player
94         """
95         raise NotImplementedError
96
97 # VIM MODLINE
98 # vim: ai ts=4 sw=4 sts=4 expandtab