Fix #1806: handle OSError in stats -e

This commit is contained in:
Adrian Sampson 2016-01-11 10:13:26 -08:00
parent d4e11f0af9
commit 231981de0c
2 changed files with 6 additions and 1 deletions

View file

@ -1232,7 +1232,10 @@ def show_stats(lib, query, exact):
for item in items:
if exact:
total_size += os.path.getsize(item.path)
try:
total_size += os.path.getsize(item.path)
except OSError as exc:
log.info('could not get size of {}: {}', item.path, exc)
else:
total_size += int(item.length * item.bitrate / 8)
total_time += item.length

View file

@ -45,6 +45,8 @@ Fixes:
* :doc:`/plugins/lyrics`: The Genius backend has been re-enabled.
* :doc:`/plugins/edit`: Editing metadata now moves files, when appropriate
(like the :ref:`modify-cmd` command). :bug:`1804`
* The :ref:`stats-cmd` command no longer crashes when files are missing or
inaccessible. :bug:`1806`
.. _beets.io: http://beets.io/
.. _Beetbox: https://github.com/beetbox