scraping and cleanstrings

While writing the script I came across a little roadblock. Since I don’t have any NFOs on my hard disk yet, I want to retrieve one movie from a set via the scraper to parse the collection/set name.
In @nabsltd’s example that would be <name>Alien (collection)</name>

Is there a kodi-send command to retrieve the NFO file or scrape one movie from a given directory?
Also, I doubt that kodi would put anything in the movie director, because the share user has only read permissions on the network share.

If you wanted to scrape just one movie you can do it by navigating in the move>files section, context menu, scan to library (or something to that effect) but the export of the NFO’s is an all of nothing affair with everything that is in the library… so probably not what your looking for, plus you would need write permissions to the folders they are in as it only exports them next to the files.

Hmm, I need a way to script it. I write a bash script thus some cli command would be necessary to scrape one movie. That’s why I asked for a kodi-send action command.

Does the scraper always write an NFO file, if it has write permissions?
Or is an NFO file only created when doing an export?

But the NFO file is not really neccesary as a result of the one time one movie scrape (per set) to retrieve the collection name, because I could still query the db for the colllection name in my script. But what I can’t do is manually use the UI everytime the script encounters a new set. In that case I don’t need a script.

So basically if my script finds a set of movies, it should get the meta data for one movie so that it knows the collection name. After that the script creates NFO files for all movies in that set. Then the script goes on to the next set… loop until no more sets. Done.
As you can see I only need to find out the collection name. That’s why I want to scrape one movie per set. But if there was an API I could use (for the MovieDB web site or whatever the scraper is using) that would even be better. A simple curl call and parsing of the response is quick and easy.

When you scrape a file in kodi the scraper parses the info it gets from the net and then dumps that into the database. No nfo files as part of this ‘regular’ process.

When you tell kodi to export it takes the information from the database and then creates nfo files from that (which are really only meant to aid in a new import).

If there is a nfo file present when the scraping starts that information will aid the scraper in finding the listing and/or supersede the information from the online source depending on what is in the file.

there are 3rd party media managers that will create these nfo files that kodi can read. I don’t know anything about them other than the braintrust over at kodi discourages their use.

Edit: If you turn on debug logging in kodi you can see exactly what the scraper is sending to the TMDB and what is coming back.

Awesome, thanks!

Whatever for? As noted above, I find using an external scraper massively more reliable than Kodi’s internal scrapers. Especially for non-english language/non-mainstream content.

https://kodi.wiki/view/NFO_files#Media_Managers

Please note that ‘discourages their use’ is not the same as saying you should not use them or their not being valid use cases. Aside from the issues outlined in that wiki I think part of the reason is that they can make for additional headaches when someone comes into the forum looking for support on scraping issues.