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

import: using edit candidates prevents auto fetchart and embedart #2734

Closed
Vrihub opened this issue Nov 3, 2017 · 5 comments
Closed

import: using edit candidates prevents auto fetchart and embedart #2734

Vrihub opened this issue Nov 3, 2017 · 5 comments
Labels
bug bugs that are confirmed and actionable

Comments

@Vrihub
Copy link
Contributor

Vrihub commented Nov 3, 2017

Problem

If I import an album making some changes with the "Edit candidates" option, beets doesn't fetch and embed the album art automatically, as it is supposed to do in my configuration.

This is what happens when I import something without making changes via "Edit candidates":

...
Apply, More candidates, Skip, Use as-is, as Tracks, Group albums,
Enter search, enter Id, aBort, eDit, edit Candidates? a
Sending event: import_task_choice
Sending event: import_task_apply
0 of 1 items replaced
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
fetchart: trying source filesystem for album Wolfgang Amadeus Mozart - Eine Kleine Nachtmusik / Symphony no. 40 in G minor / Symphony no. 41 "Jupiter"
fetchart: trying source coverart for album Wolfgang Amadeus Mozart - Eine Kleine Nachtmusik / Symphony no. 40 in G minor / Symphony no. 41 "Jupiter"
fetchart: downloading image: https://coverartarchive.org/release/00185b27-bb54-40fb-b5cc-b26f246a6078/front
fetchart: downloaded art to: /tmp/tmpTD9lQ9.jpg
fetchart: using remote image /tmp/tmpTD9lQ9.jpg
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: database_change
Sending event: import_task_files
Sending event: art_set
embedart: Resizing album art to 600 pixels wide
artresizer: ImageMagick resizing XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/wolfgang_amadeus_mozart_0000_eine_kleine_nachtmusik___symphony_no._40_in_g_minor___symphony_no._41__jupiter_/albumart.jpg to /tmp/tmpStol6V.jpg
embedart: Embedding album art into Wolfgang Amadeus Mozart - 0000 - Eine Kleine Nachtmusik / Symphony no. 40 in G minor / Symphony no. 41 "Jupiter"
embedart: embedding /tmp/tmpStol6V.jpg
Sending event: write
Sending event: after_write
Sending event: database_change
Sending event: album_imported
Sending event: import
Sending event: cli_exit

And here's what happens when I make some changes: it seems the fetchart and embedart plugins are not called at all:

...
Enter search, enter Id, aBort, eDit, edit Candidates? c
# selection (default 1)? 1
edit: invoking editor command: ['vim', '/tmp/tmpGx7YKR.yaml']
Wolfgang Amadeus Mozart - 0000 - Eine Kleine Nachtmusik / Symphony no. 40 in G minor / Symphony no. 41 "Jupiter" - 01 - Eine Kleine Nachtmusik
  title: Eine Kleine Nachtmusik -> Eine Kleine Nachtmusik test test test
continue [E]diting, Apply, Cancel? a
Sending event: import_task_choice
0 of 1 items replaced
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: database_change
Sending event: import_task_files
Sending event: album_imported
Sending event: import
Sending event: cli_exit

Perhaps this might be related to #1671? Though I don't use the convert plugin, the only similarity is that the auto fetch/embedart operations during import are skipped when "something else" ("convert" or "edit candidates") happens before.

Setup

  • OS: linux
  • Python version: 2.7.13
  • beets version: 1.4.5

My configuration (output of beet config) is:

...
fetchart:
  auto: yes
embedart:
  auto: yes
...
@sampsyo sampsyo added the bug bugs that are confirmed and actionable label Nov 3, 2017
@sampsyo
Copy link
Member

sampsyo commented Nov 3, 2017

Thank you! My suspicion is that the edit plugin is not updating the state of the ImportTask object sufficiently to allow plugins to be invoked. The next step is to go digging in import.py to examine the logic that invokes plugin stages and to do a little debugging to understand what state is causing these stages to be disabled. Volunteers would be very welcome!

@wisp3rwind
Copy link
Member

wisp3rwind commented Nov 4, 2017

I think (haven't tested) for fetchart, the problem is in this line where it should check for choices APPLY and RETAG.

EDIT: There's no such conditional in embedart, but it is triggered on assigning new artwork, so the problem is probably simply the failure of fetchart before?

@sampsyo
Copy link
Member

sampsyo commented Nov 4, 2017

Indeed, that does seem like that could explain it. Thank you!

@Vrihub
Copy link
Contributor Author

Vrihub commented Nov 4, 2017

I think (haven't tested) for fetchart, the problem is in this line where it should check for choices APPLY and RETAG.

I guess you mean APPLY or RETAG?

OK, I tried replacing the line https://github.com/beetbox/beets/blob/master/beetsplug/fetchart.py#L786 with
elif task.choice_flag in (importer.action.APPLY, importer.action.RETAG):

The fetchart and embedart plugins now are called as expected and the import process is successful!

DISCLAIMER: I only tried to translate @wordofglass suggestion into code, but I'm not sure if this is enough, or if more code is required for a complete solution. Anyway, it seems to work so far. :)

@sampsyo
Copy link
Member

sampsyo commented Nov 4, 2017

Cool! Could you please open a pull request with your change? That’s a good way to start a discussion about a proposed fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs that are confirmed and actionable
Projects
None yet
Development

No branches or pull requests

3 participants