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

mbsync does not yield albuminfo_received / trackinfo_received as the docs suggest #2921

Closed
iliana opened this issue May 9, 2018 · 1 comment
Labels
bug bugs that are confirmed and actionable

Comments

@iliana
Copy link
Contributor

iliana commented May 9, 2018

Problem

I am writing a plugin to override metadata and wish for it to apply when using beet mbsync. The documentation for plugin events implies that listening for albuminfo_received and trackinfo_received will allow me to do just that.

However, running beet -vv mbsync for a given query does not show a log message saying that the event was ever sent.

$ beet -vv mbsync 'album:autobahn'
user configuration: /home/ilianaw/.config/beets/config.yaml
data directory: /home/ilianaw/.config/beets
plugin paths: /home/ilianaw/.config/beets/plug
Sending event: pluginload
/usr/lib/python3.6/site-packages/beets/plugins.py:114: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec()
  argspec = inspect.getargspec(func)
library database: /home/ilianaw/.config/beets/library.db
library directory: /srv/media/ilianaw_music
Sending event: library_opened
Requesting MusicBrainz release f8fab745-79bd-31cd-be4b-ceb3d7e1e799
primary MB release type: album
mbsync: applying changes to Kraftwerk - Autobahn
Sending event: cli_exit

It appears (although I've not tested it) that this is a regression that occurred in 18a14e8. mbsync uses hooks.album_for_mbid, but only hooks.albums_for_id yields an albuminfo_received.

The solution that comes to my mind is to partially revert this commit by removing the @plugins.notify_info_yielded decorator on albums_for_id/tracks_for_id and using plugins.send. The use of @plugins.notify_info_yielded on album_candidates/item_candidates seems fine at first glance. If this sounds correct, I'll be happy to send a pull request.

Setup

  • OS: Fedora 28
  • Python version: 3.6.5
  • beets version: 1.4.6
  • Turning off plugins made problem go away (yes/no): no

My configuration (output of beet config) is:

plugins: chroma fetchart embedart mbsync scrub override
pluginpath: ~/.config/beets/plug
directory: /srv/media/ilianaw_music
ui:
  color: yes
paths:
  default: "$albumartist/$album%aunique{}/$track $title"
  singleton: "$artist/$title"
  comp: "Various Artists/$album%aunique{}/$track $title"
fetchart:
  sources:
    - amazon
    - coverart
  store_source: yes
embedart:
  remove_art_file: yes

(override is the plugin I am attempting to write.)

@iliana iliana changed the title mbsync does not yield albuminfo_received/trackinfo_received as the docs suggest mbsync does not yield albuminfo_received / trackinfo_received as the docs suggest May 9, 2018
@sampsyo
Copy link
Member

sampsyo commented May 10, 2018

Thanks for your detective-work on this! I agree entirely with your astute diagnosis.

I've been trying to think of a way to salvage the decorator style, which is nice in itself, but I've been unable to come up with a better solution. So yes, I also concur with your idea to remove those decorators and replace them with explicit send calls---that seems like the most straightforward way to get both ID-based lookup functions to emit the right events.

Thank you again!

@sampsyo sampsyo added the bug bugs that are confirmed and actionable label May 10, 2018
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

2 participants