]> kaliko git repositories - mpd-sima.git/blob - sima/plugins/addhist.py
Add handling of external plugins
[mpd-sima.git] / sima / plugins / addhist.py
1 # -*- coding: utf-8 -*-
2 """Add playing tracks to history
3 """
4
5 # standard library import
6
7 # third parties components
8
9 # local import
10 from ..lib.plugin import Plugin
11
12 class History(Plugin):
13     """
14     History
15     """
16     def __init__(self, daemon):
17         Plugin.__init__(self, daemon)
18         self.sdb = daemon.sdb
19         self.player = daemon.player
20
21     def shutdown(self):
22         self.log.info('Cleaning database')
23         self.sdb.purge_history()
24         self.sdb.clean_database()
25
26     def callback_next_song(self):
27         current = self.player.current
28         self.log.debug('add history: "{}"'.format(current))
29         self.sdb.add_history(current)
30
31
32 # VIM MODLINE
33 # vim: ai ts=4 sw=4 sts=4 expandtab