From 9c93b4d35652c2b0aa90f1d5b1cc67bfeebb88ef Mon Sep 17 00:00:00 2001 From: Jef LeCompte Date: Wed, 27 May 2020 16:36:27 -0400 Subject: [PATCH 1/3] docs: update punctuation Co-authored-by: Adrian Sampson --- .github/workflows/ci.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f38ce898e..5c736e1ba 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,7 +11,7 @@ jobs: NOSE_SHOW_SKIPPED: 1 steps: - uses: actions/checkout@v2 - - name: Set up python 2.7 + - name: Set up Python 2.7 uses: actions/setup-python@v2 with: python-version: 2.7 @@ -46,7 +46,7 @@ jobs: NOSE_SHOW_SKIPPED: 1 steps: - uses: actions/checkout@v2 - - name: Set up python 3.${{ matrix.python-version }} + - name: Set up Python 3.${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: 3.${{ matrix.python-version }} @@ -81,7 +81,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Set up Python to build docs with sphinx + - name: Set up Python to build docs with Sphinx uses: actions/setup-python@v2 with: python-version: 2.7 @@ -90,4 +90,4 @@ jobs: python -m pip install --upgrade pip python -m pip install tox sphinx - name: Build and check docs using tox - run: tox -e docs \ No newline at end of file + run: tox -e docs From d3b759d7ca874695a04e13d4b49e1957515acd26 Mon Sep 17 00:00:00 2001 From: ybnd Date: Fri, 29 May 2020 13:29:31 +0200 Subject: [PATCH 2/3] Fix `list -af` example in documentation Didn't work since $tracktotal is not an Album field --- docs/reference/cli.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/cli.rst b/docs/reference/cli.rst index b66920d96..724afc80a 100644 --- a/docs/reference/cli.rst +++ b/docs/reference/cli.rst @@ -212,7 +212,7 @@ The ``-p`` option makes beets print out filenames of matched items, which might be useful for piping into other Unix commands (such as `xargs`_). Similarly, the ``-f`` option lets you specify a specific format with which to print every album or track. This uses the same template syntax as beets' :doc:`path formats -`. For example, the command ``beet ls -af '$album: $tracktotal' +`. For example, the command ``beet ls -af '$album: $albumtotal' beatles`` prints out the number of tracks on each Beatles album. In Unix shells, remember to enclose the template argument in single quotes to avoid environment variable expansion. From c69e96432a4bf9a82d683f7d8885aabb54fe39df Mon Sep 17 00:00:00 2001 From: "Emilio G. Cota" Date: Sun, 31 May 2020 00:10:32 -0400 Subject: [PATCH 3/3] importer: use tarfile.open to handle compressed archives Call tarfile.open instead of tarfile.TarFile from the importer so that we can import compressed tar archives. Note that tarfile.TarFile does not handle compressed archives: $ python3 Python 3.8.2 (default, Apr 27 2020, 15:53:34) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import tarfile >>> tf = tarfile.TarFile("Lagrimas.tar.bz2") Traceback (most recent call last): [...] tarfile.ReadError: invalid header >>> But tarfile.open does deal with them: $ python3 Python 3.8.2 (default, Apr 27 2020, 15:53:34) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import tarfile >>> tf = tarfile.open("Lagrimas.tar.bz2") >>> Tested: $ ls Lagrimas/*.mp3 | wc -l 11 $ tar cjf Lagrimas.tar.bz2 Lagrimas/ - Before: $ beet import Lagrimas.tar.bz2 extraction failed: invalid header No files imported from /tmp/Lagrimas.tar.bz2 - After: $ beet import Lagrimas.tar.bz2 [works] Fixes #3606. --- beets/importer.py | 4 ++-- docs/changelog.rst | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/beets/importer.py b/beets/importer.py index e97b0a75c..68d5f3d5d 100644 --- a/beets/importer.py +++ b/beets/importer.py @@ -1034,8 +1034,8 @@ class ArchiveImportTask(SentinelImportTask): cls._handlers = [] from zipfile import is_zipfile, ZipFile cls._handlers.append((is_zipfile, ZipFile)) - from tarfile import is_tarfile, TarFile - cls._handlers.append((is_tarfile, TarFile)) + import tarfile + cls._handlers.append((tarfile.is_tarfile, tarfile.open)) try: from rarfile import is_rarfile, RarFile except ImportError: diff --git a/docs/changelog.rst b/docs/changelog.rst index 3f2890913..21cbd1217 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -124,6 +124,8 @@ New features: separators to support path queries. Thanks to :user:`nmeum`. :bug:`3567` +* ``beet import`` now handles tar archives with bzip2 or gzip compression. + :bug:`3606` Fixes: