Hi there,
is there any way to search for a list of movies by name and getting beside their IDs the details as well in one response? I am asking for because I think about the traffic on the server and the limits for the communications which do exist. (40 request per 10secs)
Lets say I'm searching for "Terminator" I get 37 results. Which requires 38 requests to the server to get the information I want. First for getting all IDs and 37 further to get the details each.
Any chance to request all at once?
Can't find a movie or TV show? Login to create it.
Elementu hau kalifikatu edo zerrenda batera gehitzea nahi al duzu?
Ez zara kidea?
Travis Bell Erabiltzailearen Erantzuna
Uztaila 29, 2016 egunean 9:55 AM(e)tan
Hi SHW,
No, not at this time. Only the primary media methods support it.
SHW Erabiltzailearen Erantzuna
Uztaila 29, 2016 egunean 10:10 AM(e)tan
Thanks for your response. Nice to hear from the developer of TMDb himself. Regarding my example and assuming it might give equivalent results on other movies as well it means 10 seconds for each movie? Or do you have any optimization hint for me?
Travis Bell Erabiltzailearen Erantzuna
Uztaila 29, 2016 egunean 10:17 AM(e)tan
No problem.
Can you clarify your question for me? I'm not quite sure I understand.
SHW Erabiltzailearen Erantzuna
Uztaila 29, 2016 egunean 10:31 AM(e)tan
Sure, as mentioned in my question lets consider the given example:
I'm searching for "Terminator" and get 37 results. This requires 38 requests to the server. The first for getting all IDs and 37 further to get the details of each movie. 38 request (lets round it to 40 which are allowed) means I will have to wait 10 seconds before I can search for the next movie name.
Assuming each of my movie names I am searching for will result in about 40 IDs means each searched movie will take 10 seconds.
Means:
6 movies take 1 minute
60 movies take 10 minutes
360 movies take 1 hour
quite a lot from my point of view... so I hope there is any more fluent way to request 360 movies by name.
Travis Bell Erabiltzailearen Erantzuna
Uztaila 29, 2016 egunean 10:41 AM(e)tan
Ok, I guess what I am not clear on is what is taking 10 seconds? Our sever responses are sub 100ms so all your left dealing with at that point is network latency and time to handshake/establish the connection. If you use keep alive, that will save an enormous amount of time. There's another thread I posted about some of this, if you were interested.
https://www.themoviedb.org/talk/571bf39f92514135ff0023ca#571ce70892514115e2003143
SHW Erabiltzailearen Erantzuna
Uztaila 29, 2016 egunean 10:55 AM(e)tan
10 seconds is a server limit for requests. Your API says: We do enforce a small amount of rate limiting. Our current limits are 40 requests every 10 seconds and are limited by IP address
Travis Bell Erabiltzailearen Erantzuna
Uztaila 29, 2016 egunean 11:03 AM(e)tan
You don't have that quite right.
You can make 40 requests every 10 seconds, or, to just average it out 4/s. So that's 240 requests every minute or 14,400 every hour.
SHW Erabiltzailearen Erantzuna
Uztaila 29, 2016 egunean 11:41 AM(e)tan
Yes, that is the same :) 14400 requests divided by 40 requests per movie name means 360 movies at all.
Maybe I am not right with an everage of 40 results per movie name... Do you have a statistical amount for me?
Travis Bell Erabiltzailearen Erantzuna
Uztaila 29, 2016 egunean 11:51 AM(e)tan
Well, there's going to be lots of duplicates across search requests. I'm not sure what you're trying to accomplish exactly. If it's bringing a local cache in house, you'd be better to skip searching and just start at id 1 and iterate up to the last ID found in the
/movie/latest
method. You can see a live count of the number of movies here. As of me writing this there are 293,387 movies, so you could grab every movie within approx. 21 hours.SHW Erabiltzailearen Erantzuna
Uztaila 29, 2016 egunean 12:06 PM(e)tan
Sorry, this is not what I'm driving at. I just have a list of movies on my disc which are named in filename. I want to request those names against your server. However when requesting "Terminator" I get 37 possible IDs. To give me the option of choosing the right details for my file I have to request all 37 details for "Terminator". Although I will only keep one. This is the proceedure for the first movie on my disc. And I assume equivalet workflow for all other files as well.
Therefore I want to know whether 37 results per searched movie name is realistic. I guess you have a statistic about this, haven't you?
Travis Bell Erabiltzailearen Erantzuna
Uztaila 29, 2016 egunean 12:18 PM(e)tan
In that case, you'd be better to try and name your files with at least a year and then parse it out and use the
year
parameter. This will drastically reduce the number of results, and in the vast majority of cases will yield the proper result as the first result. This is how most media centres like Kodi or Plex do it.Only has a single result.
That is impossible to say, searches like "Batman" have 80 results but a query for Batman in the year 2005 only has 5 results. I wouldn't look at it that way, improve your query and the results will become much more relevant.
SHW Erabiltzailearen Erantzuna
Uztaila 29, 2016 egunean 1:06 PM(e)tan
Well the year is not present at the moment. I have to rethink the procedure. At the moment I tend to request the first result only and manually request the others when I dicide that the result does not fit. Thanks for you help.
Travis Bell Erabiltzailearen Erantzuna
Uztaila 29, 2016 egunean 1:08 PM(e)tan
No problem.