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

Organising classical music #1364

Closed
sondr3 opened this issue Mar 19, 2015 · 13 comments
Closed

Organising classical music #1364

sondr3 opened this issue Mar 19, 2015 · 13 comments

Comments

@sondr3
Copy link

sondr3 commented Mar 19, 2015

Hey, I'm having some slight troubles keeping my classical music organised. I've been organising most my music with $albumartist which works great for everything but classical because you end up with folders named like Пётр Ильич Чайковский; Koninklijk Concertgebouworkest, Antal Doráti/ when I would only want the composer to be included (Пётр Ильич Чайковский/). I tried doing this %if{$composer,$composer,$albumartist}/ to see if it worked but it stills looks like it gives them $albumartist names instead.

@sampsyo
Copy link
Member

sampsyo commented Mar 19, 2015

We don't currently fetch the composer, sadly: see #506. 😢 Contributions to help get this field would be greatly appreciated.

@sampsyo sampsyo closed this as completed Mar 19, 2015
@sondr3
Copy link
Author

sondr3 commented Mar 19, 2015

I really have no idea how you'd to that honestly, but would it be possible to use the Inline plugin to remove everything after the first ; occurs? That'd be the duct tape solution for me at least.

@sampsyo
Copy link
Member

sampsyo commented Mar 19, 2015

Sure. Something like myartist: albumartist.split(';')[0].

@sondr3
Copy link
Author

sondr3 commented Mar 19, 2015

That seems to do the job, thanks 😀

@sondr3
Copy link
Author

sondr3 commented Mar 20, 2015

Sorry, I'm back again, I've been trying to create another item field for the rest of the albumartists but I just can't get it to work. It either works for albums where there's only one albumartist or for albums where there are multiple, I just can't get it to work with either. So far I have:

restartist: |
  if len(albumartist) != 1:
    pass
  elif len(albumartist) >= 1:
    return albumartist.split(';')[1]

I've tried a bunch of variations, checking if it's greater than/smaller than/equal/etc and reversing whether it checks first and so on. But either I get an IndexError: list index out of range or it just doesn't do anything. Any ideas (pretty new to Python)?

@sampsyo
Copy link
Member

sampsyo commented Mar 20, 2015

len(albumartist) >= 1 just means you have at least one character in the artist string. Maybe you want:

parts = albumartist.split(';', 1)
if len(parts) > 1:
    return parts[1]
else:
    return ''

@sondr3
Copy link
Author

sondr3 commented Mar 20, 2015

It works! I thought albumartist was a list, which is probably where I messed up. But regardless, thank you so much for all the help! :D

@NErnstI
Copy link

NErnstI commented Mar 25, 2016

Hi!

Thanks for the neat write-down for a non python-savy user like me. - An issue I encountered with this setup is when Discogs is used instead of Musicbrainz. Albumartists are then often called: "composer - conductor, orchestra..."

How can I split the albumartist both by ";" and " - " (including the whitespaces!)

@jackwilsdon
Copy link
Member

@NErnstI Which field are you trying to extract? The composer?

@NErnstI
Copy link

NErnstI commented Mar 25, 2016

Sorry, let me rephrase:

I assumed that the above behaviour is still the case, at least I found no composer tags after importing with beets. So I did this exact workaround:

item_fields:
    mainartist: albumartist.split(';')[0]
    restartists: |
      parts = albumartist.split(';', 1)
      if len(parts) > 1:
        return parts[1]
      else:
        return ''

I then use mainartist as the albumartist mainfolder name (in this case the composer usually) and include the remaining artists in the album subfolder.

When importing from musicbrainz it works with the semicolon, however discogs appears to format it differently, instead of "composer; conductor, orchestra, ..." its "composer - conductor, orchestra, ...".

I would like the above ruleset to apply to discogs format as well, splitting the albumartist both with ";" and " - ".

@jackwilsdon
Copy link
Member

Try this;

item_fields:
    mainartist: |
      import re
      re.split(';|,', albumartist)[0]
    restartists: |
      import re
      parts = re.split(';|,', albumartist)
      if len(parts) > 1:
        return parts[1]
      else:
        return ''

@NErnstI
Copy link

NErnstI commented Mar 25, 2016

Ah, I see, I already stumpled upon this re-option, but wasn't confident enough to try it myself.

Worked like a charm, just adapted it a bit and separated at the " - " string

item_fields:
    mainartist: |
      import re
      x = re.split(';| - ', albumartist)
      return x[0]
    restartists: |
      import re
      parts = re.split(';| - ', albumartist)
      if len(parts) > 1:
        return parts[1]
      else:
        return ''

Thank you very much for you help :)

@dosoe
Copy link
Contributor

dosoe commented Aug 3, 2017

Hi! For organising classical music, you might be interested in the parentwork plugin: #2580 . Then you can organize the music like $parentcomposer_sort/$parentwork($parentwork_disambig)/whatever to get the music ordered by parentwork (for an aria from an opera, it would be the opera) and the composer of the parentwork.

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

No branches or pull requests

5 participants