diff --git a/beetsplug/replaygain.py b/beetsplug/replaygain.py index d2cd7421f..5d982a35d 100644 --- a/beetsplug/replaygain.py +++ b/beetsplug/replaygain.py @@ -134,6 +134,9 @@ class Bs1770gainBackend(Backend): return AlbumGain(output[-1], output[:-1]) def isplitter(self, items, chunk_at): + """Break an iterable into chunks of at most size `chunk_at`, + generating lists for each chunk. + """ iterable = iter(items) while True: result = [] @@ -163,14 +166,17 @@ class Bs1770gainBackend(Backend): albumpeaktot = 0.0 returnchunks = [] + # In the case of very large sets of music, we break the tracks + # into smaller chunks and process them one at a time. This + # avoids running out of memory. if len(items) > self.chunk_at: i = 0 for chunk in self.isplitter(items, self.chunk_at): - i += 1 - returnchunk = self.compute_chunk_gain(chunk, is_album) - albumgaintot += returnchunk[-1].gain - albumpeaktot += returnchunk[-1].peak - returnchunks = returnchunks + returnchunk[0:-1] + i += 1 + returnchunk = self.compute_chunk_gain(chunk, is_album) + albumgaintot += returnchunk[-1].gain + albumpeaktot += returnchunk[-1].peak + returnchunks = returnchunks + returnchunk[0:-1] returnchunks.append(Gain(albumgaintot / i, albumpeaktot / i)) return returnchunks else: diff --git a/docs/plugins/replaygain.rst b/docs/plugins/replaygain.rst index 101997bd6..968e996e6 100644 --- a/docs/plugins/replaygain.rst +++ b/docs/plugins/replaygain.rst @@ -78,11 +78,9 @@ On OS X, most of the dependencies can be installed with `Homebrew`_:: bs1770gain `````````` -In order to use this backend, you will need to install the bs1770gain command-line tool. -Here are some hints: - -* goto `bs1770gain`_ and follow the download instructions -* make sure it is in your $PATH +To use this backend, you will need to install the `bs1770gain`_ command-line +tool. Follow the instructions at the `bs1770gain`_ Web site and ensure that +the tool is on your ``$PATH``. .. _bs1770gain: http://bs1770gain.sourceforge.net/ @@ -92,14 +90,9 @@ backend in your configuration file:: replaygain: backend: bs1770gain -IMPORTANT for windows users: -Untill bs1770gain accepts very long Paths, you will get problems if your -Pathname exceeds the windows-limit. -AND to avoid other problems with paths...untill further notice ...please use - -asciify_paths: true - -in your config. +For Windows users: the tool currently has issues with long and non-ASCII path +names. You may want to use the :ref:`asciify-paths` configuration option until +this is resolved. Configuration -------------