]> kaliko git repositories - mpd-sima.git/blob - sima/plugins/internal/history.py
Allow choosing internal plugins from config file
[mpd-sima.git] / sima / plugins / internal / history.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 management
15     """
16     def __init__(self, daemon):
17         Plugin.__init__(self, daemon)
18         self.sdb = daemon.sdb
19
20     def shutdown(self):
21         self.log.info('Cleaning database')
22         self.sdb.purge_history()
23         self.sdb.clean_database()
24
25     def callback_next_song(self):
26         current = self.player.current
27         self.log.debug('add history: "{}"'.format(current))
28         self.sdb.add_history(current)
29
30
31 # VIM MODLINE
32 # vim: ai ts=4 sw=4 sts=4 expandtab