beetbox / beetbox/beets

thumbnails: Do image conversion before writing .desktop entry for Dolphin

Open
#3,086 1 comment 0 reactions 0 assignees View on GitHub
bug thumbnails
Dominant language
Python
Stars
15.7k
Forks
2.1k
Avg merge
4d 21h
Merged PRs (30d)
31

Description

### Problem

So I'm trying to fetch and embed album art into each song and the album folder. I am using the fetchart, thumbnails, and embedart plugins. Since I am using dolphin, I have that option set to 'yes'.

When I run an import, I am getting a .jpg file that matches the name set for 'art_filename' and that file is added to the .directory file, which is apparently how dolphin manages it's thumbnails. So this seems to work... however, when I open up a new instance of dolphin and navigate to the album folder, the thumbnail is gone. When I go into the folder settings and manually set the thumbnail, .jpg isn't in their filtered file extensions, making me think it might not be supported? Googling around hasn't given me any answers (but .pngs seem to persist so it sounds plausible).

Anyway, I tried to get some more insight, so I ran with the verbose settings and I see the below output (art had to be pulled through google).

> Sending event: art_set
> embedart: Embedding album art into The Absence - Oceans
> embedart: embedding /music/Artists/The Absence/[2013] (Single) Oceans/.albumart.jpg
> Sending event: write
> Sending event: after_write
> thumbnails: generating thumbnail for The Absence - Oceans
> thumbnails: Wrote file /music/Artists/The Absence/[2013] (Single) Oceans/.directory
> artresizer: PIL resizing /music/Artists/The Absence/[2013] (Single) Oceans/.albumart.jpg to /config/.cache/thumbnails/large/3012ea475fee1a34403bed3321f06958.png
> artresizer: PIL resizing /music/Artists/The Absence/[2013] (Single) Oceans/.albumart.jpg to /config/.cache/thumbnails/normal/3012ea475fee1a34403bed3321f06958.png
> thumbnails: wrote thumbnail for The Absence - Oceans

According to this, it is writing the .directory entry before generating the thumbnails and the thumbnails are .png files. When I run through the dev environment with the debugger, I see a call to

```python
shutil.move(resized, target)
```

where resized and target are the same path. I'm assuming the intention was to move those back to the album directory? If it correctly moved the thumbnail back there, it wouldn't match the extension from the file that was added to the .directory file either. So I guess there are 2 bugs here?

1. target is supposed to be in the album folder
2. .directory shouldn't be written to until the desired thumbnail is actually created (which will hopefully be a .png if it is successfully moved)

### Setup

* OS: Archlinux + KDE
* Python version: 2.7, 3.7
* beets version: 1.4.8

The important parts of my configuration:

```yaml
# problem still exists without the .
art_filename: .albumart

fetchart:
auto: yes
cautious: false
store_source: yes
cover_names: front cover
sources:
- coverart: release
- amazon
- itunes
- coverart: releasegroup
- albumart
- wikipedia
- google
google_key: *****

thumbnails:
auto: yes
force: yes
dolphin: yes

embedart:
auto: yes
remove_art_file: no
```

Contributor guide

Open the contributing guide

Research direction

Start in the thumbnails plugin at the shutil.move(resized, target) call and trace the art_set, write, and after_write event sequence described in the report. Reproduce with the Dolphin option enabled, then verify that the generated thumbnail path and the .directory entry use the intended image after conversion completes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.