beetbox / beets

music library manager and MusicBrainz tagger
http://beets.io/
MIT License
12.79k stars 1.82k forks source link

Fix the no_convert option of the convert plugin stopping conversion when there is only a partial match. #5376

Open sanpoChew opened 2 months ago

sanpoChew commented 2 months ago

Description

I was running the convert plugin with the following config:

no_convert: samplerate:..48000 bitdepth:..16

but anything that was 24/48 was also not being converted, this was due to the code returning False for should_transcode if any part of the query matches, rather than considering the whole query. This meant that bitdepth:...16 was being ignored.

I have changed this so the no_convert value is considered as one query.

To Do

bal-e commented 1 month ago

I'm looking at the documentation for no_convert:

Does not transcode items matching the query string provided (see Queries). For example, to not convert AAC or WMA formats, you can use format:AAC, format:WMA or path::\.(m4a|wma)$. If you only want to transcode WMA format, you can use a negative query, e.g., ^path::\.(wma)$, to not convert any other format except WMA.

I understand that the comma should work as a logical OR operator. @sanpoChew, can you confirm that format:AAC, format:WMA works as the documentation suggests, with your patches applied?

Also, this may break users' configurations, please add some information in the changelog so that users know how to adjust.

sanpoChew commented 1 month ago

I'm looking at the documentation for no_convert:

Does not transcode items matching the query string provided (see Queries). For example, to not convert AAC or WMA formats, you can use format:AAC, format:WMA or path::\.(m4a|wma)$. If you only want to transcode WMA format, you can use a negative query, e.g., ^path::\.(wma)$, to not convert any other format except WMA.

I understand that the comma should work as a logical OR operator. @sanpoChew, can you confirm that format:AAC, format:WMA works as the documentation suggests, with your patches applied?

Also, this may break users' configurations, please add some information in the changelog so that users know how to adjust.

That is correct yes, if users want to maintain the existing behaviour they would need to add a comma. I have updated the changelog entry so that it is more helpful 👍

sanpoChew commented 1 month ago

Actually, just one request. Can you add a test that confirms that the comma OR functionality still works as expected with this change? Just as a test-coverage thing.

After that, if @bal-e is fine, this can be merged.

That makes sense, have added that test 👍

sanpoChew commented 6 days ago

There seems to be some failures unrelated to my code in the lint checks

snejus commented 2 days ago

There seems to be some failures unrelated to my code in the lint checks

Seems like this was caused by GitHub failing DNS resolution internally. Have re-ran the workflows and it worked fine now.