From 0975ee709b4924604a317690a01050151b0c8608 Mon Sep 17 00:00:00 2001 From: inytar Date: Mon, 2 Jan 2017 14:05:17 -0500 Subject: [PATCH 1/5] Absubmit fix failing to load distutils.spawn --- beetsplug/absubmit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beetsplug/absubmit.py b/beetsplug/absubmit.py index ae3717470..95f3342ac 100644 --- a/beetsplug/absubmit.py +++ b/beetsplug/absubmit.py @@ -24,7 +24,7 @@ import os import subprocess import tempfile -import distutils +from distutils import spawn import requests from beets import plugins @@ -81,7 +81,7 @@ class AcousticBrainzSubmitPlugin(plugins.BeetsPlugin): pass # Get the executable location on the system, # needed to calculate the sha1 hash. - self.extractor = distutils.spawn.find_executable(self.extractor) + self.extractor = spawn.find_executable(self.extractor) # Calculate extractor hash. self.extractor_sha = hashlib.sha1() From a5aee3f677acf33dcea4825e3971fd7c422edcec Mon Sep 17 00:00:00 2001 From: inytar Date: Mon, 2 Jan 2017 14:05:59 -0500 Subject: [PATCH 2/5] Absubmit close temporary file Fix error when deleting the file under Windows --- beetsplug/absubmit.py | 1 + 1 file changed, 1 insertion(+) diff --git a/beetsplug/absubmit.py b/beetsplug/absubmit.py index 95f3342ac..646f0fb84 100644 --- a/beetsplug/absubmit.py +++ b/beetsplug/absubmit.py @@ -131,6 +131,7 @@ class AcousticBrainzSubmitPlugin(plugins.BeetsPlugin): tmp_file, filename = tempfile.mkstemp(suffix='.json') try: # Close the file, so the extractor can overwrite it. + os.close(tmp_file) try: call([self.extractor, util.syspath(item.path), filename]) except ABSubmitError as e: From 71aab6d7432fe18a5f2b4765aad79aea23b6f1e2 Mon Sep 17 00:00:00 2001 From: inytar Date: Thu, 16 Mar 2017 11:19:13 -0400 Subject: [PATCH 3/5] Remove check for supported formats in absubmit Also lower the logging to warning if the extractor fails to analyse a file --- beetsplug/absubmit.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/beetsplug/absubmit.py b/beetsplug/absubmit.py index e30fe21fa..e935324f3 100644 --- a/beetsplug/absubmit.py +++ b/beetsplug/absubmit.py @@ -90,10 +90,6 @@ class AcousticBrainzSubmitPlugin(plugins.BeetsPlugin): self.extractor_sha.update(extractor.read()) self.extractor_sha = self.extractor_sha.hexdigest() - supported_formats = {'mp3', 'ogg', 'oga', 'flac', 'mp4', 'm4a', 'm4r', - 'm4b', 'm4p', 'aac', 'wma', 'asf', 'mpc', 'wv', - 'spx', 'tta', '3g2', 'aif', 'aiff', 'ape'} - base_url = 'https://acousticbrainz.org/api/v1/{mbid}/low-level' def commands(self): @@ -119,11 +115,6 @@ class AcousticBrainzSubmitPlugin(plugins.BeetsPlugin): self._log.info(u'Not analysing {}, missing ' u'musicbrainz track id.', item) return None - # If file format is not supported skip it. - if item['format'].lower() not in self.supported_formats: - self._log.info(u'Not analysing {}, file not in ' - u'supported format.', item) - return None # Temporary file to save extractor output to, extractor only works # if an output file is given. Here we use a temporary file to copy @@ -136,7 +127,7 @@ class AcousticBrainzSubmitPlugin(plugins.BeetsPlugin): try: call([self.extractor, util.syspath(item.path), filename]) except ABSubmitError as e: - self._log.error( + self._log.warning( u'Failed to analyse {item} for AcousticBrainz: {error}', item=item, error=e ) From ba78feb9f86fb064da64bb6fb91401bcd4f1e5ff Mon Sep 17 00:00:00 2001 From: inytar Date: Thu, 16 Mar 2017 11:20:21 -0400 Subject: [PATCH 4/5] Fix a typo in the absubmit documentation --- docs/plugins/absubmit.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/plugins/absubmit.rst b/docs/plugins/absubmit.rst index 665133c64..feebc1642 100644 --- a/docs/plugins/absubmit.rst +++ b/docs/plugins/absubmit.rst @@ -9,7 +9,7 @@ Installation The `absubmit` plugin requires the `streaming_extractor_music`_ program to run. Its source can be found on `GitHub`_, and while it is possible to compile the extractor from source, AcousticBrainz would prefer if you used their binary (see the AcousticBrainz `FAQ`_). -The `absubmit` also plugin requires `requests`_, which you can install using `pip_` by typing:: +The `absubmit` also plugin requires `requests`_, which you can install using `pip`_ by typing:: pip install requests From 0342f730de1bfe6384225d5441098e3b684238f2 Mon Sep 17 00:00:00 2001 From: inytar Date: Fri, 17 Mar 2017 14:22:36 -0400 Subject: [PATCH 5/5] Update changelog --- docs/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index cb2934874..2df928eba 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -43,6 +43,7 @@ New features: Fixes: +* :doc:`/plugins/absubmit`: Do not filter for supported formats. :bug:`2471` * :doc:`/plugins/mpdupdate`: Fix Python 3 compatibility. :bug:`2381` * :doc:`/plugins/replaygain`: Fix Python 3 compatibility in the ``bs1770gain`` backend. :bug:`2382`