beets icon indicating copy to clipboard operation
beets copied to clipboard

Parentwork plugin copious output during import

Open aereaux opened this issue 4 years ago • 6 comments

When the parentwork plugin is enabled during import, it outputs its changes all over the rest of the import UI, like so:

/home/aidane/music/import/album/The Devil Makes Three - Do Wrong Right (12 items)
Tagging:
    The Devil Makes Three - Do Wrong Right
URL:
    https://musicbrainz.org/release/a4200d5c-9f4a-48e9-abca-3f17f2ee05bb
(Similarity: 100.0%) (CD, 2009, US, Milan, M2-36426)
[A]pply, More candidates, Skip, Use as-is, as Tracks, Group albums,
Enter search, enter Id, aBort, plaY? a
Ralph Vaughan Williams - Flos Campi / Suite for Viola and Orchestra - Flos Campi
  work_date: 1925
  parentwork_workid_current: 409c16ca-3f24-345e-8699-670ad8487171
  parentwork_date: 1925
  parentwork: Flos campi
  parent_composer: Ralph Vaughan Williams
  parent_composer_sort: Vaughan Williams, Ralph
  mb_parentworkid: 409c16ca-3f24-345e-8699-670ad8487171
Ralph Vaughan Williams - Flos Campi / Suite for Viola and Orchestra - Suite for Viola and Orchestra: Group 1: Prelude
  work_date: 1934
  parentwork_workid_current: ecab0d62-041a-42be-921b-ae9c2ae18ccb
  parentwork_date: 1934
  parentwork: Suite for Viola and Orchestra
  parent_composer: Ralph Vaughan Williams
  parent_composer_sort: Vaughan Williams, Ralph
  mb_parentworkid: a28be6ee-076c-4d1c-af1d-d92901e37dc7
Ralph Vaughan Williams - Flos Campi / Suite for Viola and Orchestra - Suite for Viola and Orchestra: Group 1: Carol
  work_date: 1934
  parentwork_workid_current: 921a7f9c-b3eb-4853-8f9b-3a927868b5c9
  parentwork_date: 1934
  parentwork: Suite for Viola and Orchestra
  parent_composer: Ralph Vaughan Williams
  parent_composer_sort: Vaughan Williams, Ralph
  mb_parentworkid: a28be6ee-076c-4d1c-af1d-d92901e37dc7
Ralph Vaughan Williams - Flos Campi / Suite for Viola and Orchestra - Suite for Viola and Orchestra: Group 1: Christmas Dance
  work_date: 1934
  parentwork_workid_current: b6cfe63a-ef42-4a17-b1a9-ea1a9c3d4871
  parentwork_date: 1934
  parentwork: Suite for Viola and Orchestra
  parent_composer: Ralph Vaughan Williams
  parent_composer_sort: Vaughan Williams, Ralph
  mb_parentworkid: a28be6ee-076c-4d1c-af1d-d92901e37dc7
Ralph Vaughan Williams - Flos Campi / Suite for Viola and Orchestra - Suite for Viola and Orchestra: Group 2: Ballad
  work_date: 1934
  parentwork_workid_current: 74cfd0bd-ea2b-42cf-b3a4-64bca63f67a9
  parentwork_date: 1934
  parentwork: Suite for Viola and Orchestra
  parent_composer: Ralph Vaughan Williams
  parent_composer_sort: Vaughan Williams, Ralph
  mb_parentworkid: a28be6ee-076c-4d1c-af1d-d92901e37dc7
Ralph Vaughan Williams - Flos Campi / Suite for Viola and Orchestra - Suite for Viola and Orchestra: Group 2: Moto Perpetuo
  work_date: 1934
  parentwork_workid_current: 217d6d6e-3863-42bc-8cf7-c0db8a210f52
  parentwork_date: 1934
  parentwork: Suite for Viola and Orchestra
  parent_composer: Ralph Vaughan Williams
  parent_composer_sort: Vaughan Williams, Ralph
  mb_parentworkid: a28be6ee-076c-4d1c-af1d-d92901e37dc7
Ralph Vaughan Williams - Flos Campi / Suite for Viola and Orchestra - Suite for Viola and Orchestra: Group 3: Musette
  work_date: 1934
  parentwork_workid_current: 5a8978fc-0769-46fb-9d56-e407b2bfa8ea
  parentwork_date: 1934
  parentwork: Suite for Viola and Orchestra
  parent_composer: Ralph Vaughan Williams
  parent_composer_sort: Vaughan Williams, Ralph
  mb_parentworkid: a28be6ee-076c-4d1c-af1d-d92901e37dc7
Ralph Vaughan Williams - Flos Campi / Suite for Viola and Orchestra - Suite for Viola and Orchestra: Group 3: Polka
  work_date: 1934
  parentwork_workid_current: 19e84f59-c137-405c-a9fa-642c7ba8c75e
  parentwork_date: 1934
  parentwork: Suite for Viola and Orchestra
  parent_composer: Ralph Vaughan Williams
  parent_composer_sort: Vaughan Williams, Ralph
  mb_parentworkid: a28be6ee-076c-4d1c-af1d-d92901e37dc7
Ralph Vaughan Williams - Flos Campi / Suite for Viola and Orchestra - Suite for Viola and Orchestra: Group 3: Galop
  work_date: 1934
  parentwork_workid_current: 37fdda8d-aff8-48e8-ba31-2641e7714ca2
  parentwork_date: 1934
  parentwork: Suite for Viola and Orchestra
  parent_composer: Ralph Vaughan Williams
  parent_composer_sort: Vaughan Williams, Ralph
  mb_parentworkid: a28be6ee-076c-4d1c-af1d-d92901e37dc7
The Devil Makes Three - Do Wrong Right - Statesboro Blues
  parentwork_workid_current: 668b983a-fa68-3306-a1d1-0a3967955e62
  parentwork: Statesboro Blues
  parent_composer: Blind Willie McTell
  parent_composer_sort: McTell, Blind Willie
  mb_parentworkid: 668b983a-fa68-3306-a1d1-0a3967955e62
The Devil Makes Three - Do Wrong Right - Cheap Reward
  parentwork: Cheap Reward
  parentwork_workid_current: 75bc2dfa-16b6-4aae-b918-4811fa20f36d
  mb_parentworkid: 75bc2dfa-16b6-4aae-b918-4811fa20f36d

This makes it hard to know what to input if I take too long and the parentwork outputs a lot of text. This should probably be silenced during import (when there is nothing that it's changing from anyways.

The output (I'm fairly sure) is from ui.show_model_changes, but I'm not sure if that should be changed to not output during import or for parentwork to not call it during an import.

aereaux avatar Oct 23 '21 02:10 aereaux

Good point! This is coming from here: https://github.com/beetbox/beets/blob/b116eb5456d1849489257329b53a4fc588e45c07/beetsplug/parentwork.py#L207

@dosoe, perhaps this was left in from some debugging? The plugin should not output anything when the importer is running in non-verbose mode. Could you please take a look?

sampsyo avatar Oct 23 '21 13:10 sampsyo

FWIW, this seems to match the behavior of mbsync, at least when running after import.

aereaux avatar Oct 23 '21 15:10 aereaux

Yes, I wanted to match the behaviour of mbsync, but I don't want it to run on import. I will check the other plugins on how they display changes only when they specifically are called and not via an event.

dosoe avatar Oct 26 '21 09:10 dosoe

This is still an issue, making the Parentwork plugin almost useless as it prints right over the base beets package output. Would the change not be as simple as just modifying https://github.com/beetbox/beets/blob/b116eb5456d1849489257329b53a4fc588e45c07/beetsplug/parentwork.py#L205-L211 to additionally check for verbose mode defined in the completion_script(commands) function: https://github.com/beetbox/beets/blob/b116eb5456d1849489257329b53a4fc588e45c07/beets/ui/commands.py#L1813-L1817 I am somewhat familiar with Python but only on smaller projects without so many moving parts so forgive me if I am incorrect.

danni-storm avatar Jan 25 '24 14:01 danni-storm

For now, until I have more time to dig into the code, I simply removed lines 207:211 in my local plugin file.

danni-storm avatar Jan 28 '24 14:01 danni-storm

I wrote up a quick change to only output verbose details when running explicitly. Let me know if there's anything I should change with that.

aereaux avatar Mar 04 '24 03:03 aereaux