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