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

Language Name doesn't work on multivalue tags #6

Open
UltimateRiff opened this issue Jul 8, 2023 · 6 comments
Open

Language Name doesn't work on multivalue tags #6

UltimateRiff opened this issue Jul 8, 2023 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@UltimateRiff
Copy link

based on the forum thread, this is a known issue, but I figured I'd create an issue here as well~

I do quite like the plugin tho~ 🙌

@rdswift
Copy link
Owner

rdswift commented Jul 8, 2023

Are you trying to feed a multi-value variable to the $language_name() function? Can you provide an example?

I suppose that the function could be updated to handle multi-values directly, but until then if you want to process a multi-value, you could (probably) do something like (untested code):

$noop( Set up the multi-value test variable. )
$setmulti(test_input,eng; fra; spa)

$noop( This should work for both normal tags and multi-value tags
       because it checks and processes differently for each. )
$if($is_multi(%test_input%),
    $setmulti(test_output,$map(%test_input%,$language_name(%_loop_value%))),
    $set(test_output,$language_name(%test_input%))
)

@UltimateRiff
Copy link
Author

UltimateRiff commented Jul 8, 2023

any work which has multiple languages set (but not "Multiple Languages", mind you) will get multiple values set in Picard. a random example is Darts of Pleasure by Franz Ferdinand
https://musicbrainz.org/recording/10e23e43-7019-4483-bf79-abef557f5f31
https://musicbrainz.org/work/2b970276-615b-3297-bf3c-b9a7239d7b92

by default, Picard will set %language% to eng; deu

@UltimateRiff
Copy link
Author

this will also happen with a song linked to multiple works of different languages, like I'm Reading a Book by Julian Smith, which gives a value of eng; zxx*
https://musicbrainz.org/recording/a4ef322a-f109-4b73-b690-c53e7ab25046

*though I feel like if a language is combined with zxx the zxx should probably be removed? that might need to be a Picard thing, outside of this plugin

@rdswift
Copy link
Owner

rdswift commented Jul 8, 2023

Thanks for the examples. If you get a chance to try my suggested work-around, please let me know if it works. Thanks.

@UltimateRiff
Copy link
Author

it seems to have worked, once I added the missing ) to the $is_multi() function. it even changed the %test_input% AND %test_output%, an overachiever, this script!~

@UltimateRiff
Copy link
Author

UltimateRiff commented Jul 8, 2023

...and changing %test_input% and %test_output% to %language% and removing the test value seems to work like a dream~

$noop( This should work for both normal tags and multi-value tags
       because it checks and processes differently for each. )
$if($is_multi(%language%),
    $setmulti(language,$map(%language%,$language_name(%_loop_value%))),
    $set(language,$language_name(%language%))
)

@github-project-automation github-project-automation bot moved this to To triage in Language Name May 12, 2024
@rdswift rdswift added the bug Something isn't working label May 12, 2024
@rdswift rdswift moved this from To triage to Ready in Language Name May 12, 2024
@rdswift rdswift self-assigned this May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Ready
Development

No branches or pull requests

2 participants