]> kaliko git repositories - mpd-sima.git/blob - sima/lib/player.py
Add lastfm/album mode
[mpd-sima.git] / sima / lib / player.py
1 # -*- coding: utf-8 -*-
2
3 # TODO:
4 # Add decorator to filter through history?
5
6 # standart 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
21     def __init__(self):
22         super().__init__()
23         self.log = logging.getLogger('sima')
24
25     def monitor(self):
26         """Monitor player for change
27         Returns :
28             * database  player media library has changed
29             * playlist  playlist modified
30             * options   player options changed: repeat mode, etc…
31             * player    player state changed: paused, stopped, skip track…
32         """
33         raise NotImplementedError
34
35     def remove(self, position=0):
36         """Removes the oldest element of the playlist (index 0)
37         """
38         raise NotImplementedError
39
40     def find_track(self, artist, title=None):
41         """
42         Find tracks for a specific artist or filtering with a track title
43             >>> player.find_track('The Beatles')
44             >>> player.find_track('Nirvana', title='Smells Like Teen Spirit')
45
46         Returns a list of Track objects
47         """
48         raise NotImplementedError
49
50     def find_album(self, artist, album):
51         """
52         Find tracks by track's album name
53             >>> player.find_album('Nirvana', 'Nevermind')
54
55         Returns a list of Track objects
56         """
57         raise NotImplementedError
58
59     def find_albums(self, artist):
60         """
61         Find albums by artist's name
62             >>> player.find_alums('Nirvana')
63
64         Returns a list of string objects
65         """
66         raise NotImplementedError
67
68     def fuzzy_find(self, artist):
69         """
70         Find artists based on a fuzzy search in the media library
71             >>> bea = player.fuzzy_find('beatles')
72             >>> print(bea)
73             >>> ['The Beatles']
74
75         Returns a list of strings (artist names)
76         """
77         raise NotImplementedError
78
79     def disconnect(self):
80         """Closing client connection with the Player
81         """
82         raise NotImplementedError
83
84     def connect(self):
85         """Connect client to the Player
86         """
87         raise NotImplementedError
88
89 # VIM MODLINE
90 # vim: ai ts=4 sw=4 sts=4 expandtab