Wiki Navigation
- Loading...
Movie Info Scripts or Grabbers, such as IMDB Scripts, are used to 'grab' data from IMDB or other Movie Info websites and import the data into the Videos database so that actors, genres, plot descriptions and other information will display for your movies.
A number of movie info scripts/grabbers are provided with MediaPortal. These may be updated and selected in Configuration > Videos > Video Database - Settings. The Movie Info Scripts or Grabber files are located in the [userdata]\Scripts\MovieInfo folder
Then you may 'grab' data either by scanning the database in or by looking up a movie in MediaPortal: seeConfiguration > Videos > Video Database - Scan Using MediaPortal > Videos
Creating a Movie Info Script/Grabber
1. See: Movie Info Grabbers - Introduction / Updates / DevNotes / FAQ / General Support
2. Implement the IIMDBScriptGrabber interface
public interface IIMDBScriptGrabber { // get the list on find films specified by the title void FindFilm(string title, int limit, ArrayList elements); // get movie detail from a url bool GetDetails(IMDB.IMDBUrl url, ref IMDBMovie movieDetails); // name of garbber string GetName(); // language of grabbed site // language of grabbed site string GetLanguage(); }
Example
//css_reference "core.dll"; //css_reference "Databases.dll"; //css_reference "utils.dll"; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.IO; using System.Net; using System.Collections; using System.Web; using System.Text.RegularExpressions; using MediaPortal.Util; using MediaPortal.Video.Database; // change to Grabber, this for avoid to load by mediaportal class Grabber_Template : MediaPortal.Video.Database.IIMDBScriptGrabber { public Grabber() { } void MediaPortal.Video.Database.IIMDBScriptGrabber.FindFilm(string strSearch, int iLimit, ArrayList elements) { // code for search for movie titles // ............. //............. // if movie found add to listing MediaPortal.Video.Database.IMDB.IMDBUrl url = new MediaPortal.Video.Database.IMDB.IMDBUrl(strURL, strTitle + " (imdb_com)", "IMDB"); elements.Add(url); } bool MediaPortal.Video.Database.IIMDBScriptGrabber.GetDetails(MediaPortal.Video.Database.IMDB.IMDBUrl url, ref MediaPortal.Video.Database.IMDBMovie movieDetails) { movieDetails.Reset(); // Define here your grabber database name movieDetails.Database = "IMDB"; // preces the web page defined by the url // ................ // ................ // then fill the database // movieDetails.IMDBNumber (string, unique IMDB Movie ID, from version 1.2.0 ALPHA and above // very important MP video database field which is used to get covers and // fanarts, also is used as helper ID for getting actors info) // movieDetails.Year (integer) // movieDetails.Genre (string, for multi genre movies use "/" as genre separator) // movieDetails.Votes (string) // movieDetails.Top250 (integer) // movieDetails.TagLine (string) // movieDetails.PlotOutline (string) // movieDetails.ThumbURL (string) // movieDetails.Plot (string) // movieDetails.Cast (string, to separate actor from role use "Actor name as Role \n" // MP will parse string and divide actor from role searching for // "as", each actor and role line must ends with \n // which is line feed character) // movieDetails.RunTime (integer - > represents minutes) // movieDetails.MPARating (string) // movieDetails.Rating (float) // movieDetails.WritingCredits (string, movie scenario writer) // movieDetails.Director (string) // // For version 1.2.0 Alpha and above (do not use for older versions beacuse script will fail) // movieDetails.UserReview (string) // movieDetails.FanartURL (string) // found some information return true; // else return false; } string MediaPortal.Video.Database.IIMDBScriptGrabber.GetName() { // Grabber description return "IMDB grabber "; } string MediaPortal.Video.Database.IIMDBScriptGrabber.GetLanguage() { // Grabber language return "EN"; } // a general procedure to get a web page // use like : // string absoluteUri; // string strURL = "http://us.imdb.com/Tsearch?title=" + strSearch; // string strBody = GetPage(strURL, "utf-8", out absoluteUri); private string GetPage(string strURL, string strEncode, out string absoluteUri) { string strBody = ""; absoluteUri = String.Empty; Stream ReceiveStream = null; StreamReader sr = null; WebResponse result = null; try { // Make the Webrequest //Log.Info("IMDB: get page:{0}", strURL); WebRequest req = WebRequest.Create(strURL); result = req.GetResponse(); ReceiveStream = result.GetResponseStream(); // Encoding: depends on selected page Encoding encode = System.Text.Encoding.GetEncoding(strEncode); sr = new StreamReader(ReceiveStream, encode); strBody = sr.ReadToEnd(); absoluteUri = result.ResponseUri.AbsoluteUri; } catch (Exception) { //Log.Error("Error retreiving WebPage: {0} Encoding:{1} err:{2} stack:{3}", strURL, strEncode, ex.Message, ex.StackTrace); } finally { if (sr != null) { try { sr.Close(); } catch (Exception) { } } if (ReceiveStream != null) { try { ReceiveStream.Close(); } catch (Exception) { } } if (result != null) { try { result.Close(); } catch (Exception) { } } } return strBody; } // END GetPage()
}
3. Submit your grabber in the Development sub forum for Movie Info Grabbers.
This page has no comments.