It’s very hard to make sure your getting the right info for the files so you need a lot of fuzzy and logic in the searches around the API
Possibly overkill to what your wanting but has some potential similar functionality, where you can see some scrapers in Filebot for linux also does this to match metadata to the correct file
https://github.com/filebot
There is example scrapers in Kodi to help you work out endpoints and intergration options https://kodi.wiki/view/Scrapers
It’s very hard to make sure your getting the right info for the files so you need a lot of fuzzy and logic in the searches around the API
Possibly overkill to what your wanting but has some potential similar functionality, where you can see some scrapers in Filebot for linux also does this to match metadata to the correct file https://github.com/filebot