from logging import getLogger
from .mpdclient import MPD as PlayerClient
-from .mpdclient import PlayerError, MPDError
+from .mpdclient import PlayerError
from .lib.simadb import SimaDB
from .lib.daemon import Daemon
from .utils.utils import SigHup
except PlayerError as err:
self.log.debug(err)
continue
- except MPDError as err:
+ except PlayerError as err:
#TODO: unhandled Player exceptions
self.log.warning('Unhandled player exception: %s', err)
self.log.info('Got reconnected')
self.log.info('Connecting MPD: %(host)s:%(port)s', self.config['MPD'])
self.player.connect()
self.foreach_plugin('start')
- except (PlayerError, MPDError) as err:
+ except PlayerError as err:
self.log.warning('Player: %s', err)
self.reconnect_player()
while 42:
try:
self.loop()
- except (PlayerError, MPDError) as err:
+ except PlayerError as err:
self.log.warning('Player error: %s', err)
self.reconnect_player()
del self.changed
from logging import getLogger
# external module
-from musicpd import MPDClient, MPDError
+from musicpd import MPDClient, MPDError as PlayerError
# local import
from .utils.leven import levenshtein_ratio
-class PlayerError(MPDError):
- """Fatal error in the player."""
-
-
# Some decorators
def bl_artist(func):
def wrapper(*args, **kwargs):
try:
super().connect(host, port)
# Catch socket errors
- except IOError as err:
+ except OSError as err:
raise PlayerError('Could not connect to "%s:%s": %s' %
(host, port, err.strerror))
# Catch all other possible errors
# ConnectionError and ProtocolError are always fatal. Others may not
# be, but we don't know how to handle them here, so treat them as if
# they are instead of ignoring them.
- except MPDError as err:
+ except PlayerError as err:
raise PlayerError('Could not connect to "%s:%s": %s' %
(host, port, err))
if password:
try:
self.password(password)
- except (MPDError, IOError) as err:
+ except (PlayerError, OSError) as err:
raise PlayerError("Could not connect to '%s': %s" % (host, err))
# Controls we have sufficient rights
available_cmd = self.commands()
curr = self.current
try:
ret = self.idle('database', 'playlist', 'player', 'options')
- except (MPDError, IOError) as err:
+ except (PlayerError, OSError) as err:
raise PlayerError("Couldn't init idle: %s" % err)
if self._skipped_track(curr):
ret.append('skipped')
import sys
# local import
-from ..mpdclient import MPD, MPDError, Artist, Album
+from ..mpdclient import MPD, PlayerError, Artist, Album
from ..lib.simadb import SimaDB
return
try:
getattr(self, cmd.replace('-', '_'))()
- except MPDError as err:
+ except PlayerError as err:
self.log.error(err)
sys.exit(1)
from logging import getLogger
from ..mpdclient import MPD
-from ..mpdclient import MPDError, PlayerError
+from ..mpdclient import PlayerError
from ..plugins.internal.tags import forge_filter, control_config
try:
# Use window to limit reponse size
res = cli.find(filt, 'window', (0, 300))
- except MPDError as err:
+ except PlayerError as err:
cli.disconnect()
print('filter error: %s' % err, file=sys.stderr)
sys.exit(1)