public RequestBuilder(HTTPRequest baseRequest, WorldDateTime startTime, RequestData data)
 {
   _baseRequest = baseRequest;
   _requestTime = startTime;
   _data = data;
   _dayOffset = 0;
   _offset = 0;
 }
    /// <summary>
    /// Initalises the ListingGrabber class with a grabber config file
    /// </summary>
    /// <param name="File">The grabber config file file.</param>
    /// <returns>bool - success/fail loading the config file</returns>
    public bool Initalise(string File, int maxGrabDays)
    {
      _maxGrabDays = maxGrabDays;

      // Load configuration file
      Log.Info("WebEPG: Opening {0}", File);

      try
      {
        //_grabber = new GrabberConfig(_strBaseDir + File);

        XmlSerializer s = new XmlSerializer(typeof (GrabberConfigFile));

        using (TextReader r = new StreamReader(_strBaseDir + File))
        {
          _grabber = (GrabberConfigFile)s.Deserialize(r);
        }
      }
      catch (InvalidOperationException ex)
      {
        Log.Error("WebEPG: Config Error {0}: {1}", File, ex.Message);
        return false;
      }

      if (_grabber.Info.Version == null || _grabber.Info.Version == string.Empty)
      {
        Log.Info("WebEPG: Unknown Version");
      }
      else
      {
        Log.Info("WebEPG: Version: {0}", _grabber.Info.Version);
      }

      if (_grabber.Listing.SearchParameters == null)
      {
        _grabber.Listing.SearchParameters = new RequestData();
      }

      _reqData = _grabber.Listing.SearchParameters;

      // Setup timezone
      Log.Info("WebEPG: TimeZone, Local: {0}", TimeZone.CurrentTimeZone.StandardName);

      _siteTimeZone = null;
      if (_grabber.Info.TimeZone != null && _grabber.Info.TimeZone != string.Empty)
      {
        try
        {
          Log.Info("WebEPG: TimeZone, Site : {0}", _grabber.Info.TimeZone);
          _siteTimeZone = new WorldTimeZone(_grabber.Info.TimeZone);
        }
        catch (ArgumentException)
        {
          Log.Error("WebEPG: TimeZone Not valid");
          _siteTimeZone = null;
        }
      }

      if (_siteTimeZone == null)
      {
        Log.Info("WebEPG: No site TimeZone, using Local: {0}", TimeZone.CurrentTimeZone.StandardName);
        _siteTimeZone = new WorldTimeZone(TimeZone.CurrentTimeZone.StandardName);
      }

      switch (_grabber.Listing.listingType)
      {
        case ListingInfo.Type.Xml:
          _parser = new XmlParser(_grabber.Listing.XmlTemplate);
          break;

        case ListingInfo.Type.JSON:
          _parser = new JSONParser(_grabber.Listing.JSONTemplate);
          break;

        case ListingInfo.Type.Data:

          if (_grabber.Listing.DataTemplate.Template == null)
          {
            Log.Error("WebEPG: {0}: No Template", File);
            return false;
          }
          _parser = new DataParser(_grabber.Listing.DataTemplate);
          break;

        case ListingInfo.Type.Html:
          HtmlParserTemplate defaultTemplate = _grabber.Listing.HtmlTemplate.GetTemplate("default");
          if (defaultTemplate == null ||
              defaultTemplate.SectionTemplate == null ||
              defaultTemplate.SectionTemplate.Template == null)
          {
            Log.Error("WebEPG: {0}: No Template", File);
            return false;
          }
          _parser = new WebParser(_grabber.Listing.HtmlTemplate);
          if (_grabber.Info.GrabDays < _maxGrabDays)
          {
            Log.Info("WebEPG: Grab days ({0}) more than Guide days ({1}), limiting grab to {1} days",
                     _maxGrabDays, _grabber.Info.GrabDays);
            _maxGrabDays = _grabber.Info.GrabDays;
          }

          break;
      }

      return true;
    }