Repository: beetbox/beets (branch: master)
Commit date: 2023-12-23T00:37:17Z

Workflow file: .github/workflows/formatting_check.yml (Check code formatting)
name: formatting_check
run-name: Check code formatting
on: [push, pull_request]
jobs:
  formatting_check:
    runs-on: ubuntu-latest
    services:
      pypi_wayback:
        image: ghcr.io/waleko/pypi-wayback
        ports:
          - 8629:8080
    steps:
      - name: Install dependencies
        uses: actions/checkout@v3

      - name: Run formatting check
        uses: paolorechia/pox@v1.0.1
        with:
          tox_env: "format_check"

env:
  PIP_INDEX_URL: http://localhost:8629/2023-12-23
  UV_INDEX_URL: http://localhost:8629/2023-12-23


Failed build logs:
step_name: formatting_check/3_Run formatting check.txt
log: ##[group]Run paolorechia/pox@v1.0.1
with:
  tox_env: format_check
##[endgroup]
stdout: Defaulting to user installation because normal site-packages is not writeable

stdout: Collecting tox

stdout:   Downloading tox-4.11.4-py3-none-any.whl (153 kB)

stdout:      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 154.0/154.0 KB 4.1 MB/s eta 0:00:00
stdout: 

stdout: Requirement already satisfied: platformdirs>=3.10 in /usr/local/lib/python3.10/dist-packages (from tox) (4.1.0)

stdout: Collecting pluggy>=1.3

stdout:   Downloading pluggy-1.3.0-py3-none-any.whl (18 kB)

stdout: Collecting virtualenv>=20.24.3

stdout:   Downloading virtualenv-20.25.0-py3-none-any.whl (3.8 MB)

stdout:      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.8/3.8 MB 12.0 MB/s eta 0:00:00
stdout: 

stdout: Collecting cachetools>=5.3.1

stdout:   Downloading cachetools-5.3.2-py3-none-any.whl (9.3 kB)

stdout: Requirement already satisfied: packaging>=23.1 in /usr/local/lib/python3.10/dist-packages (from tox) (23.2)

stdout: Requirement already satisfied: tomli>=2.0.1 in /usr/local/lib/python3.10/dist-packages (from tox) (2.0.1)

stdout: Collecting filelock>=3.12.3

stdout:   Downloading filelock-3.13.1-py3-none-any.whl (11 kB)

stdout: Collecting colorama>=0.4.6

stdout:   Downloading colorama-0.4.6-py2.py3-none-any.whl (25 kB)

stdout: Collecting pyproject-api>=1.6.1

stdout:   Downloading pyproject_api-1.6.1-py3-none-any.whl (12 kB)

stdout: Collecting chardet>=5.2

stdout:   Downloading chardet-5.2.0-py3-none-any.whl (199 kB)

stdout:      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 199.4/199.4 KB 21.1 MB/s eta 0:00:00
stdout: 

stdout: Collecting distlib<1,>=0.3.7

stdout:   Downloading distlib-0.3.8-py2.py3-none-any.whl (468 kB)

stdout:      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 468.9/468.9 KB 15.4 MB/s eta 0:00:00
stdout: 

stdout: Installing collected packages: distlib, pyproject-api, pluggy, filelock, colorama, chardet, cachetools, virtualenv, tox

stdout: Successfully installed cachetools-5.3.2 chardet-5.2.0 colorama-0.4.6 distlib-0.3.8 filelock-3.13.1 pluggy-1.3.0 pyproject-api-1.6.1 tox-4.11.4 virtualenv-20.25.0

Received 6565789 of 6565789 (100.0%), 18.9 MBs/sec
Cache Size: ~6 MB (6565789 B)
[command]/usr/bin/tar -z -xf /home/runner/work/_temp/d6197f94-ef69-4efe-9ad2-cb7265f9e34d/cache.tgz -P -C /home/runner/work/beets/beets
Cache restored successfully
Hit cache on tox
stdout: format_check: recreate env because python changed virtualenv version='20.24.5'->'20.25.0'

stdout: format_check: remove tox env folder /home/runner/work/beets/beets/.tox/format_check

stdout: format_check: install_deps> python -I -m pip install black isort

stdout: format_check: commands[0]> isort beets beetsplug test --check

