geigerzaehler / beets-alternatives

Beets plugin to manage external files
MIT License
93 stars 21 forks source link

Respect convert's threads config #41

Closed RollingStar closed 5 months ago

RollingStar commented 4 years ago

The Convert plugin has a threads setting:

https://beets.readthedocs.io/en/latest/plugins/convert.html#configuration

But I find no evidence that this config is respected, either when using beets-alternatives or in its source code.

I notice class Worker has a max_workers param in the init. But I don't see max_workers used anywhere.

https://github.com/geigerzaehler/beets-alternatives/blob/1bc875272b13f08e9d2f1a71bdf354ac98b643e0/beetsplug/alternatives.py#L356

def __init__(self, fn, max_workers=None):

I love the plugin, it's almost exactly what I want.

geigerzaehler commented 4 years ago

Thanks for the report, @RollingStar. It makes sense to have the number of converter threads configurable.

You seem to already have had a look at the code. If you would like to submit a PR for this feature you’re more than welcome and I can help you with that. Otherwise I’ll take a look at it on the weekend.

RollingStar commented 4 years ago

Where would the max_workers be set? In the init for the Worker class?

https://github.com/geigerzaehler/beets-alternatives/blob/1bc875272b13f08e9d2f1a71bdf354ac98b643e0/beetsplug/alternatives.py#L359

geigerzaehler commented 4 years ago

If you pass the max_worker argument to the Worker constructor things should work. The Worker constructor is invoked in convert https://github.com/geigerzaehler/beets-alternatives/blob/c0010c035226ad2babb370b9791ec5153c86b376/beetsplug/alternatives.py#L252

You would need to add a max_workers property to the External class, that can then be read by convert.