From c5de56c4fdf512802d4bebdc6b2e3f535af67322 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Mon, 16 Sep 2013 17:25:41 -0700 Subject: [PATCH] filter wide integers (closes #348) --- beets/library.py | 7 ++++++- docs/changelog.rst | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/beets/library.py b/beets/library.py index ac101c33c..9b1055793 100644 --- a/beets/library.py +++ b/beets/library.py @@ -471,7 +471,12 @@ class Item(LibModel): traceback.format_exc()) for key in ITEM_KEYS_META: - setattr(self, key, getattr(f, key)) + value = getattr(f, key) + if isinstance(value, (int, long)) and value.bit_length() > 63: + # Filter values wider than 64 bits (in signed + # representation). SQLite cannot store them. + value = 0 + setattr(self, key, value) # Database's mtime should now reflect the on-disk value. if read_path == self.path: diff --git a/docs/changelog.rst b/docs/changelog.rst index f4edd00a5..c5b5f3dd1 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -22,6 +22,9 @@ And some fixes: directory. * :doc:`/plugins/echonest_tempo`: Fix an issue where the plugin could use the tempo from the wrong song when the API did not contain the requested song. +* Fix a crash when a file's metadata included a very large number (one wider + than 64 bits). These huge numbers are now replaced with zeroes in the + database. .. _Opus: http://www.opus-codec.org/