Solved TheMovieDB Movie scraper empty query string, API 422 Errors
#1
Hi,

For a little bit when updating my library, the scan gets interrupted by an error messages "Unable to connect to remote server. Would you like to continue scanning?"

I'm using metadata.themoviedb.org v5.1.8

I noticed it happened consistently on the same titles so fetched some debug logs. It looks like for some titles, it will search for an empty string and the API returns a 422 error, triggering that error message. I don't know why some titles trigger this, and plenty of other file names work perfectly fine. I thought it might be because I have some movies with the format "MovieTitle, The" but some files without a comma fail as well. 

Here's an excerpt, more detailed logs below.


Code:
2019-08-29 16:01:11.300 T:140099665766144   DEBUG: CNFSFile::Open - opened volume1/video/Movies/Ex Machina (2015)/Ex Machina (2014).mkv
2019-08-29 16:01:11.306 T:140099665766144   DEBUG: FindMovie: Searching for '' using The Movie Database scraper (path: '/storage/.kodi/addons/metadata.themoviedb.org', content: 'movies', version: '5.1.8')
2019-08-29 16:01:11.316 T:140099665766144   DEBUG: scraper: CreateSearchUrl returned <url>https://api.tmdb.org/3/search/movie?api_key=f090bb54758cabf231fb605d3e3e0468&amp;query=&amp;year=0&amp;language=en</url>
....
2019-08-29 16:01:11.365 T:140099665766144   ERROR: CCurlFile::Open failed with code 422 for https://api.tmdb.org/3/search/movie?api_...anguage=en:
                                            {"errors":["query must be provided"]}

More detailed logs are here:

gaxolujovo.kodi (paste)
Reply
#2
You are using NFO files...

Scanning dir 'nfs://192.168.1.20/volume1/video/Movies/Martian, The (2015)/@eaDir/The Martian (2015).nfo/

Delete your nfo files and try again. If you still have problems POST THE FULL LOG and disable component logging.
My Signature
Links to : Official:Forum rules (wiki) | Official:Forum rules/Banned add-ons (wiki) | Debug Log (wiki)
Links to : HOW-TO:Create Music Library (wiki) | HOW-TO:Create_Video_Library (wiki) || Artwork (wiki) | Basic controls (wiki) | Import-export library (wiki) | Movie sets (wiki) | Movie universe (wiki) | NFO files (wiki) | Quick start guide (wiki)
Reply
#3
OK, disabling "Use video tags" fixed the issue. I must have turned this setting on by error at some point. I imagine some of the videos don't have video tags, but the debug logs don't give that detail so I don't know for sure this is the problem.

That said maybe the behaviour of the 422 error could be handled differently. The error message shows up once for each file with not tag interrupting the scan and the solution is anything but intuitive. I don't know the API but 4xx errors aren't usually remote connection errors. If instead it didn't send the query with an empty string in the first place it would also reduce queries to API which might be better for everyone. 

Should I open a bug for this?
Reply
#4
(2019-08-29, 22:43)Karellen Wrote: You are using NFO files...
 

Argh, that's the synology indexing and/or recycle bin junk. Thanks for catching that.
Reply
#5
No problems.

That Video Tag setting is the worst setting in Kodi. It has been a major problem since it was implemented and catches so many people out. The reports are so frequent that I added it to the common problems list... https://forum.kodi.tv/showthread.php?tid=336969

But there was no sign of that in your log, for some reason.
My Signature
Links to : Official:Forum rules (wiki) | Official:Forum rules/Banned add-ons (wiki) | Debug Log (wiki)
Links to : HOW-TO:Create Music Library (wiki) | HOW-TO:Create_Video_Library (wiki) || Artwork (wiki) | Basic controls (wiki) | Import-export library (wiki) | Movie sets (wiki) | Movie universe (wiki) | NFO files (wiki) | Quick start guide (wiki)
Reply
#6
(2019-08-29, 23:03)Karellen Wrote: That Video Tag setting is the worst setting in Kodi. It has been a major problem since it was implemented and catches so many people out
The problem is not as much the setting but the implementation. If the internal tag is "this.movie.(2019).mkv" it searches the scraper for "query=this.movie.(2019);year=&amp;language=en" when it should have cleaned it up and searched for "query=this%20movie;year=2019;language=en" or something to that general effect. Even if you go to TMDB and manually search for "the.lion.king" you get zero results. It would be nice if it would fallback to filename/NFO and this problem would not have even been visible to most people.

In the logs above it looks like the internal tag was a "0" and that is what caused the issue for this person.
Reply
#7
@darwindesign

Thanks for that explanation. My understanding is that the tags were meant to act similar to a NFO File. The scraper never needed to be invoked and the scanner would read the tags like reading an nfo file. But I could be wrong as I did not follow its development closely.
My Signature
Links to : Official:Forum rules (wiki) | Official:Forum rules/Banned add-ons (wiki) | Debug Log (wiki)
Links to : HOW-TO:Create Music Library (wiki) | HOW-TO:Create_Video_Library (wiki) || Artwork (wiki) | Basic controls (wiki) | Import-export library (wiki) | Movie sets (wiki) | Movie universe (wiki) | NFO files (wiki) | Quick start guide (wiki)
Reply
#8
(2019-08-30, 07:46)Karellen Wrote: My understanding is...
I have no idea how it was intended to work but it can be a bit tricky to diagnose (only shows in debug logs) and will appear to many as random (as any source with no tags are not affected). When you hit this issue the scraper returns zero results so the dialog box for choosing the correct title never appears (as that is for choosing between possible matches). To make things even more complicated if you go to the files section and try to scrape the file by itself then the system comes back with could not find 'filename' even though it never did a search for 'filename' but rather the 'tag' which serves to obscure the problem. These tags are starting to show up more frequently in certain sources which is sure to lead to more of these issues until it gets patched.
Reply
#9
(2019-08-30, 18:07)darwindesign Wrote: To make things even more complicated if you go to the files section and try to scrape the file by itself then the system comes back with could not find 'filename' even though it never did a search for 'filename' but rather the 'tag' which serves to obscure the problem.
I actually had this exact behaviour as well for weeks in addition to the misleading "remote connection error" message and never realized it was related. Between the remote connection error and the manual search returning incorrect or empty results, I assumed it was related to the issues TMDB had a couple weeks ago where they disabled the search and thought they still had instability so I didn't look into it. Pretty confusing
Reply



Logout Mark Read Team Forum Stats Members Help
TheMovieDB Movie scraper empty query string, API 422 Errors0
This forum uses Lukasz Tkacz MyBB addons.