stderr: ERROR: /home/runner/work/beets/beets/beetsplug/edit.py Imports are incorrectly sorted and/or formatted.

stdout: format_check: exit 1 (0.54 seconds) /home/runner/work/beets/beets> isort beets beetsplug test --check pid=1759

stdout:   format_check: FAIL code 1 (3.49=setup[2.95]+cmd[0.54] seconds)
  evaluation failed :( (3.64 seconds)

child process exited with code 1
##[warning]The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
##[error]Tox failed


Changed files:
beetsplug/advancedrewrite.py
beetsplug/edit.py
beetsplug/web/__init__.py
docs/changelog.rst

Fix diff:
diff --git a/beetsplug/advancedrewrite.py b/beetsplug/advancedrewrite.py
index 639aa5247..20f2b7e03 100644
--- a/beetsplug/advancedrewrite.py
+++ b/beetsplug/advancedrewrite.py
@@ -161,7 +161,7 @@ class AdvancedRewritePlugin(BeetsPlugin):
                             )
                     elif isinstance(replacement, str):
                         if Item._fields[fieldname] is MULTI_VALUE_DSV:
-                            replacement = list(replacement)
+                            replacement = [replacement]
                     else:
                         raise UserError(
                             f"Invalid type of replacement {replacement} "
diff --git a/beetsplug/edit.py b/beetsplug/edit.py
index 8a07fccaa..323dd9e41 100644
--- a/beetsplug/edit.py
+++ b/beetsplug/edit.py
@@ -23,7 +23,7 @@ from tempfile import NamedTemporaryFile
 
 import yaml
 
-from beets import plugins, ui, util, config
+from beets import plugins, ui, util
 from beets.dbcore import types
 from beets.importer import action
 from beets.ui.commands import PromptChoice, _do_query
@@ -155,8 +155,6 @@ class EditPlugin(plugins.BeetsPlugin):
             }
         )
 
-        self.has_shown_ui = False
-
         self.register_listener(
             "before_choose_candidate", self.before_choose_candidate_listener
         )
@@ -238,23 +236,11 @@ class EditPlugin(plugins.BeetsPlugin):
         # Get the content to edit as raw data structures.
         old_data = [flatten(o, fields) for o in objs]
 
-        # take set fields into account
-        set_fields = config["import"]["set_fields"]
-        if set_fields and not self.has_shown_ui:
-            old_str = "\n\n# note: the following fields will be reset to their current values:\n"
-            for key in set_fields:
-                old_str += f"# - {key}\n"
-            for obj in old_data:
-                # those values will be enforced later anyway
-                obj.update({k:v.get() for k,v in set_fields.items()})
-        else:
-            old_str = ""
-
         # Set up a temporary file with the initial data for editing.
         new = NamedTemporaryFile(
             mode="w", suffix=".yaml", delete=False, encoding="utf-8"
         )
-        old_str = dump(old_data) + old_str
+        old_str = dump(old_data)
         new.write(old_str)
         new.close()
 
@@ -263,7 +249,6 @@ class EditPlugin(plugins.BeetsPlugin):
             while True:
                 # Ask the user to edit the data.
                 edit(new.name, self._log)
-                self.has_shown_ui = True
 
                 # Read the data back after editing and check whether anything
                 # changed.
diff --git a/beetsplug/web/__init__.py b/beetsplug/web/__init__.py
index cebb0be0a..cd7e8a3fc 100644
--- a/beetsplug/web/__init__.py
+++ b/beetsplug/web/__init__.py
@@ -336,7 +336,6 @@ def item_file(item_id):
     response = flask.send_file(
         item_path, as_attachment=True, download_name=safe_filename
     )
-    response.headers["Content-Length"] = os.path.getsize(item_path)
     return response
 
 
diff --git a/docs/changelog.rst b/docs/changelog.rst
index 73cc10f3d..b3b63f1c2 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -279,6 +279,8 @@ Bug fixes:
   :bug:`4973`
 * Fix bug regarding displaying tracks that have been changed not being
   displayed unless the detail configuration is enabled.
+* :doc:`/plugins/web`: Fix range request support, allowing to play large audio/
+  opus files using e.g. a browser/firefox or gstreamer/mopidy directly.
 
 For plugin developers: