Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle potential OSError when unlinking temporary files in ArtResizer #5615

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Dr-Blank
Copy link
Contributor

@Dr-Blank Dr-Blank commented Feb 4, 2025

Description

was getting permission error because after png is converted to jpg beets want to delete the png but somehow it is still being used causing the import to fail. this temporarily fixes the import but still needs a proper way to know what is using the file and how to delete it.

  File "C:\Users\DELL\projects\_myForks\beets\beetsplug\fetchart.py", line 1321, in fetch_art
    candidate = self.art_for_album(task.album, task.paths, local)
  File "C:\Users\DELL\projects\_myForks\beets\beetsplug\fetchart.py", line 1413, in art_for_album
    out.resize(self)
    ~~~~~~~~~~^^^^^^
  File "C:\Users\DELL\projects\_myForks\beets\beetsplug\fetchart.py", line 218, in resize
    self._resize(plugin, current_check)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\DELL\projects\_myForks\beets\beetsplug\fetchart.py", line 246, in _resize
    self.path = ArtResizer.shared.reformat(
                ~~~~~~~~~~~~~~~~~~~~~~~~~~^
        self.path,
        ^^^^^^^^^^
        plugin.cover_format,
        ^^^^^^^^^^^^^^^^^^^^
        deinterlaced=plugin.deinterlace,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "C:\Users\DELL\projects\_myForks\beets\beets\util\artresizer.py", line 658, in reformat
    os.unlink(path_in)
    ~~~~~~~~~^^^^^^^^^
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: b'C:\\Users\\DELL\\AppData\\Local\\Temp\\beets\\beetsplug_fetchart\\4kqx2um2.png'

when importing https://musicbrainz.org/release/5744ddb7-e9b6-4b46-a55c-38e75aa95460

beet config

fetchart:
    minwidth: 500
    maxwidth: 3000
    max_filesize: 3500000
    sources:
    -   coverart: release
    -   coverart: releasegroup
    - itunes
    - amazon
    - filesystem
    - albumart
    - '*'
    cautious: yes
    cover_names: cover front art artwork folder album
    store_source: yes
    cover_format: JPEG
    auto: yes
    quality: 0
    enforce_ratio: no
    high_resolution: no
    deinterlace: no

To Do

  • Documentation. (If you've added a new command-line flag, for example, find the appropriate page under docs/ to describe it.)
  • Changelog. (Add an entry to docs/changelog.rst to the bottom of one of the lists near the top of the document.)
  • Tests. (Very much encouraged but not strictly required.)

Copy link

github-actions bot commented Feb 4, 2025

Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant