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

Add ability to consider country in import and listing #3524

Closed
nirvdrum opened this issue Mar 22, 2020 · 3 comments
Closed

Add ability to consider country in import and listing #3524

nirvdrum opened this issue Mar 22, 2020 · 3 comments

Comments

@nirvdrum
Copy link

Use case

I'm a collector of Nirvana albums. I have several copies of one album, but from different countries and slightly different track listings. I'd like to be able to include each variant of the album as unique inside the beets database. While I'm able to use the country name in the path format to disambiguate on disk, I haven't found a way to make the importer consider the difference in country in order to avoid the de-dupe prompt.

I'm able to "keep both", which isn't a terrible solution. But, I found myself wanting to reimport one variant of the album and in this case, I really did want to remove an old one, but there's no straightforward way to do that from what I can tell. Likewise, when I run beet ls -a, it doesn't include the country information in the output, making it hard to tell what's in the database.

Solution

I think it'd be helpful for beets to detect when different musicbrainz sources were used for different imported albums. It appears to normalize after the fact and thus loses the knowledge that these were in fact different pressings of the album. Assuming that ID could be kept, it could then be used to present more information when doing an album listing or to better help the de-dupe process upon import.

@wisp3rwind
Copy link
Member

I'd say this is a fairly niche usecase (my impression/opinion), so I guess that changing beets' default behaviour isn't really warranted here. However, under the hood, beets should be able to do pretty much all of these things:

  • beets does store the musicbrainz IDs, so the information is there in principle. I like to use the edit plugin with its beet edit --all command to see what kind of data beets has stored about particular items.
  • you can tell beets which fields to include in the beet ls/beet ls -a output, see format_item/format_album
  • if beets' builtin functionality indeed doesn't solve all your needs, maybe you can solve these problems using custom fields and the inline plugin. However, I'm quite certain that beets stores the country key.
  • About making the importer behave, I believe you can configure how important matching particular fields is. I'm not an expert there, though. You may want to search the other github issues, or maybe @sampsyo can contribute some insight.

@sampsyo
Copy link
Member

sampsyo commented Mar 22, 2020

Hello! Thanks for the extra context, @wisp3rwind. @nirvdrum, please take a look at #1133, which tracks the idea to make the duplicate detection criteria configurable.

@nirvdrum
Copy link
Author

@wisp3rwind Thanks for the suggestions. I'm going to report my findings here just in case someone else comes across the issue and is curious about the resolution.

I had already been making use of the inline plugin to display the country name in the path, only if not "US". It's a close enough approximation for disambiguation for me. As far as I can tell, format_album doesn't support using inline items, so I can't get the display quite the way I want. I'd like to omit the country value when it's "US" since the overwhelming majority of my CDs are US ones.

The edit plugin looks most promising. If I import with timid mode, I can edit the album name before it hits the DB. But, that looks like it causes a Musicbrainz mismatch somewhere else, so any of the album metadata is missing. A benefit of this approach is it no longer reports a conflict upon import.

Editing the album after the fact is a bit less convenient, but appears to work. The import process will detect the album as a dupe, but I can just "keep all" at that point. It means I have to keep track of what's already in the DB, but fortunately these are niche cases, so they don't arise frequently. The other issue is if I include the country info as part of the album name (from the edit process), that ends up affecting the path names. I had already been including the country name in album paths for non-US albums. So, I had to update my rule to handle both foreign albums that I edited the title and those that I did not. It's a bit ugly for a one-liner, but it works.

item_fields:
  albumtype_display: "'' if albumtype.upper() == 'ALBUM' else ' [%s]' % (albumtype.upper())"
  country_display: "country_display = ' [%s]' % (country.upper()); return '' if country.upper() == 'US' or country_display in
album else country_display"
paths:
  default: %the{$albumartist}/$year - $album%aunique{}$country_display$albumtype_display (%upper{$format})/$track $title

It's a roundabout a way of getting where I want to be, but it looks like it works. So, thanks for the help! I think it would be possible for beets to handle this out of the box without impacting others, since I only want the paths and display information to change from the default in specific cases. But, I'm happy enough with this. Thanks again!

It sounds like #1133 would help me deal with this on import, but I'm a bit worried it's been open for over 5 years. I'll take the discussion around import to that issue and see if I can help out in any way.

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

No branches or pull requests

3 participants