Normal
Hi @lopez.tuparles, I had a look at your script as @megahorst told me about it.First point is that I didn't noticed the problem with " do not work. The " that you reported @megahorst. The movie Otto - Der film seems to work fine for me, everything (except empty fields of course) are well retrieved. But perhaps I missed something, could you provide a screenshot on configuration tool? Second point regarding code is that it could be clearly optimized:1. You should not retrieve movie details in FindFilm() (call to GetTMDBMovieDetails()) this can make search very long on some movies, try with "Cars" you will understand2. You can really simplify your code using deserialization functionalities of JavaScriptSerializer object to parse JSON. This allow to create a dictionnary in which you can easily navigate to retrieve data. Here is a small code example: JavaScriptSerializer deserializer = new JavaScriptSerializer(); Dictionary<string, object> deserializedDictionary = deserializer.Deserialize<Dictionary<string, object>>(reader.ReadToEnd()); Dictionary<string, object> movie = deserializedDictionary["movie"] as Dictionary<string, object>; if (movie.ContainsKey("title") == true) movieDetails.Title = (string)movie["title"]; else movieDetails.Title = (string)movie["originalTitle"]; (where "movie" is the name of the root object, I don't know its name in TMDB as I have not tested. I used this script for Allocine API data retrieval before they improved their security on the API few days ago)This will avoid you to use regular expression and thus avoid data extraction problems. (I hate regular expressions)Let me know if you need help on this (you can PM me in French)Fred
Hi @lopez.tuparles,
I had a look at your script as @megahorst told me about it.
First point is that I didn't noticed the problem with " do not work. The " that you reported @megahorst. The movie Otto - Der film seems to work fine for me, everything (except empty fields of course) are well retrieved. But perhaps I missed something, could you provide a screenshot on configuration tool?
Second point regarding code is that it could be clearly optimized:
1. You should not retrieve movie details in FindFilm() (call to GetTMDBMovieDetails()) this can make search very long on some movies, try with "Cars" you will understand
2. You can really simplify your code using deserialization functionalities of JavaScriptSerializer object to parse JSON. This allow to create a dictionnary in which you can easily navigate to retrieve data. Here is a small code example:
JavaScriptSerializer deserializer = new JavaScriptSerializer();
Dictionary<string, object> deserializedDictionary = deserializer.Deserialize<Dictionary<string, object>>(reader.ReadToEnd());
Dictionary<string, object> movie = deserializedDictionary["movie"] as Dictionary<string, object>;
if (movie.ContainsKey("title") == true)
movieDetails.Title = (string)movie["title"];
else
movieDetails.Title = (string)movie["originalTitle"];
(where "movie" is the name of the root object, I don't know its name in TMDB as I have not tested. I used this script for Allocine API data retrieval before they improved their security on the API few days ago)
This will avoid you to use regular expression and thus avoid data extraction problems. (I hate regular expressions)
Let me know if you need help on this (you can PM me in French)
Fred