#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# Copyright (c) 2009, 2010 Efrim <efrim@azylum.org> {{{
+# Copyright (c) 2009, 2010 Efrim <efrim@azylum.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-# }}}
"""
DOC:
'usage': USAGE,
})
- def __init__(self):#{{{
+ def __init__(self):
""""""
StartOpt.__init__(self, self.__class__.script_info, [])
MPDClass.__init__(self)
self.tempo = int(10)
self.volum = None
self._consume_args()
- self._run()#}}}
+ self._run()
- def _consume_args(self):#{{{
+ def _consume_args(self):
""""""
if (len(self.cli_args) < 1 or
len(self.cli_args) > 2):
except IndexError:
pass
except ValueError, err:
- self.parser.error('wrong option passed (%s)' % err)#}}}
+ self.parser.error('wrong option passed (%s)' % err)
- def _run(self):#{{{
+ def _run(self):
""""""
self.mpdConnect()
self.mpd_state = str(self.client.status().get('state'))
self.mpd_vol = 0
self.client.play()
self.fade()
- sleep(1)#}}}
+ sleep(1)
- def fade(self):#{{{
+ def fade(self):
""""""
# TODO: handle possible lost connections
span = float(self.volum - self.mpd_vol)
if abs(vol - self.volum) < 1:
self.client.setvol(self.volum)
return True
- sleep(1)#}}}
+ sleep(1)
# Script starts here