prosolis / music

Complete suite of tools necessary to run a 24/7 channel on multiple popular livestreaming platforms
1 stars 2 forks source link

Improve usage with mpd_proxy execption handling #46

Open camcast3 opened 1 year ago

camcast3 commented 1 year ago

  File "/home/prosolis/music/bots/mpd_bot.py", line 109, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/prosolis/music/bots/mpd_bot.py", line 50, in main
    await mpd.mpd_dump_album_art(metadata_folderpath)
  File "/home/prosolis/music/bots/helpers/musicplayer/mpdproxy.py", line 98, in mpd_dump_album_art
    album_art_dictionary = self._client.albumart(self._client.currentsong()['file'])
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/prosolis/music/prosobot/lib/python3.11/site-packages/mpd/base.py", line 851, in <lambda>
    method = lambda self, *args: callback(self, cls._execute_binary(self, name, args))
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/prosolis/music/prosobot/lib/python3.11/site-packages/mpd/base.py", line 665, in _execute_binary
    metadata = self._read_binary()
               ^^^^^^^^^^^^^^^^^^^
  File "/home/prosolis/music/prosobot/lib/python3.11/site-packages/mpd/base.py", line 622, in _read_binary
    line = self._read_line()
           ^^^^^^^^^^^^^^^^^
  File "/home/prosolis/music/prosobot/lib/python3.11/site-packages/mpd/base.py", line 584, in _read_line
    raise CommandError(error)
mpd.base.CommandError: [50@0] {albumart} No file exists```

We shouldn't go down when this has been triggered
camcast3 commented 1 year ago

We should wrap interactions with mpd with a try and catch so we don't crash like this again