X-Git-Url: https://git.kaliko.me/?a=blobdiff_plain;f=sima%2Fplugins%2Fcore%2Fhistory.py;fp=sima%2Fplugins%2Fcore%2Fhistory.py;h=67414a845f2a756e5f0314f9c1aee5be7b3891a8;hb=39becab4a5cf591b1833e875c06793d97ac78659;hp=0000000000000000000000000000000000000000;hpb=8ea8cbdbdbdbc578267ba80778c9a5673cd07675;p=mpd-sima.git diff --git a/sima/plugins/core/history.py b/sima/plugins/core/history.py new file mode 100644 index 0000000..67414a8 --- /dev/null +++ b/sima/plugins/core/history.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +"""Add playing tracks to history +""" + +# standard library import + +# third parties components + +# local import +from ...lib.plugin import Plugin + +class History(Plugin): + """ + History management + """ + def __init__(self, daemon): + Plugin.__init__(self, daemon) + self.sdb = daemon.sdb + + def shutdown(self): + self.log.info('Cleaning database') + self.sdb.purge_history() + self.sdb.clean_database() + + def callback_next_song(self): + current = self.player.current + self.log.debug('add history: "{}"'.format(current)) + self.sdb.add_history(current) + + +# VIM MODLINE +# vim: ai ts=4 sw=4 sts=4 expandtab