public virtual void Grab(GrabItem item) { GameObject collidingObject = item.GetCollidingObject(); collidingObject.transform.SetParent(this.transform); collidingObject.GetComponent <Rigidbody>().isKinematic = true; }
private void grab() { if (!grabbed) { grabbable = RaycastForGrabbableObject(); if (!grabbable) { return; } } if (controller.GetPressDown(SteamVR_Controller.ButtonMask.Trigger)) {// force grab grabbed = true; DisplayLine(false, transform.position); } else if (controller.GetPress(SteamVR_Controller.ButtonMask.Trigger)) {// force move grabbable.Move(velocity, angularVelocity); } else if (controller.GetPressUp(SteamVR_Controller.ButtonMask.Trigger)) {// release grabbed = false; } }
public virtual void Release(GrabItem item) { GameObject objectInHand = item.GetObjectInHand(); objectInHand.GetComponent <Rigidbody>().isKinematic = false; objectInHand.transform.SetParent(objectInHand.GetComponent <Grabbable>().Parent.transform); }
public void DropHeldItem() { if (!held_item.Drop()) { return; } held_item = null; holding_item = false; }
void Start() { player = GameObject.FindGameObjectWithTag("Player"); controlScript = player.GetComponent <PlayerControls>(); interactWithUIObject = player.GetComponent <InteractWithUIObject>(); grabbingItem = player.GetComponentInChildren <GrabItem>(); CamToMouse = player.GetComponentInChildren <CameraToMouse>(); }
public override void Release(GrabItem item) { GameObject objectInHand = item.GetObjectInHand(); if (objectInHand != null && objectInHand.tag == "FlightStick") { objectInHand.GetComponent <FlightStick>().ReleaseHand(); item.HandModel.SetParent(item.transform); item.HandModel.localPosition = Vector3.zero; item.HandModel.localEulerAngles = new Vector3(-10, 0, -90); } }
public override void Release(GrabItem item) { GameObject objectInHand = item.GetObjectInHand(); if (objectInHand != null && objectInHand.tag == "Throttle") { objectInHand.GetComponent <ThrottleControl>().IsGrabbed = false; item.HandModel.SetParent(item.transform); item.HandModel.localPosition = Vector3.zero; item.HandModel.localEulerAngles = new Vector3(-10, 0, -90); } }
private void GrabItem(GrabItem item) { item.Grab(); held_item_last = held_item; held_item = item; holding_item = true; SetActionToolTip(""); // NEED ORGANIZATION IMPROVEMENT // Graphics // change the sprite to hand_up }
public override void Grab(GrabItem item) { GameObject collidingObject = item.GetCollidingObject(); if (collidingObject != null && collidingObject.tag == "FlightStick") { Transform anchor = item.HandType == XRNode.RightHand ? collidingObject.transform.GetChild(0).GetChild(0).GetChild(0) : collidingObject.transform.GetChild(0).GetChild(0).GetChild(1); collidingObject.GetComponent <FlightStick>().SetHand(item.Hand); item.HandModel.position = anchor.position; item.HandModel.rotation = anchor.rotation; item.HandModel.SetParent(anchor); } }
public override void Grab(GrabItem item) { GameObject collidingObject = item.GetCollidingObject(); if (collidingObject != null && collidingObject.tag == "Throttle") { collidingObject.GetComponent <ThrottleControl>().IsGrabbed = true; Transform anchor = item.HandType == XRNode.RightHand ? collidingObject.transform.GetChild(0) : collidingObject.transform.GetChild(1); item.HandModel.position = anchor.position; item.HandModel.rotation = anchor.rotation; item.HandModel.SetParent(anchor); } }
// PRIVATE MODIFIERS private void UpdateItemUsage() { bool input_action = Input.GetMouseButtonDown(0); // Pick up item, drop item, do something with item if (input_action) { if (!holding_item) { // Pick up an item (if over one) if (hovered_item != null) { GrabItem gi = hovered_item.GetComponent <GrabItem>(); if (gi != null) { GrabItem(gi); hovered_item = null; } } } else if (holding_item && allow_item_use) { // Use held item on hovered item (if there is one) // or drop the item (if there isn't a hovered item) if (hovered_item != null) { // if the item can be used, use it, otherwise, drop it if (!held_item.Use(hovered_item)) { DropHeldItem(); } } else { DropHeldItem(); } } } }
private List<DocType> ReloadDocTypes() { List<DocType> docTypeList = new List<DocType>(); XDocument xdoc = XDocument.Load(xmlFName); try { var docTypes = from docType in xdoc.Descendants("filetype") orderby docType.Attribute("name").Value select new { name = docType.Attribute("name").Value, good = docType.Descendants("good"), bad = docType.Descendants("bad"), grabtext = docType.Descendants("grabtext"), docdate = docType.Descendants("docdate"), moveto = docType.Descendants("moveto"), renameto = docType.Descendants("renameto"), thumbs = docType.Descendants("thumb") }; //Loop through results foreach (var docType in docTypes) { DocType dt = new DocType(); dt.dtName = docType.name; // Strings required for match foreach (var gd in docType.good) { CheckItem ci = new CheckItem(gd.Value, gd.Attribute("req").Value); dt.goodStrings.Add(ci); } // Strings not required for match foreach (var bd in docType.bad) { CheckItem ci = new CheckItem(bd.Value, bd.Attribute("req").Value); dt.badStrings.Add(ci); } // Text that should be extracted from file foreach (var gt in docType.grabtext) { GrabItem gi = new GrabItem(gt.Attribute("name").Value, gt.Attribute("from").Value, gt.Value); dt.grabTexts.Add(gi); } // Move-to path foreach (var mt in docType.moveto) { dt.moveTo = mt.Value; } // Rename-to value foreach (var rt in docType.renameto) { dt.renameTo = rt.Value; } // Thumbnails foreach (var th in docType.thumbs) { dt.thumbFileNames.Add(th.Value); } // Store the doc-type docTypeList.Add(dt); } } catch { } return docTypeList; }
public bool JustDropped(GrabItem item) { return(GetLastHeldItem() == item && GetHeldItem() != item); }
private void Start() { grabSensorScript = transform.Find("Main Camera").transform.Find("Item Grab Sensor").GetComponent <GrabItem>(); }
private string PageBody(string pageBodyName) { int count = grabItems.Count(bodyDetail => bodyDetail.DisplayName == pageBodyName && bodyDetail.Content != null); // check, if the data is already there if (count == 0) { #region add PageBody if missing GrabItem detail = new GrabItem(pageBodyName, ""); detail.Load(ScriptNode, pageBodyName); try { Stopwatch watch = new Stopwatch(); watch.Reset(); watch.Start(); string strTemp = ""; string content = ""; string pagename = ""; foreach (var grabDetailItem in grabItems.Where(grabDetailItem => grabDetailItem.DisplayName == pageBodyName)) { pagename = grabDetailItem.GrabName; break; } if (pagename == "") { content = "Error: Cannot find the definition for the page '" + pageBodyName + "'"; detail = new GrabItem(pageBodyName, "") { Result = content, }; grabItems.Add(detail); return content; } string absoluteUri = ""; // get default values for grabber script string strAccept = ""; string strUserAgent = ""; string strHeaders = ""; string strEncoding = ""; try { strEncoding = ScriptNode.SelectSingleNodeFast("Encoding").InnerText; } catch (Exception) { strEncoding = ""; } try { strAccept = ScriptNode.SelectSingleNodeFast("Accept").InnerText; } catch (Exception) { strAccept = ""; } try { strUserAgent = ScriptNode.SelectSingleNodeFast("UserAgent").InnerText; } catch (Exception) { strUserAgent = ""; } try { strHeaders = ScriptNode.SelectSingleNodeFast("Headers").InnerText; } catch (Exception) { strHeaders = ""; } // if (pagename == "LinkGeneric2") pagename.Trim(); string strStart = XmlConvert.DecodeName(ScriptNode.SelectSingleNodeFast("Details/KeyStart" + pagename).InnerText); string strEnd = XmlConvert.DecodeName(ScriptNode.SelectSingleNodeFast("Details/KeyEnd" + pagename).InnerText); string strParam1 = XmlConvert.DecodeName(ScriptNode.SelectSingleNodeFast("Details/KeyStart" + pagename).Attributes["Param1"].InnerText); string strParam2 = XmlConvert.DecodeName(ScriptNode.SelectSingleNodeFast("Details/KeyStart" + pagename).Attributes["Param2"].InnerText); string strIndex = XmlConvert.DecodeName(ScriptNode.SelectSingleNodeFast("Details/Key" + pagename + "Index").InnerText); string strPage = XmlConvert.DecodeName(ScriptNode.SelectSingleNodeFast("Details/Key" + pagename + "Page").InnerText); string strEncodingSubPage = ""; try { strEncodingSubPage = XmlConvert.DecodeName(ScriptNode.SelectSingleNodeFast("Details/KeyEncoding" + pagename).InnerText); } catch (Exception) { strEncodingSubPage = strEncoding; // use default encoding } string strActivePage = PageBody(strPage); if (strStart.Length > 0) { strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, ScriptNode), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, ScriptNode), strStart, strEnd).Trim(); content = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent); } else content = ""; watch.Stop(); detail = new GrabItem(pageBodyName, absoluteUri) { Content = content, Runtime = "(" + (watch.ElapsedMilliseconds) + " ms)" }; // add and grab grabItems.Add(detail); } catch (Exception ex) { detail = new GrabItem(pageBodyName, ex.Message) { Content = "Error loading '" + pageBodyName + "' - " + ex.StackTrace, }; grabItems.Add(detail); } #endregion } foreach (GrabItem grabItem in grabItems.Where(bodyDetail => bodyDetail.DisplayName == pageBodyName && bodyDetail.Content != null)) { grabItem.Usage++; return grabItem.Content; } return string.Empty; #region old code //if (bodyDetails.Count(bodyDetail => bodyDetail.DisplayName == pageBodyName) == 0) //{ // #region add PageBody if missing // BodyDetail detail; // try // { // Stopwatch watch = new Stopwatch(); // watch.Reset(); watch.Start(); // string strTemp = ""; // string content = ""; // string pagename = ""; // //= grabDetailItems.AsEnumerable().First(grabDetailItem => grabDetailItem.DisplayName == pageBodyName).GrabName; // foreach (var grabDetailItem in grabDetailItems.Where(grabDetailItem => grabDetailItem.DisplayName == pageBodyName)) // { // pagename = grabDetailItem.GrabName; // break; // } // if (pagename == "") // { // content = "Error: Cannot find the definition for the page '" + pageBodyName + "'"; // detail = new BodyDetail(pageBodyName, "") // { // Content = content, // }; // bodyDetails.Add(detail); // return content; // } // string absoluteUri = ""; // // get default values for grabber script // string strAccept = ""; // string strUserAgent = ""; // string strHeaders = ""; // string strEncoding = ""; // try { strEncoding = ScriptNode.SelectSingleNodeFast("Encoding").InnerText; } // catch (Exception) { strEncoding = ""; } // try { strAccept = ScriptNode.SelectSingleNodeFast("Accept").InnerText; } // catch (Exception) { strAccept = ""; } // try { strUserAgent = ScriptNode.SelectSingleNodeFast("UserAgent").InnerText; } // catch (Exception) { strUserAgent = ""; } // try { strHeaders = ScriptNode.SelectSingleNodeFast("Headers").InnerText; } // catch (Exception) { strHeaders = ""; } // // if (pagename == "LinkGeneric2") pagename.Trim(); // string strStart = XmlConvert.DecodeName(ScriptNode.SelectSingleNodeFast("Details/KeyStart" + pagename).InnerText); // string strEnd = XmlConvert.DecodeName(ScriptNode.SelectSingleNodeFast("Details/KeyEnd" + pagename).InnerText); // string strParam1 = XmlConvert.DecodeName(ScriptNode.SelectSingleNodeFast("Details/KeyStart" + pagename).Attributes["Param1"].InnerText); // string strParam2 = XmlConvert.DecodeName(ScriptNode.SelectSingleNodeFast("Details/KeyStart" + pagename).Attributes["Param2"].InnerText); // string strIndex = XmlConvert.DecodeName(ScriptNode.SelectSingleNodeFast("Details/Key" + pagename + "Index").InnerText); // string strPage = XmlConvert.DecodeName(ScriptNode.SelectSingleNodeFast("Details/Key" + pagename + "Page").InnerText); // string strActivePage = PageBody(strPage); // string strEncodingSubPage = ""; // try // { // strEncodingSubPage = XmlConvert.DecodeName(ScriptNode.SelectSingleNodeFast("Details/KeyEncoding" + pagename).InnerText); // } // catch (Exception) // { // strEncodingSubPage = ""; // } // if (strStart.Length > 0) // { // strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, ScriptNode), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, ScriptNode), strStart, strEnd).Trim(); // content = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent); // } // else // content = ""; // watch.Stop(); // detail = new BodyDetail(pageBodyName, absoluteUri) // { // Content = content, // Runtime = "(" + (watch.ElapsedMilliseconds) + " ms)" // }; // // add and grab // bodyDetails.Add(detail); // } // catch (Exception ex) // { // detail = new BodyDetail(pageBodyName, ex.Message) // { // Content = ex.StackTrace, // }; // bodyDetails.Add(detail); // } // #endregion //} //foreach (BodyDetail bodyDetail in bodyDetails.Where(bodyDetail => bodyDetail.DisplayName == pageBodyName)) //{ // bodyDetail.Usage++; // return bodyDetail.Content; //} //return string.Empty; #endregion }
public string[] GetDetail_New(string strUrl, string strPathImg, string strConfigFile, bool saveImage, string preferredLanguage, string personLimit, string titleLimit, string getRoles, string mediafile = null) { //Grabber.Data.GrabberScript data = new Grabber.Data.GrabberScript(); //Data.GrabberScript.GrabResultDataTable results = new Data.GrabberScript.GrabResultDataTable(); string[] datas = new string[80]; // 0-39 = original fields, 40-79 mapped fields elements.Clear(); // delete all loaded content - will be loaded on demand later automatically with items foreach (var grabItem in grabItems.Where(grabItem => grabItem.IsRedirectionURL)) { grabItem.Content = null; } string strTemp = string.Empty; //string strBody = string.Empty; //string strBodyDetails2 = string.Empty; //string strBodyPersons = string.Empty; //string strBodyTitles = string.Empty; //string strBodyCertification = string.Empty; //string strBodyComment = string.Empty; //string strBodyDescription = string.Empty; //string strBodyCover = string.Empty; //string strEncoding = string.Empty; // added for manual encoding override (global setting for all webgrabbing) string strEncodingSubPage = string.Empty; // added to override Sub Page encoding GrabItem grabitem = new GrabItem(); string strStart = string.Empty; string strEnd = string.Empty; string strIndex = string.Empty; string strPage = string.Empty; string strActivePage = string.Empty; string absoluteUri; string strTitle = string.Empty; string strRate = string.Empty; string strRate2 = string.Empty; string strBasedRate = string.Empty; string strParam1 = string.Empty; string strParam3 = string.Empty; string strParam2 = string.Empty; string strMaxItems = string.Empty; string strLanguage = string.Empty; string strGrabActorRoles = string.Empty; bool boolGrabActorRoles = false; string allNames = string.Empty; string allRoles = string.Empty; int iStart = 0; int iEnd = 0; // Reset all webpage content BodyDetail = string.Empty; BodyDetail2 = string.Empty; BodyLinkGeneric1 = string.Empty; BodyLinkGeneric2 = string.Empty; BodyLinkImg = string.Empty; BodyLinkPersons = string.Empty; BodyLinkTitles = string.Empty; BodyLinkCertification = string.Empty; BodyLinkComment = string.Empty; BodyLinkSyn = string.Empty; BodyLinkMultiPosters = string.Empty; BodyLinkPhotos = string.Empty; BodyLinkPersonImages = string.Empty; BodyLinkMultiFanart = string.Empty; BodyLinkTrailer = string.Empty; BodyLinkDetailsPath = string.Empty; // reset filesystem content MovieDirectory = string.Empty; MovieFilename = string.Empty; #region Load the configuration file // old version XmlDocument doc = new XmlDocument(); doc.Load(strConfigFile); XmlNode script = doc.ChildNodes[1].FirstChild; // new version: using (var fs = new FileStream(strConfigFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { grabberscript = new Data.GrabberScript(); //// synchronize dataset with hierarchical XMLdoc //xmlDoc = new XmlDataDocument(data); //xmlDoc.Load(fs); grabberscript.ReadXml(fs); fs.Close(); } #endregion // old version strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartBody").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndBody").InnerText); // new version //strStart = grabberscript.SearchDetails[0].Start; //strEnd = grabberscript.SearchDetails[0].End; // this should be loaded per detail item later, when using new methods strBasedRate = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/BaseRating").InnerText); // load Ratebase - valid for all items! #region Set DetailsPath BodyLinkDetailsPath = "<url>" + strUrl + "</url>"; if (strUrl.LastIndexOf("/", StringComparison.Ordinal) > 0) { BodyLinkDetailsPath += Environment.NewLine; BodyLinkDetailsPath += "<baseurl>" + strUrl.Substring(0, strUrl.LastIndexOf("/", StringComparison.Ordinal)) + "</baseurl>"; BodyLinkDetailsPath += Environment.NewLine; BodyLinkDetailsPath += "<pageurl>" + strUrl.Substring(strUrl.LastIndexOf("/", StringComparison.Ordinal) + 1) + "</pageurl>"; BodyLinkDetailsPath += Environment.NewLine; BodyLinkDetailsPath += "<replacement>" + strUrl.Substring(0, strUrl.LastIndexOf("/", StringComparison.Ordinal)) + "%replacement%" + strUrl.Substring(strUrl.LastIndexOf("/", StringComparison.Ordinal) + 1) + "</replacement>"; } #endregion #region Fetch the basic Details page and update DetailsPath, if possible if (strUrl.ToLower().StartsWith("http")) { BodyDetail = GrabUtil.GetPage(strUrl, strEncoding, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent); } else { BodyDetail = GrabUtil.GetFileContent(strUrl, strEncoding); // Read page from file ! string physicalFile = (mediafile != null && File.Exists(mediafile)) ? mediafile : strUrl; if (File.Exists(physicalFile)) { MovieDirectory = Path.GetDirectoryName(physicalFile); MovieFilename = Path.GetFileNameWithoutExtension(physicalFile); // Set DetailsPath BodyLinkDetailsPath += Environment.NewLine; BodyLinkDetailsPath += "<directory>" + MovieDirectory + "</directory>"; BodyLinkDetailsPath += Environment.NewLine; BodyLinkDetailsPath += "<filename>" + MovieFilename + "</filename>"; if (MovieDirectory != null) { string[] files = Directory.GetFiles(MovieDirectory, "*", SearchOption.AllDirectories); //foreach (string extension in files.Select(file => Path.GetExtension(file)).Distinct().ToList()) //{ // BodyLinkDetailsPath += Environment.NewLine; // BodyLinkDetailsPath += "<" + extension + "-files>"; // foreach (string file in files.Where(file => file.EndsWith("." + extension)).ToList()) // { // BodyLinkDetailsPath += Environment.NewLine; // BodyLinkDetailsPath += "<" + extension + ">" + file + "</" + extension + ">"; // } // BodyLinkDetailsPath += Environment.NewLine; // BodyLinkDetailsPath += "</" + extension + "-files>"; //} BodyLinkDetailsPath += Environment.NewLine; BodyLinkDetailsPath += "<jpg-files>"; foreach (string file in files.Where(file => file.EndsWith(".jpg")).ToList()) { BodyLinkDetailsPath += Environment.NewLine; BodyLinkDetailsPath += "<jpg>" + file + "</jpg>"; } BodyLinkDetailsPath += Environment.NewLine; BodyLinkDetailsPath += "</jpg-files>"; BodyLinkDetailsPath += Environment.NewLine; BodyLinkDetailsPath += "<other-files>"; foreach (string file in files.Where(file => !file.EndsWith(".jpg")).ToList()) { BodyLinkDetailsPath += Environment.NewLine; BodyLinkDetailsPath += "<other>" + file + "</other>"; } BodyLinkDetailsPath += Environment.NewLine; BodyLinkDetailsPath += "</other-files>"; } } } var htmlUtil = new HtmlUtil(); if (strStart != "") { iStart = BodyDetail.IndexOf(strStart); if (iStart > 0) { iEnd = strEnd != "" ? BodyDetail.IndexOf(strEnd, iStart) : BodyDetail.Length; iStart += strStart.Length; if (iEnd - iStart > 0) BodyDetail = BodyDetail.Substring(iStart, iEnd - iStart); } } #endregion grabItems.Add(new GrabItem("", strUrl) { Content = BodyDetail, IsRedirectionURL = true }); grabItems.Add(new GrabItem("DetailsPath", "") { Content = BodyLinkDetailsPath, IsRedirectionURL = true }); #region Load Sub Pages into Memory ***** // Will be used for Secondary Website Infos! // ***** URL Redirection Details 2 Base Page ***** // Will be used for Secondary Website Infos! strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartDetails2").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndDetails2").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartDetails2").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartDetails2").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyDetails2Index").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyDetails2Page").InnerText); try { strEncodingSubPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEncodingDetails2").InnerText); } catch (Exception) { strEncodingSubPage = ""; } strActivePage = LoadPage(strPage); if (strStart.Length > 0) { strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); BodyDetail2 = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent); } else BodyDetail2 = ""; // ***** URL Redirection Generic 1 ***** strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkGeneric1").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndLinkGeneric1").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkGeneric1").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkGeneric1").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkGeneric1Index").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkGeneric1Page").InnerText); strActivePage = LoadPage(strPage); try { strEncodingSubPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEncodingLinkGeneric1").InnerText); } catch (Exception) { strEncodingSubPage = ""; } if (strStart.Length > 0) { strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); BodyLinkGeneric1 = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent); } else BodyLinkGeneric1 = ""; // ***** URL Redirection Generic 2 ***** strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkGeneric2").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndLinkGeneric2").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkGeneric2").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkGeneric2").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkGeneric2Index").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkGeneric2Page").InnerText); strActivePage = LoadPage(strPage); try { strEncodingSubPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEncodingLinkGeneric2").InnerText); } catch (Exception) { strEncodingSubPage = ""; } if (strStart.Length > 0) { strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); BodyLinkGeneric2 = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent); } else BodyLinkGeneric2 = ""; // ***** URL Redirection IMG ***** strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkImg").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndLinkImg").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkImg").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkImg").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkImgIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkImgPage").InnerText); strActivePage = LoadPage(strPage); try { strEncodingSubPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEncodingLinkImg").InnerText); } catch (Exception) { strEncodingSubPage = ""; } if (strStart.Length > 0) { strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); BodyLinkImg = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent); } else BodyLinkImg = ""; // ***** URL Redirection Persons ***** // Will be used for persons, if available ! strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkPersons").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndLinkPersons").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkPersons").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkPersons").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkPersonsIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkPersonsPage").InnerText); strActivePage = LoadPage(strPage); try { strEncodingSubPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEncodingLinkPersons").InnerText); } catch (Exception) { strEncodingSubPage = ""; } if (strStart.Length > 0) { strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); BodyLinkPersons = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent); } else BodyLinkPersons = ""; // ***** URL Redirection Titles ***** // Will be used for TTitle, if available ! strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkTitles").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndLinkTitles").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkTitles").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkTitles").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkTitlesIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkTitlesPage").InnerText); strActivePage = LoadPage(strPage); try { strEncodingSubPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEncodingLinkTitles").InnerText); } catch (Exception) { strEncodingSubPage = ""; } if (strStart.Length > 0) { strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); BodyLinkTitles = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent); } else BodyLinkTitles = ""; // ***** URL Redirection Certification ***** // Will be used for Certification Details, if available ! strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkCertification").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndLinkCertification").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkCertification").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkCertification").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkCertificationIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkCertificationPage").InnerText); strActivePage = LoadPage(strPage); try { strEncodingSubPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEncodingLinkCertification").InnerText); } catch (Exception) { strEncodingSubPage = ""; } if (strStart.Length > 0) { strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); BodyLinkCertification = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent); } else BodyLinkCertification = ""; // ***** URL Redirection Comment ***** // Will be used for Comment Details, if available ! strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkComment").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndLinkComment").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkComment").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkComment").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkCommentIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkCommentPage").InnerText); strActivePage = LoadPage(strPage); try { strEncodingSubPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEncodingLinkComment").InnerText); } catch (Exception) { strEncodingSubPage = ""; } if (strStart.Length > 0) { strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); BodyLinkComment = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent); } else BodyLinkComment = ""; // ***** URL Redirection Description ***** // Will be used for Description Details, if available ! strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkSyn").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndLinkSyn").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkSyn").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkSyn").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkSynIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkSynPage").InnerText); strActivePage = LoadPage(strPage); try { strEncodingSubPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEncodingLinkSyn").InnerText); } catch (Exception) { strEncodingSubPage = ""; } if (strStart.Length > 0) { strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); BodyLinkSyn = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent); } else BodyLinkSyn = ""; // ***** URL Redirection MultiPosters ***** // Will be used for MultiPosters Details, if available ! strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkMultiPosters").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndLinkMultiPosters").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkMultiPosters").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkMultiPosters").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkMultiPostersIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkMultiPostersPage").InnerText); strActivePage = LoadPage(strPage); try { strEncodingSubPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEncodingLinkMultiPosters").InnerText); } catch (Exception) { strEncodingSubPage = ""; } if (strStart.Length > 0) { strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); BodyLinkMultiPosters = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent); } else BodyLinkMultiPosters = ""; // ***** URL Redirection Photos ***** // Will be used for Photos Details, if available ! strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkPhotos").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndLinkPhotos").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkPhotos").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkPhotos").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkPhotosIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkPhotosPage").InnerText); strActivePage = LoadPage(strPage); try { strEncodingSubPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEncodingLinkPhotos").InnerText); } catch (Exception) { strEncodingSubPage = ""; } if (strStart.Length > 0) { strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); BodyLinkPhotos = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent); } else BodyLinkPhotos = ""; // ***** URL Redirection PersonImages ***** // Will be used for PersonImages Details, if available ! strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkPersonImages").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndLinkPersonImages").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkPersonImages").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkPersonImages").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkPersonImagesIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkPersonImagesPage").InnerText); strActivePage = LoadPage(strPage); try { strEncodingSubPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEncodingLinkPersonImages").InnerText); } catch (Exception) { strEncodingSubPage = ""; } if (strStart.Length > 0) { strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); BodyLinkPersonImages = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent); } else BodyLinkPersonImages = ""; // ***** URL Redirection MultiFanart ***** // Will be used for MultiFanart Details, if available ! strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkMultiFanart").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndLinkMultiFanart").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkMultiFanart").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkMultiFanart").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkMultiFanartIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkMultiFanartPage").InnerText); strActivePage = LoadPage(strPage); try { strEncodingSubPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEncodingLinkMultiFanart").InnerText); } catch (Exception) { strEncodingSubPage = ""; } if (strStart.Length > 0) { strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); BodyLinkMultiFanart = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent); } else BodyLinkMultiFanart = ""; // ***** URL Redirection Trailer ***** // Will be used for Trailer Details, if available ! strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkTrailer").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndLinkTrailer").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkTrailer").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLinkTrailer").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkTrailerIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLinkTrailerPage").InnerText); strActivePage = LoadPage(strPage); try { strEncodingSubPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEncodingLinkTrailer").InnerText); } catch (Exception) { strEncodingSubPage = ""; } if (strStart.Length > 0) { strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); BodyLinkTrailer = GrabUtil.GetPage(strTemp, (string.IsNullOrEmpty(strEncodingSubPage)) ? strEncoding : strEncodingSubPage, out absoluteUri, new CookieContainer(), strHeaders, strAccept, strUserAgent); } else BodyLinkTrailer = ""; #endregion #region ************* Now get the detail fields *************************** foreach (GrabDetail grabDetailItem in GrabDetailItems) { try { switch ((int) grabDetailItem.OutputMapping) { //case (int)Grabber_Output.PictureURL: case (int) Grabber_Output.PicturePathShort: break; case (int) Grabber_Output.PicturePathLong: { strTemp = grabitem.Load(script, grabDetailItem.GrabName); if (strTemp.Length > 0) { datas[(int) Grabber_Output.PictureURL] = strTemp; //Picture if (saveImage == true) { if (string.IsNullOrEmpty(datas[(int) Grabber_Output.OriginalTitle])) GrabUtil.DownloadCoverArt(strPathImg, strTemp, datas[(int) Grabber_Output.TranslatedTitle], out strTemp); else GrabUtil.DownloadCoverArt(strPathImg, strTemp, datas[(int) Grabber_Output.OriginalTitle], out strTemp); // strTemp = MediaPortal.Util.Utils.FilterFileName(strTemp); // Guzzi: removed, as it could change the filename to an already loaded image, thus breaking the "link". datas[(int) Grabber_Output.PicturePathLong] = strPathImg + "\\" + strTemp; } datas[(int) Grabber_Output.PicturePathShort] = strTemp; } break; } case (int) Grabber_Output.URL: datas[(int) Grabber_Output.URL] = strUrl; break; case (int) Grabber_Output.Description: datas[grabDetailItem.Id] = grabitem.Load(script, grabDetailItem.GrabName) .Replace("&", "&") .Replace("<", "<") .Replace(">", ">") .Replace("\"", """); // strTemp = strTemp.Replace("&", "&").Replace("<", "<").Replace(">", ">").Replace("\"", """).Replace("'", "'"); break; default: if ((int) grabDetailItem.OutputMapping < 40) { datas[(int) grabDetailItem.OutputMapping] = grabitem.Load(script, grabDetailItem.GrabName); } else { // only load data, but do not map to outputfield grabitem.Load(script, grabDetailItem.GrabName); } break; } } catch (Exception ex) { string outputmessage = ex.Message; } } // ***** Original TITLE ***** // datas[(int)Grabber_Output.OriginalTitle] = grabitem.Load(script, "OTitle"); //strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartOTitle").InnerText); //strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndOTitle").InnerText); //strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartOTitle").Attributes["Param1"].InnerText); //strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartOTitle").Attributes["Param2"].InnerText); //strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyOTitleIndex").InnerText); //strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyOTitlePage").InnerText); //strActivePage = this.LoadPage(strPage); //strTitle = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); //strTitle = strTitle.Replace("\n", ""); //if (strTitle.Length > 0) // datas[(int)Grabber_Output.OriginalTitle] = strTitle; //else // datas[(int)Grabber_Output.OriginalTitle] = ""; // ***** Translated TITLE ***** strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartTTitle").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndTTitle").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartTTitle").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartTTitle").Attributes["Param2"].InnerText); strParam3 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyTTitleRegExp").InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyTTitleIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyTTitlePage").InnerText); try { strMaxItems = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyTTitleMaxItems").InnerText); } catch (Exception) { strMaxItems = ""; } try { strLanguage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyTTitleLanguage").InnerText); } catch (Exception) { strLanguage = ""; } strActivePage = LoadPage(strPage); // Overrides from MyFilms plugin: if (!string.IsNullOrEmpty(preferredLanguage)) strLanguage = preferredLanguage; if (!string.IsNullOrEmpty(titleLimit)) strMaxItems = titleLimit; allNames = string.Empty; allRoles = string.Empty; if (strParam1.Length > 0 || strParam3.Length > 0) strTitle = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems, strLanguage, out allNames, out allRoles).Trim(); else strTitle = GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTitle = strTitle.Replace("\n", ""); if (strTitle.Length > 0) //Translated Title datas[(int)Grabber_Output.TranslatedTitle] = strTitle; else datas[(int)Grabber_Output.TranslatedTitle] = ""; //else // datas[(int)Grabber_Output.TranslatedTitle] = datas[(int)Grabber_Output.OriginalTitle]; //if (datas[(int)Grabber_Output.OriginalTitle].Length == 0) // datas[(int)Grabber_Output.OriginalTitle] = datas[(int)Grabber_Output.TranslatedTitle]; datas[(int)Grabber_Output.TranslatedTitleAllNames] = allNames; datas[(int)Grabber_Output.TranslatedTitleAllValues] = allRoles; // ***** URL for Image ***** // ***** Fanart ***** // strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartImg").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndImg").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartImg").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartImg").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyImgIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyImgPage").InnerText); strActivePage = LoadPage(strPage); datas[(int)Grabber_Output.Fanart] = ""; // Fanart - only for file grabber if (strStart.StartsWith("#NFO#") || strEnd.StartsWith("#NFO#")) // { if (strStart.StartsWith("#NFO#")) // special handling for NFO files { string covername = strStart.Substring(strStart.IndexOf("#NFO#") + 5); if (covername.Contains("#Filename#")) covername = covername.Replace("#Filename#", MovieFilename); datas[(int)Grabber_Output.PicturePathLong] = MovieDirectory + "\\" + covername; datas[(int)Grabber_Output.PicturePathShort] = covername; if (saveImage == true) { if (string.IsNullOrEmpty(datas[(int)Grabber_Output.OriginalTitle])) GrabUtil.CopyCoverArt(strPathImg, MovieDirectory + "\\" + covername, datas[(int)Grabber_Output.TranslatedTitle], out strTemp); else GrabUtil.CopyCoverArt(strPathImg, MovieDirectory + "\\" + covername, datas[(int)Grabber_Output.OriginalTitle], out strTemp); datas[(int)Grabber_Output.PicturePathLong] = strPathImg + "\\" + strTemp; } datas[(int)Grabber_Output.PicturePathShort] = strTemp; } if (strEnd.StartsWith("#NFO#")) // special handling for NFO files { string fanartname = strEnd.Substring(strEnd.IndexOf("#NFO#") + 5); if (fanartname.Contains("#Filename#")) fanartname = fanartname.Replace("#Filename#", MovieFilename); datas[(int)Grabber_Output.Fanart] = MovieDirectory + "\\" + fanartname; } } else { strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); if (strTemp.Length > 0) { datas[(int)Grabber_Output.PictureURL] = strTemp; //Picture if (saveImage == true) { if (string.IsNullOrEmpty(datas[(int)Grabber_Output.OriginalTitle])) GrabUtil.DownloadCoverArt(strPathImg, strTemp, datas[(int)Grabber_Output.TranslatedTitle], out strTemp); else GrabUtil.DownloadCoverArt(strPathImg, strTemp, datas[(int)Grabber_Output.OriginalTitle], out strTemp); // strTemp = MediaPortal.Util.Utils.FilterFileName(strTemp); // Guzzi: removed, as it could change the filename to an already loaded image, thus breaking the "link". datas[(int)Grabber_Output.PicturePathLong] = strPathImg + "\\" + strTemp; } datas[(int)Grabber_Output.PicturePathShort] = strTemp; } } // ***** Synopsis ***** Description strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartSyn").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndSyn").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartSyn").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartSyn").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeySynIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeySynPage").InnerText); strActivePage = LoadPage(strPage); strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); // make sure nonvalid Chars are encoded - e.g. //< -> < //> -> > //" -> " //' -> ' //& -> & // strTemp = System.Web.HttpUtility.HtmlEncode(strTemp.Replace('’', '\'')); // strTemp = System.Security.SecurityElement.Escape(strTemp); // alternative way to encode invalid Chars - avoids overhead of Web classes // strTemp = GrabUtil.StripIllegalXmlChars(strTemp, "1.1"); strTemp = strTemp.Replace("&", "&").Replace("<", "<").Replace(">", ">").Replace("\"", """); // strTemp = strTemp.Replace("&", "&").Replace("<", "<").Replace(">", ">").Replace("\"", """).Replace("'", "'"); // strTemp = strTemp.Replace("\"", "\'"); if (strTemp.Length > 0) datas[(int)Grabber_Output.Description] = strTemp; NumberFormatInfo provider = new NumberFormatInfo(); provider.NumberDecimalSeparator = ","; // ***** Base rating ***** decimal wRate = 0; decimal wRate2 = 0; decimal wBasedRate = 10; try { wBasedRate = Convert.ToDecimal(strBasedRate, provider); } catch { } // ***** NOTE 1 ***** Rating 1 strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartRate").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndRate").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartRate").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartRate").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyRateIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyRatePage").InnerText); strActivePage = LoadPage(strPage); strRate = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strRate = GrabUtil.ConvertNote(strRate); try { wRate = (Convert.ToDecimal(strRate, provider) / wBasedRate) * 10; } catch { } // ***** NOTE 2 ***** Rating 2 strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartRate2").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndRate2").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartRate2").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartRate2").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyRate2Index").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyRate2Page").InnerText); strActivePage = LoadPage(strPage); strRate2 = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strRate2 = GrabUtil.ConvertNote(strRate2); try { wRate2 = (Convert.ToDecimal(strRate2, provider) / wBasedRate) * 10; } catch { } //Calcul de la moyenne des notes. decimal resultRate; if (wRate > 0 && wRate2 > 0) resultRate = ((wRate + wRate2) / 2); else if (wRate == 0 && wRate2 == 0) resultRate = -1; else resultRate = ((wRate + wRate2)); resultRate = Math.Round(resultRate, 1); strRate = resultRate == -1 ? "" : Convert.ToString(resultRate); //Rating (calculated from Rating 1 and 2) strRate = strRate.Replace(",", "."); datas[(int)Grabber_Output.Rating] = strRate.Replace(",", "."); // ***** Acteurs ***** Actors strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartCredits").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndCredits").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartCredits").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartCredits").Attributes["Param2"].InnerText); strParam3 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyCreditsRegExp").InnerText); strMaxItems = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyCreditsMaxItems").InnerText); strGrabActorRoles = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyCreditsGrabActorRoles").InnerText); boolGrabActorRoles = strGrabActorRoles == "true"; strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyCreditsIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyCreditsPage").InnerText); strActivePage = LoadPage(strPage); strLanguage = ""; // Overrides from MyFilms plugin: if (!string.IsNullOrEmpty(personLimit)) strMaxItems = personLimit.ToString(); if (!string.IsNullOrEmpty(getRoles)) { if (getRoles.ToLower() == "true") boolGrabActorRoles = true; if (getRoles.ToLower() == "false") boolGrabActorRoles = false; } allNames = string.Empty; allRoles = string.Empty; if (strParam1.Length > 0 || strParam3.Length > 0) // strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems, strLanguage, out allNames, out allRoles, boolGrabActorRoles).Trim(); else strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); // strTemp = strTemp.Replace("\n", ""); // removed, as it seems, the "newlines" replacements for #LF# didn't work in AMC and MP strTemp = GrabUtil.TrimSpaces(strTemp); if (strTemp.Length > 0) datas[(int)Grabber_Output.Actors] = strTemp; //// ***** Réalisateur ***** = Director //strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartRealise").InnerText); //strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndRealise").InnerText); //strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartRealise").Attributes["Param1"].InnerText); //strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartRealise").Attributes["Param2"].InnerText); //strParam3 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyRealiseRegExp").InnerText); //strMaxItems = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyRealiseMaxItems").InnerText); //strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyRealiseIndex").InnerText); //strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyRealisePage").InnerText); //strActivePage = this.LoadPage(strPage); //// Overrides from MyFilms plugin: //if (!string.IsNullOrEmpty(personLimit)) // strMaxItems = personLimit; //if (strParam1.Length > 0 || strParam3.Length > 0) // strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems).Trim(); //else // strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); //strTemp = strTemp.Replace("\n", ""); //if (strTemp.Length > 0) // datas[(int)Grabber_Output.Director] = strTemp; //// ***** Producteur ***** Producer // Producers also using MiltiPurpose Secondary page ! //strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartProduct").InnerText); //strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndProduct").InnerText); //strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartProduct").Attributes["Param1"].InnerText); //strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartProduct").Attributes["Param2"].InnerText); //strParam3 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyProductRegExp").InnerText); //strMaxItems = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyProductMaxItems").InnerText); //strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyProductIndex").InnerText); //strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyProductPage").InnerText); //strActivePage = this.LoadPage(strPage); //// Overrides from MyFilms plugin: //if (!string.IsNullOrEmpty(personLimit)) // strMaxItems = personLimit.ToString(); //if (strParam1.Length > 0 || strParam3.Length > 0) // Guzzi: Added param3 to execute matchcollections also ! // strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems).Trim(); //else // strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); //strTemp = strTemp.Replace("\n", ""); //if (strTemp.Length > 0) // datas[(int)Grabber_Output.Producer] = strTemp; // ***** Année ***** Year strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartYear").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndYear").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartYear").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartYear").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyYearIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyYearPage").InnerText); strActivePage = LoadPage(strPage); strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); if (strTemp.Length > 0) if (strTemp.Length >= 4) datas[(int)Grabber_Output.Year] = strTemp.Substring(strTemp.Length - 4, 4); else datas[(int)Grabber_Output.Year] = strTemp; // fallback, if scraping failed // ***** Pays ***** Country strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartCountry").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndCountry").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartCountry").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartCountry").Attributes["Param2"].InnerText); strParam3 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyCountryRegExp").InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyCountryIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyCountryPage").InnerText); strActivePage = LoadPage(strPage); if (strParam1.Length > 0 || strParam3.Length > 0) strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2, strParam3).Trim(); else strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); if (strTemp.Length > 0) { strTemp = strTemp.Replace(".", " "); strTemp = GrabUtil.TransformCountry(strTemp); datas[(int)Grabber_Output.Country] = strTemp; } // ***** Genre ***** strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartGenre").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndGenre").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartGenre").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartGenre").Attributes["Param2"].InnerText); strParam3 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyGenreRegExp").InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyGenreIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyGenrePage").InnerText); strActivePage = LoadPage(strPage); if (strParam1.Length > 0 || strParam3.Length > 0) strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2, strParam3).Trim(); else strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); if (strTemp.Length > 0) datas[(int)Grabber_Output.Category] = strTemp; // ***** URL ***** datas[(int)Grabber_Output.URL] = strUrl; // ***** Writer ***** // strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartWriter").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndWriter").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartWriter").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartWriter").Attributes["Param2"].InnerText); strParam3 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyWriterRegExp").InnerText); strMaxItems = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyWriterMaxItems").InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyWriterIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyWriterPage").InnerText); strActivePage = LoadPage(strPage); // Overrides from MyFilms plugin: if (!string.IsNullOrEmpty(personLimit)) strMaxItems = personLimit; if (strParam1.Length > 0 || strParam3.Length > 0) // Guzzi: Added param3 to execute matchcollections also ! strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems).Trim(); else strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); if (strTemp.Length > 0) datas[(int)Grabber_Output.Writer] = strTemp; // ***** Comment ***** strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartComment").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndComment").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartComment").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartComment").Attributes["Param2"].InnerText); strParam3 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyCommentRegExp").InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyCommentIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyCommentPage").InnerText); strActivePage = LoadPage(strPage); if (strParam1.Length > 0 || strParam3.Length > 0) strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2, strParam3).Trim(); else strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", " "); // Guzzi: Replace linebreaks with space strTemp = strTemp.Replace("&", "&").Replace("<", "<").Replace(">", ">").Replace("\"", """); // strTemp = strTemp.Replace("&", "&").Replace("<", "<").Replace(">", ">").Replace("\"", """).Replace("'", "'"); // strTemp = System.Web.HttpUtility.HtmlEncode(strTemp.Replace('’', '\'')); // strTemp = System.Security.SecurityElement.Escape(strTemp); // alternative way to encode invalid Chars - avoids overhead of Web classes // strTemp = strTemp.Replace("\"", "\'"); if (strTemp.Length > 0) datas[(int)Grabber_Output.Comments] = strTemp; // ***** Language ***** strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLanguage").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndLanguage").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLanguage").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartLanguage").Attributes["Param2"].InnerText); try { strParam3 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLanguageRegExp").InnerText); } catch (Exception) { strParam3 = ""; } strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLanguageIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyLanguagePage").InnerText); strActivePage = LoadPage(strPage); strTemp = (strParam1.Length > 0 || strParam3.Length > 0) ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2, strParam3).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); if (strTemp.Length > 0) datas[(int)Grabber_Output.Language] = strTemp; // ***** Tagline ***** strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartTagline").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndTagline").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartTagline").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartTagline").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyTaglineIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyTaglinePage").InnerText); strActivePage = LoadPage(strPage); strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); if (strTemp.Length > 0) datas[(int)Grabber_Output.Tagline] = strTemp; // ***** Certification ***** strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartCertification").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndCertification").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartCertification").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartCertification").Attributes["Param2"].InnerText); strParam3 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyCertificationRegExp").InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyCertificationIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyCertificationPage").InnerText); strActivePage = LoadPage(strPage); try { strLanguage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyCertificationLanguage").InnerText); } catch (Exception) { strLanguage = ""; } // Overrides from MyFilms plugin: if (!string.IsNullOrEmpty(preferredLanguage)) strLanguage = preferredLanguage; allNames = string.Empty; allRoles = string.Empty; if (strParam1.Length > 0 || strParam3.Length > 0) strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2, strParam3, "", strLanguage, out allNames, out allRoles).Trim(); else strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); if (strTemp.Length > 0) datas[(int)Grabber_Output.Certification] = strTemp; datas[(int)Grabber_Output.CertificationAllNames] = allNames; datas[(int)Grabber_Output.CertificationAllValues] = allRoles; // ***** IMDB_Id ***** strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartIMDB_Id").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndIMDB_Id").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartIMDB_Id").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartIMDB_Id").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyIMDB_IdIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyIMDB_IdPage").InnerText); strActivePage = LoadPage(strPage); strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); if (strTemp.Length > 0) datas[(int)Grabber_Output.IMDB_Id] = strTemp; // ***** IMDB_Rank ***** strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartIMDB_Rank").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndIMDB_Rank").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartIMDB_Rank").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartIMDB_Rank").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyIMDB_RankIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyIMDB_RankPage").InnerText); strActivePage = LoadPage(strPage); strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); if (strTemp.Length > 0) datas[(int)Grabber_Output.IMDB_Rank] = strTemp; // ***** TMDB_Id ***** strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartTMDB_Id").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndTMDB_Id").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartTMDB_Id").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartTMDB_Id").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyTMDB_IdIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyTMDB_IdPage").InnerText); strActivePage = LoadPage(strPage); strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); if (strTemp.Length > 0) datas[(int)Grabber_Output.TMDB_Id] = strTemp; // ***** Studio ***** strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartStudio").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndStudio").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartStudio").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartStudio").Attributes["Param2"].InnerText); try { strParam3 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStudioRegExp").InnerText); } catch (Exception) { strParam3 = ""; } strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStudioIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStudioPage").InnerText); strActivePage = LoadPage(strPage); strTemp = (strParam1.Length > 0 || strParam3.Length > 0) ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2, strParam3).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); if (strTemp.Length > 0) datas[(int)Grabber_Output.Studio] = strTemp; // ***** Edition ***** strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartEdition").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndEdition").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartEdition").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartEdition").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEditionIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEditionPage").InnerText); strActivePage = LoadPage(strPage); strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); if (strTemp.Length > 0) datas[(int)Grabber_Output.Edition] = strTemp; // ***** Collection ***** try { strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartCollection").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndCollection").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartCollection").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartCollection").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyCollectionIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyCollectionPage").InnerText); strActivePage = LoadPage(strPage); strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); if (strTemp.Length > 0) datas[(int)Grabber_Output.Collection] = strTemp; } catch (Exception) { datas[(int)Grabber_Output.Collection] = ""; } // ***** Collection Image ***** try { strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartCollectionImageURL").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndCollectionImageURL").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartCollectionImageURL").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartCollectionImageURL").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyCollectionImageURLIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyCollectionImageURLPage").InnerText); strActivePage = LoadPage(strPage); strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); if (strTemp.Length > 0 && datas[(int)Grabber_Output.Collection].Length > 0) // only grab image, if there is also a collection name found ! { datas[(int)Grabber_Output.CollectionImage] = strTemp; //Picture for Collections Download if (saveImage == true) { GrabUtil.DownloadCoverArt(strPathImg, strTemp, datas[(int)Grabber_Output.CollectionImage], out strTemp); // datas[(int)Grabber_Output.PicturePathLong] = strPathImg + "\\" + strTemp; } // datas[(int)Grabber_Output.PicturePathShort] = strTemp; } } catch (Exception) { datas[(int)Grabber_Output.CollectionImage] = ""; } // ***** Runtime ***** try { strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartRuntime").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndRuntime").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartRuntime").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartRuntime").Attributes["Param2"].InnerText); strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyRuntimeIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyRuntimePage").InnerText); strActivePage = LoadPage(strPage); strTemp = strParam1.Length > 0 ? GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2).Trim() : GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); if (strTemp.Length > 0) datas[(int)Grabber_Output.Runtime] = strTemp; } catch (Exception) { datas[(int)Grabber_Output.Runtime] = ""; } // ***** Generic Field 1 ***** // strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartGeneric1").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndGeneric1").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartGeneric1").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartGeneric1").Attributes["Param2"].InnerText); strParam3 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyGeneric1RegExp").InnerText); try { strMaxItems = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyGeneric1MaxItems").InnerText); } catch (Exception) { strMaxItems = ""; } try { strLanguage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyGeneric1Language").InnerText); } catch (Exception) { strLanguage = ""; } strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyGeneric1Index").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyGeneric1Page").InnerText); strActivePage = LoadPage(strPage); // Overrides from MyFilms plugin: //if (!string.IsNullOrEmpty(PreferredLanguage)) strLanguage = PreferredLanguage; //if (!string.IsNullOrEmpty(TitleLimit)) strMaxItems = TitleLimit.ToString(); //if (!string.IsNullOrEmpty(PersonLimit)) strMaxItems = PersonLimit.ToString(); allNames = string.Empty; allRoles = string.Empty; if (strParam1.Length > 0 || strParam3.Length > 0) strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems, strLanguage, out allNames, out allRoles).Trim(); else strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); strTemp = GrabUtil.StripIllegalXmlChars(strTemp, "1.0"); // strTemp = strTemp.Replace("&", "&").Replace("<", "<").Replace(">", ">").Replace("\"", """); // strTemp = strTemp.Replace("&", "&").Replace("<", "<").Replace(">", ">").Replace("\"", """).Replace("'", "'"); if (strTemp.Length > 0) datas[(int)Grabber_Output.Generic1] = strTemp; else datas[(int)Grabber_Output.Generic1] = ""; // ***** Generic Field 2 ***** // strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartGeneric2").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndGeneric2").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartGeneric2").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartGeneric2").Attributes["Param2"].InnerText); strParam3 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyGeneric2RegExp").InnerText); try { strMaxItems = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyGeneric2MaxItems").InnerText); } catch (Exception) { strMaxItems = ""; } try { strLanguage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyGeneric2Language").InnerText); } catch (Exception) { strLanguage = ""; } strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyGeneric2Index").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyGeneric2Page").InnerText); strActivePage = LoadPage(strPage); // Overrides from MyFilms plugin: //if (!string.IsNullOrEmpty(PreferredLanguage)) strLanguage = PreferredLanguage; //if (!string.IsNullOrEmpty(TitleLimit)) strMaxItems = TitleLimit.ToString(); //if (!string.IsNullOrEmpty(PersonLimit)) strMaxItems = PersonLimit.ToString(); allNames = string.Empty; allRoles = string.Empty; if (strParam1.Length > 0 || strParam3.Length > 0) strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems, strLanguage, out allNames, out allRoles).Trim(); else strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); strTemp = GrabUtil.StripIllegalXmlChars(strTemp, "1.0"); // strTemp = strTemp.Replace("&", "&").Replace("<", "<").Replace(">", ">").Replace("\"", """); // strTemp = strTemp.Replace("&", "&").Replace("<", "<").Replace(">", ">").Replace("\"", """).Replace("'", "'"); if (strTemp.Length > 0) datas[(int)Grabber_Output.Generic2] = strTemp; else datas[(int)Grabber_Output.Generic2] = ""; // ***** Generic Field 3 ***** // datas[(int)Grabber_Output.Generic3] = grabitem.Load(script, "Generic3"); strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartGeneric3").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndGeneric3").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartGeneric3").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartGeneric3").Attributes["Param2"].InnerText); strParam3 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyGeneric3RegExp").InnerText); try { strMaxItems = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyGeneric3MaxItems").InnerText); } catch (Exception) { strMaxItems = ""; } try { strLanguage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyGeneric3Language").InnerText); } catch (Exception) { strLanguage = ""; } strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyGeneric3Index").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyGeneric3Page").InnerText); strActivePage = LoadPage(strPage); // Overrides from MyFilms plugin: //if (!string.IsNullOrEmpty(PreferredLanguage)) strLanguage = PreferredLanguage; //if (!string.IsNullOrEmpty(TitleLimit)) strMaxItems = TitleLimit.ToString(); //if (!string.IsNullOrEmpty(PersonLimit)) strMaxItems = PersonLimit.ToString(); allNames = string.Empty; allRoles = string.Empty; if (strParam1.Length > 0 || strParam3.Length > 0) strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems, strLanguage, out allNames, out allRoles).Trim(); else strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); strTemp = GrabUtil.StripIllegalXmlChars(strTemp, "1.0"); // strTemp = strTemp.Replace("&", "&").Replace("<", "<").Replace(">", ">").Replace("\"", """); // strTemp = strTemp.Replace("&", "&").Replace("<", "<").Replace(">", ">").Replace("\"", """).Replace("'", "'"); if (strTemp.Length > 0) datas[(int)Grabber_Output.Generic3] = strTemp; else datas[(int)Grabber_Output.Generic3] = ""; // *********************************** // new key-value listingoutputs // *********************************** // ***** MultiPosters ***** // strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartMultiPosters").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndMultiPosters").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartMultiPosters").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartMultiPosters").Attributes["Param2"].InnerText); strParam3 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyMultiPostersRegExp").InnerText); try { strMaxItems = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyMultiPostersMaxItems").InnerText); } catch (Exception) { strMaxItems = ""; } try { strLanguage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyMultiPostersLanguage").InnerText); } catch (Exception) { strLanguage = ""; } strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyMultiPostersIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyMultiPostersPage").InnerText); strActivePage = LoadPage(strPage); // Overrides from MyFilms plugin: //if (!string.IsNullOrEmpty(PreferredLanguage)) strLanguage = PreferredLanguage; //if (!string.IsNullOrEmpty(TitleLimit)) strMaxItems = TitleLimit.ToString(); //if (!string.IsNullOrEmpty(PersonLimit)) strMaxItems = PersonLimit.ToString(); allNames = string.Empty; allRoles = string.Empty; if (strParam1.Length > 0 || strParam3.Length > 0) strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems, strLanguage, out allNames, out allRoles, true).Trim(); else strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); if (strTemp.Length > 0) datas[(int)Grabber_Output.MultiPosters] = strTemp; else datas[(int)Grabber_Output.MultiPosters] = ""; // ***** Photos ***** // strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartPhotos").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndPhotos").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartPhotos").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartPhotos").Attributes["Param2"].InnerText); strParam3 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyPhotosRegExp").InnerText); try { strMaxItems = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyPhotosMaxItems").InnerText); } catch (Exception) { strMaxItems = ""; } try { strLanguage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyPhotosLanguage").InnerText); } catch (Exception) { strLanguage = ""; } strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyPhotosIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyPhotosPage").InnerText); strActivePage = LoadPage(strPage); // Overrides from MyFilms plugin: //if (!string.IsNullOrEmpty(PreferredLanguage)) strLanguage = PreferredLanguage; //if (!string.IsNullOrEmpty(TitleLimit)) strMaxItems = TitleLimit.ToString(); //if (!string.IsNullOrEmpty(PersonLimit)) strMaxItems = PersonLimit.ToString(); allNames = string.Empty; allRoles = string.Empty; if (strParam1.Length > 0 || strParam3.Length > 0) strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems, strLanguage, out allNames, out allRoles, true).Trim(); else strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); if (strTemp.Length > 0) datas[(int)Grabber_Output.Photos] = strTemp; else datas[(int)Grabber_Output.Photos] = ""; // ***** PersonImages ***** // strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartPersonImages").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndPersonImages").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartPersonImages").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartPersonImages").Attributes["Param2"].InnerText); strParam3 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyPersonImagesRegExp").InnerText); try { strMaxItems = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyPersonImagesMaxItems").InnerText); } catch (Exception) { strMaxItems = ""; } try { strLanguage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyPersonImagesLanguage").InnerText); } catch (Exception) { strLanguage = ""; } strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyPersonImagesIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyPersonImagesPage").InnerText); strActivePage = LoadPage(strPage); // Overrides from MyFilms plugin: //if (!string.IsNullOrEmpty(PreferredLanguage)) strLanguage = PreferredLanguage; //if (!string.IsNullOrEmpty(TitleLimit)) strMaxItems = TitleLimit.ToString(); //if (!string.IsNullOrEmpty(PersonLimit)) strMaxItems = PersonLimit.ToString(); allNames = string.Empty; allRoles = string.Empty; if (strParam1.Length > 0 || strParam3.Length > 0) strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems, strLanguage, out allNames, out allRoles, true).Trim(); else strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); if (strTemp.Length > 0) datas[(int)Grabber_Output.PersonImages] = strTemp; else datas[(int)Grabber_Output.PersonImages] = ""; // ***** MultiFanart ***** // strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartMultiFanart").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndMultiFanart").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartMultiFanart").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartMultiFanart").Attributes["Param2"].InnerText); strParam3 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyMultiFanartRegExp").InnerText); try { strMaxItems = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyMultiFanartMaxItems").InnerText); } catch (Exception) { strMaxItems = ""; } try { strLanguage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyMultiFanartLanguage").InnerText); } catch (Exception) { strLanguage = ""; } strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyMultiFanartIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyMultiFanartPage").InnerText); strActivePage = LoadPage(strPage); // Overrides from MyFilms plugin: //if (!string.IsNullOrEmpty(PreferredLanguage)) strLanguage = PreferredLanguage; //if (!string.IsNullOrEmpty(TitleLimit)) strMaxItems = TitleLimit.ToString(); //if (!string.IsNullOrEmpty(PersonLimit)) strMaxItems = PersonLimit.ToString(); allNames = string.Empty; allRoles = string.Empty; if (strParam1.Length > 0 || strParam3.Length > 0) strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems, strLanguage, out allNames, out allRoles, true).Trim(); else strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); if (strTemp.Length > 0) datas[(int)Grabber_Output.MultiFanart] = strTemp; else datas[(int)Grabber_Output.MultiFanart] = ""; // ***** Trailer ***** // strStart = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartTrailer").InnerText); strEnd = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyEndTrailer").InnerText); strParam1 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartTrailer").Attributes["Param1"].InnerText); strParam2 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyStartTrailer").Attributes["Param2"].InnerText); strParam3 = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyTrailerRegExp").InnerText); try { strMaxItems = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyTrailerMaxItems").InnerText); } catch (Exception) { strMaxItems = ""; } try { strLanguage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyTrailerLanguage").InnerText); } catch (Exception) { strLanguage = ""; } strIndex = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyTrailerIndex").InnerText); strPage = XmlConvert.DecodeName(script.SelectSingleNodeFast("Details/KeyTrailerPage").InnerText); strActivePage = LoadPage(strPage); // Overrides from MyFilms plugin: //if (!string.IsNullOrEmpty(PreferredLanguage)) strLanguage = PreferredLanguage; //if (!string.IsNullOrEmpty(TitleLimit)) strMaxItems = TitleLimit.ToString(); //if (!string.IsNullOrEmpty(PersonLimit)) strMaxItems = PersonLimit.ToString(); allNames = string.Empty; allRoles = string.Empty; if (strParam1.Length > 0 || strParam3.Length > 0) strTemp = GrabUtil.FindWithAction(ExtractBody(strActivePage, strIndex, script), strStart, strEnd, strParam1, strParam2, strParam3, strMaxItems, strLanguage, out allNames, out allRoles, true).Trim(); else strTemp = GrabUtil.Find(ExtractBody(strActivePage, strIndex, script), strStart, strEnd).Trim(); strTemp = strTemp.Replace("\n", ""); if (strTemp.Length > 0) datas[(int)Grabber_Output.Trailer] = strTemp; else datas[(int)Grabber_Output.Trailer] = ""; #endregion #region mapping of fields to output // ********************************************************************************************************** // Do mapping, if any configured... // ********************************************************************************************************** string[] source = new string[40]; string[] destination = new string[40]; bool[] replace = new bool[40]; bool[] addStart = new bool[40]; bool[] addEnd = new bool[40]; bool[] mergePreferSource = new bool[40]; bool[] mergePreferDestination = new bool[40]; List<string> fields = FieldList(); // Read Config for (int t = 0; t < 40; t++) { try { source[t] = XmlConvert.DecodeName(script.SelectSingleNodeFast("Mapping/Field_" + t.ToString()).Attributes["source"].InnerText); if (source[t] == "") source[t] = fields[t]; // replace with "right DB field name" if it is empty (for upgrade compatibility) destination[t] = XmlConvert.DecodeName(script.SelectSingleNodeFast("Mapping/Field_" + t.ToString()).Attributes["destination"].InnerText); replace[t] = Convert.ToBoolean(XmlConvert.DecodeName(script.SelectSingleNodeFast("Mapping/Field_" + t.ToString()).Attributes["replace"].InnerText)); addStart[t] = Convert.ToBoolean(XmlConvert.DecodeName(script.SelectSingleNodeFast("Mapping/Field_" + t.ToString()).Attributes["addstart"].InnerText)); addEnd[t] = Convert.ToBoolean(XmlConvert.DecodeName(script.SelectSingleNodeFast("Mapping/Field_" + t.ToString()).Attributes["addend"].InnerText)); mergePreferSource[t] = Convert.ToBoolean(XmlConvert.DecodeName(script.SelectSingleNodeFast("Mapping/Field_" + t.ToString()).Attributes["mergeprefersource"].InnerText)); mergePreferDestination[t] = Convert.ToBoolean(XmlConvert.DecodeName(script.SelectSingleNodeFast("Mapping/Field_" + t.ToString()).Attributes["mergepreferdestination"].InnerText)); } catch (Exception) { source[t] = fields[t]; destination[t] = ""; replace[t] = false; addStart[t] = false; addEnd[t] = false; mergePreferSource[t] = false; mergePreferDestination[t] = false; } } for (int t = 0; t < 40; t++) // set default values = source { datas[t + 40] = !string.IsNullOrEmpty(datas[t]) ? datas[t] : string.Empty; // set destination = source as default (base if no other transformations) } for (int t = 0; t < 40; t++) // replace values if configured { for (int i = 0; i < 40; i++) // search for mapping destination { if (destination[t] == source[i]) // found mapping destination -> datas[i] is destination object ! { if (replace[t]) // replace action datas[i + 40] = !String.IsNullOrEmpty(datas[t]) ? datas[t] : string.Empty; } } } for (int t = 0; t < 40; t++) // merge prefer source - replace values only if source is not empty { for (int i = 0; i < 40; i++) { if (destination[t] == source[i]) { if (mergePreferSource[t] && !string.IsNullOrEmpty(datas[t])) // replace action datas[i + 40] = datas[t]; } } } for (int t = 0; t < 40; t++) // merge prefer destination - replace values only if destination empty { for (int i = 0; i < 40; i++) { if (destination[t] == source[i]) { if (mergePreferDestination[t] && string.IsNullOrEmpty(datas[i])) // replace action datas[i + 40] = datas[t]; } } } for (int t = 0; t < 40; t++) // insert or append values if configured { for (int i = 0; i < 40; i++) // search for mapping destination { if (destination[t] == source[i]) // found mapping destination -> datas[i] is destination object ! { if (addStart[t] && !string.IsNullOrEmpty(datas[t])) // addStart action - only of not empty (avoid empty new line) datas[i + 40] = datas[t] + System.Environment.NewLine + datas[i + 40]; if (addEnd[t] && !string.IsNullOrEmpty(datas[t])) // addEnd action - only if not empty (avoid empty new line) datas[i + 40] = datas[i + 40] + System.Environment.NewLine + datas[t]; } } } #endregion return datas; }