Inheritance: GUIControl
    /// <summary>
    /// This method gets called when the control is created and all properties has been set
    /// It allows the control todo any initialization
    /// </summary>
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      _imageFocused = LoadAnimationControl(_parentControlId, _controlId, _buttonX, _buttonY, _buttonWidth, _buttonHeight,
                                           _focusedTextureName);
      _imageFocused.ParentControl = this;
      _imageFocused.Filtering = false;
      _imageFocused.DimColor = DimColor;
      _imageFocused.ColourDiffuse = ColourDiffuse;

      _imageNonFocused = LoadAnimationControl(_parentControlId, _controlId, _buttonX, _buttonY, _buttonWidth,
                                              _buttonHeight, _nonFocusedTextureName);
      _imageNonFocused.ParentControl = null; // null, because to avoid dimming with the parentControl
      _imageNonFocused.Filtering = false;
      _imageNonFocused.DimColor = DimColor;
      _imageNonFocused.ColourDiffuse = ColourDiffuse;

      _isOverlayAllowed = false;
      if (!string.IsNullOrEmpty(_allowOverlayString))
      {
        _allowOverlayString = _allowOverlayString.ToLowerInvariant();
        if (_allowOverlayString.Equals("yes") || _allowOverlayString.Equals("true"))
        {
          _isOverlayAllowed = true;
        }
      }
    }
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      if (_backgroundTextureName == null)
      {
        _backgroundTextureName = "";
      }
      if (_rightTextureName == null)
      {
        _rightTextureName = "";
      }
      if (_leftTextureName == null)
      {
        _leftTextureName = "";
      }
      _imageBackGround = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                              _backgroundTextureName);
      _imageBackGround.ParentControl = this;
      _imageBackGround.DimColor = DimColor;

      _imageLeft = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                        _leftTextureName);
      _imageLeft.ParentControl = this;
      _imageLeft.DimColor = DimColor;
      _imageRight = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                         _rightTextureName);
      _imageRight.ParentControl = this;
      _imageRight.DimColor = DimColor;
    }
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();

      _imageFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                           _focusedTextureName);
      _imageFocused.ParentControl = this;

      _imageNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                              _nonFocusedTextureName);
      _imageNonFocused.ParentControl = this;

      _imageAlternativeFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width,
                                                      _height, _alternativeFocusTextureName);
      _imageAlternativeFocused.ParentControl = this;

      _imageAlternativeNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width,
                                                         _height, _alternativeNonFocusTextureName);
      _imageAlternativeNonFocused.ParentControl = this;
      GUILocalizeStrings.LocalizeLabel(ref _label);

      _shadow = (_shadowAngle > 0) || (_shadowDistance > 0);

      _labelControl = new GUILabelControl(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName,
                                          _label, _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_MIDDLE, false,
                                          _shadowAngle, _shadowDistance, _shadowColor);
      _labelControl.TextAlignment = _textAlignment;
      _labelControl.TextVAlignment = _textVAlignment;
      _labelControl.DimColor = DimColor;
      _labelControl.ParentControl = this;
    }
示例#4
0
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      _imageFocusRectangle = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                                  _focusedTextureName);
      thumbImage = new GUIImage(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                "#Play.Current.Thumb", 1);
      blackImage = new GUIImage(_parentControlId, _controlId, _positionX, _positionY, _width, _height, "black.png", 1);

      _imageFocusRectangle.ParentControl = this;
      thumbImage.ParentControl = this;
      blackImage.ParentControl = this;
    }
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      _imageBackGround = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                              _backgroundTextureName);
      _imageBackGround.ParentControl = this;
      _imageBackGround.DimColor = DimColor;

      _imageMid = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                       _sliderTextureName);
      _imageMid.ParentControl = this;
      _imageMid.DimColor = DimColor;

      _imageMidFocus = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                            _sliderFocusTextureName);
      _imageMidFocus.ParentControl = this;
      _imageMidFocus.DimColor = DimColor;
    }
示例#6
0
 public GUIAnimation(GUIAnimation a)
     : base(a._parentControlId, a._controlId, a._positionX, a._positionY, a._width, a._height)
 {
     _animating           = false;
     _isFirstRender       = true;
     _iterationCount      = 0;
     _startTick           = 0;
     _hidePngAnimations   = false;
     _triggerList         = a._triggerList.GetRange(0, a._triggerList.Count);
     _easing              = a._easing;
     _fillBehavior        = a._fillBehavior;
     _horizontalAlignment = a._horizontalAlignment;
     _textureNames        = a._textureNames;
     _rate              = a._rate;
     _duration          = a._duration;
     _repeatBehavior    = a._repeatBehavior;
     _verticalAlignment = a._verticalAlignment;
     _triggerNames      = a._triggerNames;
     InitTriggerList();
 }
        /// <summary>
        /// This method gets called when the control is created and all properties has been set
        /// It allows the control todo any initialization
        /// </summary>
        public override void FinalizeConstruction()
        {
            base.FinalizeConstruction();

            _imageCheckMarkFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY,
                                                          _checkMarkWidth, _checkMarkHeight, _checkMarkFocusTextureName);
            _imageCheckMarkFocused.ParentControl = this;
            _imageCheckMarkFocused.DimColor      = DimColor;

            _imageCheckMarkNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY,
                                                             _checkMarkWidth, _checkMarkHeight, _checkMarkNoFocusTextureName);
            _imageCheckMarkNonFocused.ParentControl = this;
            _imageCheckMarkNonFocused.DimColor      = DimColor;

            if (_fontName != "" && _fontName != "-")
            {
                _font = GUIFontManager.GetFont(_fontName);
            }

            GUILocalizeStrings.LocalizeLabel(ref _label);
        }
示例#8
0
        public static void Init()
        {
            if (_countLabel == null)
            {
                _countLabel                = new GUILabelControl(0);
                _countLabel.FontName       = "waitcursor";
                _countLabel.TextColor      = 0x66ffffff;
                _countLabel.TextAlignment  = Alignment.ALIGN_CENTER;
                _countLabel.TextVAlignment = VAlignment.ALIGN_MIDDLE;
                _countLabel.Width          = 96;
                _countLabel.Height         = 96;
            }

            if (_animation == null)
            {
                _animation = new GUIAnimation();

                string themedFilename;
                foreach (string filename in Directory.GetFiles(GUIGraphicsContext.Skin + @"\media\", "common.waiting.*.png"))
                {
                    themedFilename = GUIGraphicsContext.GetThemedSkinFile(filename);
                    _animation.Filenames.Add(Path.GetFileName(themedFilename));
                }

                // dirty hack because the files are 96x96 - unfortunately no property gives the correct size at runtime when init is called :S
                int scaleWidth  = (GUIGraphicsContext.Width / 2) - 48;
                int scaleHeigth = (GUIGraphicsContext.Height / 2) - 48;

                _animation.SetPosition(scaleWidth, scaleHeigth);

                // broken!?
                _animation.HorizontalAlignment = HorizontalAlignment.Center;
                _animation.VerticalAlignment   = VerticalAlignment.Center;

                Log.Debug("GUIWaitCursor: init at position {0}:{1}", scaleWidth, scaleHeigth);
                _animation.AllocResources();
                _animation.Duration       = new Duration(800);
                _animation.RepeatBehavior = RepeatBehavior.Forever;
            }
        }
    public override sealed void FinalizeConstruction()
    {
      base.FinalizeConstruction();

      _imageFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _focusedTextureName);
      _imageFocused.ParentControl = this;
      _imageNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _nonFocusedTextureName);
      _imageNonFocused.ParentControl = this;
      _imageAlternativeFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _alternativeFocusTextureName);
      _imageAlternativeFocused.ParentControl = this;
      _imageAlternativeNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _alternativeNonFocusTextureName);
      _imageAlternativeNonFocused.ParentControl = this;
      GUILocalizeStrings.LocalizeLabel(ref _label);

      if (_scrollStartDelay < 0)
      {
        _labelControl = new GUILabelControl(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName,
                                            _label, _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_MIDDLE, false,
                                            _shadowAngle, _shadowDistance, _shadowColor);
        ((GUILabelControl)_labelControl).TextAlignment = _textAlignment;
        ((GUILabelControl)_labelControl).TextVAlignment = _textVAlignment;
      }
      else
      {
        _labelControl = new GUIFadeLabel(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName,
                                         _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP,
                                         _shadowAngle, _shadowDistance, _shadowColor,
                                         _userWrapString);
        ((GUIFadeLabel)_labelControl).TextAlignment = _textAlignment;
        ((GUIFadeLabel)_labelControl).TextVAlignment = _textVAlignment;
        ((GUIFadeLabel)_labelControl).AllowScrolling = false;
        ((GUIFadeLabel)_labelControl).AllowFadeIn = false;
      }
      _labelControl.ParentControl = this;
      _labelControl.DimColor = DimColor;
    }
        public override sealed void FinalizeConstruction()
        {
            base.FinalizeConstruction();

            _imageFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _focusedTextureName);
            _imageFocused.ParentControl               = this;
            _imageNonFocused                          = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _nonFocusedTextureName);
            _imageNonFocused.ParentControl            = this;
            _imageAlternativeFocused                  = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _alternativeFocusTextureName);
            _imageAlternativeFocused.ParentControl    = this;
            _imageAlternativeNonFocused               = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _alternativeNonFocusTextureName);
            _imageAlternativeNonFocused.ParentControl = this;
            GUILocalizeStrings.LocalizeLabel(ref _label);

            if (_scrollStartDelay < 0)
            {
                _labelControl = new GUILabelControl(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName,
                                                    _label, _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_MIDDLE, false,
                                                    _shadowAngle, _shadowDistance, _shadowColor);
                ((GUILabelControl)_labelControl).TextAlignment  = _textAlignment;
                ((GUILabelControl)_labelControl).TextVAlignment = _textVAlignment;
            }
            else
            {
                _labelControl = new GUIFadeLabel(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName,
                                                 _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP,
                                                 _shadowAngle, _shadowDistance, _shadowColor,
                                                 _userWrapString);
                ((GUIFadeLabel)_labelControl).TextAlignment  = _textAlignment;
                ((GUIFadeLabel)_labelControl).TextVAlignment = _textVAlignment;
                ((GUIFadeLabel)_labelControl).AllowScrolling = false;
                ((GUIFadeLabel)_labelControl).AllowFadeIn    = false;
            }
            _labelControl.ParentControl = this;
            _labelControl.DimColor      = DimColor;
        }
示例#11
0
        /// <summary>
        /// This method gets called when the control is created and all properties has been set
        /// It allows the control todo any initialization
        /// </summary>
        public override void FinalizeConstruction()
        {
            base.FinalizeConstruction();
            _imageFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                                 _focusedTextureName);
            _imageFocused.ParentControl = this;
            _imageFocused.Filtering     = false;
            _imageFocused.DimColor      = DimColor;
            _imageFocused.SetBorder(_strBorderTF, _borderPositionTF, _borderTextureRepeatTF, _borderTextureRotateTF,
                                    _borderTextureFileNameTF, _borderColorKeyTF, _borderHasCornersTF,
                                    _borderCornerTextureRotateTF);

            _imageNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                                    _nonFocusedTextureName);
            _imageNonFocused.ParentControl = this;
            _imageNonFocused.Filtering     = false;
            _imageNonFocused.DimColor      = DimColor;
            _imageNonFocused.SetBorder(_strBorderTNF, _borderPositionTNF, _borderTextureRepeatTNF, _borderTextureRotateTNF,
                                       _borderTextureFileNameTNF, _borderColorKeyTNF, _borderHasCornersTNF,
                                       _borderCornerTextureRotateTNF);
            GUILocalizeStrings.LocalizeLabel(ref _label);

            _labelControl = new GUILabelControl(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName,
                                                _label, _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP, false,
                                                _shadowAngle, _shadowDistance, _shadowColor);
            _labelControl.ParentControl  = this;
            _labelControl.DimColor       = DimColor;
            _labelControl.TextAlignment  = _textAlignment;
            _labelControl.TextVAlignment = _textVAlignment;

            checkMark = new GUICheckMarkControl(0, 0, _positionX + _width - _checkMarkWidth, _positionY, _checkMarkWidth,
                                                _checkMarkHeight, _checkMarkFocusTextureName, _checkMarkNoFocusTextureName,
                                                _checkMarkWidth, _checkMarkWidth, Alignment.ALIGN_LEFT);
            checkMark.ParentControl = this;
            checkMark.DimColor      = DimColor;
        }
示例#12
0
        /// <summary>
        /// This function is called after all of the XmlSkinnable fields have been filled
        /// with appropriate data.
        /// Use this to do any construction work other than simple data member assignments,
        /// for example, initializing new reference types, extra calculations, etc..
        /// </summary>
        public override void FinalizeConstruction()
        {
            base.FinalizeConstruction();
            _imageBackground = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                                    _backgroundTextureName);
            _imageLeft  = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0, _leftTextureName);
            _imageMid   = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0, _midTextureName);
            _imageRight = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0, _rightTextureName);


            _imageBackground.ParentControl = this;
            _imageLeft.ParentControl       = this;
            _imageMid.ParentControl        = this;
            _imageRight.ParentControl      = this;

            _imageBackground.DimColor = DimColor;
            _imageLeft.DimColor       = DimColor;
            _imageMid.DimColor        = DimColor;
            _imageRight.DimColor      = DimColor;

            _imageBackground.KeepAspectRatio = false;
            _imageMid.KeepAspectRatio        = false;
            _imageRight.KeepAspectRatio      = false;
            if (_property == null)
            {
                _property = string.Empty;
            }
            if (_property.IndexOf("#") >= 0)
            {
                _containsProperty = true;
            }
            if (_top == null)
            {
                _top = "20";
            }
        }
示例#13
0
    //-------------------------------------------------------------------------------------------
    //  Grab Internet Movie Details Informations and update the XML database and refresh screen
    //-------------------------------------------------------------------------------------------        
    public static void grabb_Internet_Details_Informations(string url, string moviehead, string wscript, int GetID, bool interactive, GrabType grabtype, Searchtitles sTitles, GUIAnimation searchanimation)
    {
      LogMyFilms.Debug("launching (grabb_Internet_Details_Informations) with url = '" + url + "', moviehead = '" + moviehead + "', wscript = '" + wscript + "', GetID = '" + GetID + "', interactive = '" + interactive + "'");

      #region set environment
      var Grab = new Grabber_URLClass();
      var Result = new string[80];
      string title = string.Empty;
      string ttitle = string.Empty;
      string wtitle = string.Empty;
      int year = 0;
      string director = string.Empty;
      // Those settings were used in the past from AMCupdater settings - now they exist in MF config as primary source!
      // XmlConfig XmlConfig = new XmlConfig();
      // string Img_Path = XmlConfig.ReadAMCUXmlConfig(MyFilms.conf.StrAMCUpd_cnf, "Image_Download_Filename_Prefix", "");
      // string Img_Path_Type = XmlConfig.ReadAMCUXmlConfig(MyFilms.conf.StrAMCUpd_cnf, "Store_Image_With_Relative_Path", "false");

      string downLoadPath; //downLoadPath = MyFilmsSettings.GetPath(MyFilmsSettings.Path.MyFilmsPath);
      if (interactive)
        downLoadPath = Path.GetTempPath();
      else
      {
        downLoadPath = grabtype == GrabType.Person
                         ? MyFilms.conf.StrPathArtist
                         : MyFilms.conf.StrPathImg + "\\" + MyFilms.conf.StrPicturePrefix;
      }
      LogMyFilms.Debug("Grabber - GetDetail: OverrideLanguage = '" + MyFilms.conf.GrabberOverrideLanguage + "', OverridePersonLimit = '" + MyFilms.conf.GrabberOverridePersonLimit + "', OverrideTitleLimit = '" + MyFilms.conf.GrabberOverrideTitleLimit + "', Get Roles = '" + MyFilms.conf.GrabberOverrideGetRoles + "'");
      LogMyFilms.Debug("Grabber - GetDetail: script = '" + wscript + "', url = '" + url + "', download path = '" + downLoadPath + "'");
      #endregion

      new Thread(delegate()
          {
            #region load internet data
            var dlgPrgrs = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS);
            if (interactive)
            {
              if (dlgPrgrs != null)
              {
                dlgPrgrs.Reset();
                dlgPrgrs.DisplayProgressBar = false;
                dlgPrgrs.ShowWaitCursor = true;
                dlgPrgrs.DisableCancel(true);
                dlgPrgrs.SetHeading(string.Format("{0} - {1}", "MyFilms", "Internet Updates"));
                dlgPrgrs.SetLine(1, "Loading Details ...");
                dlgPrgrs.Percentage = 0;
                dlgPrgrs.NeedRefresh();
                dlgPrgrs.ShouldRenderLayer();
                dlgPrgrs.StartModal(GUIWindowManager.ActiveWindow);
              }

            }
            try
            {
              Result = Grab.GetDetail(url, downLoadPath, wscript, true, MyFilms.conf.GrabberOverrideLanguage, MyFilms.conf.GrabberOverridePersonLimit, MyFilms.conf.GrabberOverrideTitleLimit, MyFilms.conf.GrabberOverrideGetRoles, null);
            }
            catch (Exception ex) { LogMyFilms.ErrorException("grabb_Internet_Details_Information() - exception = '" + ex.Message + "'", ex); }

            if (interactive)
            {
              // SetProcessAnimationStatus(false, searchanimation);
              if (dlgPrgrs != null)
              {
                dlgPrgrs.ShowWaitCursor = false;
                dlgPrgrs.Close();
              }
            }

            // copy mapped values to original values
            for (int i = 0; i < 40; i++)
            {
              LogMyFilms.Debug("Grabber Details: original: '" + i + "' - '" + Result[i] + "'");
              Result[i] = Result[i + 40];
              LogMyFilms.Debug("Grabber Details: mapped  : '" + i + "' - '" + Result[i] + "'");
            }
            LogMyFilms.Debug("Grab Internet Information done for title/ttitle: " + MyFilms.r[MyFilms.conf.StrIndex]["OriginalTitle"] + "/" + MyFilms.r[MyFilms.conf.StrIndex]["TranslatedTitle"]);

            // string Title_Group = XmlConfig.ReadAMCUXmlConfig(MyFilms.conf.StrAMCUpd_cnf, "Folder_Name_Is_Group_Name", "false");
            // string Title_Group_Apply = XmlConfig.ReadAMCUXmlConfig(MyFilms.conf.StrAMCUpd_cnf, "Group_Name_Applies_To", "");
            #endregion

            if (grabtype == GrabType.Details || grabtype == GrabType.All) // grabtype "all" includes cover
            {
              #region Movie Details

              string strChoice = "all"; // defaults to "all", if no other choice
              bool onlyselected = false;
              bool onlymissing = false;
              bool onlynonempty = false;
              var choiceViewMenu = new List<string>();
              var updateItems = new List<string>(); // store properties to update for later use ...
              const int iPropertyLengthLimit = 33;
              var PropertyList = new string[] {
                        "OriginalTitle", "TranslatedTitle", "Picture", "Description", "Rating", "Actors", "Director",
                        "Producer", "Year", "Country", "Category", "URL", "ImageURL", "Writer", "Comments", "Languages",
                        "TagLine", "Certification", "IMDB_Id", "IMDB_Rank", "Studio", "Edition", "Fanart", "Generic1",
                        "Generic2", "Generic3", "TranslatedTitleAllNames", "TranslatedTitleAllValues",
                        "CertificationAllNames", "CertificationAllValues", "MultiPosters", "Photos", "PersonImages",
                        "MultiFanart", "Trailer", "TMDB_Id", "Runtime", "Collection", "CollectionImageURL", "PictureURL"
                      };

              if (interactive) // Dialog only in interactive mode
              {
                #region interactive selection dialog
                var dlgmenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                bool returnToMainDialog = false; // by default do NOT repeat the dialog - only if returning from sub dialogs
                do
                {
                  #region set main selection dialog for options
                  returnToMainDialog = false;
                  choiceViewMenu.Clear();
                  dlgmenu.Reset();
                  dlgmenu.SetHeading(GUILocalizeStrings.Get(10798797)); // Choose update option ...
                  dlgmenu.Add(" *** " + GUILocalizeStrings.Get(10798734) + " *** ");
                  choiceViewMenu.Add("all");
                  dlgmenu.Add(" *** " + GUILocalizeStrings.Get(10798735) + " *** ");
                  choiceViewMenu.Add("missing");
                  dlgmenu.Add(" *** " + GUILocalizeStrings.Get(10798730) + " *** ");
                  choiceViewMenu.Add("all-onlynewdata");
                  // disabled, as we now have the multiselect dialog
                  //dlgmenu.Add(" *** " + GUILocalizeStrings.Get(10798798) + " *** "); // Select single field for update ...
                  //choiceViewMenu.Add("singlefield");
                  if (File.Exists(GUIGraphicsContext.Skin + @"\MyFilmsDialogMultiSelect.xml"))
                  {
                    dlgmenu.Add(" *** " + GUILocalizeStrings.Get(10798799) + " *** "); // Select multiple fields for update ...
                    choiceViewMenu.Add("multiplefields");
                  }
                  dlgmenu.DoModal(GetID);
                  if (dlgmenu.SelectedLabel == -1) return;
                  strChoice = choiceViewMenu[dlgmenu.SelectedLabel];

                  #endregion

                  if (strChoice == "singlefield")
                  {
                    #region populate select menu, if user has chosen to ...

                    string strOldValue = "";
                    string strNewValue = "";

                    var dlgSelect = (GUIDialogSelect)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_SELECT); // GUIDialogSelect2 dlgmenu = (GUIDialogSelect2)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_SELECT2);  
                    if (dlgSelect == null) return;
                    choiceViewMenu.Clear();
                    dlgSelect.Reset();
                    dlgSelect.SetHeading(GUILocalizeStrings.Get(10798732)); // choose property to update
                    dlgSelect.SetButtonLabel("");

                    int i = 0;
                    foreach (string wProperty in PropertyList)
                    {
                      try
                      {
                        strOldValue = MyFilms.r[MyFilms.conf.StrIndex][wProperty].ToString() ?? "";
                        strNewValue = Result[i];
                        if (i == 2) strNewValue = Result[12];
                        if (strNewValue == null) strNewValue = "";

                        if ( // make sure, only supported fields are offered to user for update
                          wProperty != "ImageURL" && !wProperty.Contains("Sub") && !wProperty.Contains("All") &&
                          !wProperty.Contains("Generic") && !wProperty.Contains("Empty") &&
                          ((wProperty != "TagLine" && wProperty != "Certification" && wProperty != "Writer" &&
                            wProperty != "Studio" && wProperty != "Edition" && wProperty != "IMDB_Id" &&
                            wProperty != "IMDB_Rank" && wProperty != "TMDB_Id") ||
                           MyFilms.conf.StrFileType == Configuration.CatalogType.AntMovieCatalog4Xtended) &&
                          wProperty != "Fanart" && wProperty != "Aspectratio" && wProperty != "MultiPosters"
                          // set to enabled to get proper selection - WIP
                          && wProperty != "Photos" && wProperty != "PersonImages" && wProperty != "MultiFanart" &&
                          wProperty != "Trailer") //  && wProperty != "Runtime" && wProperty != "Collection"
                        {
                          dlgSelect.Add(BaseMesFilms.TranslateColumn(wProperty) + ": '" + Helper.LimitString(strOldValue.Replace(Environment.NewLine, " # "), iPropertyLengthLimit) + "' -> '" + Helper.LimitString(strNewValue.Replace(Environment.NewLine, " # "), iPropertyLengthLimit) + "'");
                          choiceViewMenu.Add(wProperty);
                          LogMyFilms.Debug("GrabberUpdate - Add (" + wProperty + "): '" + strOldValue + "' -> '" + strNewValue + "'");
                        }
                        else
                        {
                          LogMyFilms.Debug("GrabberUpdate - not added (unsupported) - (" + wProperty + "): '" + strOldValue + "' -> '" + strNewValue + "'");
                        }
                      }
                      catch (Exception ex)
                      {
                        LogMyFilms.Debug("GrabberUpdate - cannot add Property '" + wProperty + "' to Selectionmenu - reason: " + ex.Message);
                      }
                      i = i + 1;
                    }

                    dlgSelect.DoModal(GetID);
                    if (dlgSelect.SelectedLabel == -1) returnToMainDialog = true; // Nothing was selected - return to main selection menu
                    strChoice = choiceViewMenu[dlgmenu.SelectedLabel];

                    #endregion
                  }

                  if (choiceViewMenu[dlgmenu.SelectedLabel] == "multiplefields")
                  {
                    #region populate multi selection menu, if user has chosen to ...

                    string strOldValue = "";
                    string strNewValue = "";

                    var dlgMultiSelectOld = (GUIWindow)GUIWindowManager.GetWindow(2100);
                    var dlgMultiSelect = new GUIDialogMultiSelect();
                    if (dlgMultiSelect == null) return;
                    dlgMultiSelect.Init();
                    GUIWindowManager.Replace(2100, dlgMultiSelect);
                    try
                    {
                      dlgMultiSelect.Reset();
                      dlgMultiSelect.SetHeading(GUILocalizeStrings.Get(10798732)); // choose property to update

                      int i = 0;
                      foreach (string wProperty in PropertyList)
                      {
                        try
                        {
                          strOldValue = MyFilms.r[MyFilms.conf.StrIndex][wProperty].ToString() ?? "";
                          strNewValue = Result[i];
                          if (i == (int)Grabber_URLClass.Grabber_Output.PicturePathLong) strNewValue = Result[(int)Grabber_URLClass.Grabber_Output.PicturePathShort];
                          if (strNewValue == null) strNewValue = "";

                          if ( // make sure, only supported fields are offered to user for update
                            wProperty != "ImageURL" && !wProperty.Contains("Sub") && !wProperty.Contains("All") &&
                            !wProperty.Contains("Generic") && !wProperty.Contains("Empty") &&
                            ((wProperty != "TagLine" && wProperty != "Certification" && wProperty != "Writer" &&
                              wProperty != "Studio" && wProperty != "Edition" && wProperty != "IMDB_Id" &&
                              wProperty != "IMDB_Rank" && wProperty != "TMDB_Id") ||
                             MyFilms.conf.StrFileType == Configuration.CatalogType.AntMovieCatalog4Xtended) &&
                            wProperty != "Fanart" && wProperty != "Aspectratio" && wProperty != "MultiPosters"
                            // set to enabled to get proper selection - WIP
                            && wProperty != "Photos" && wProperty != "PersonImages" && wProperty != "MultiFanart" &&
                            wProperty != "Trailer") //  && wProperty != "Collection" && wProperty != "CollectionImageURL"
                          {
                            var pItem = new GUIListItem(wProperty);
                            pItem.TVTag = wProperty;
                            if (i == (int)Grabber_URLClass.Grabber_Output.PicturePathLong) pItem.IconImage = Result[(int)Grabber_URLClass.Grabber_Output.PicturePathLong];
                            pItem.Selected = false;
                            pItem.Label = BaseMesFilms.TranslateColumn(wProperty) + ": '" + Helper.LimitString(strOldValue.Replace(Environment.NewLine, " # "), iPropertyLengthLimit) + "' -> '" + Helper.LimitString(strNewValue.Replace(Environment.NewLine, " # "), iPropertyLengthLimit) + "'";
                            dlgMultiSelect.Add(pItem);
                            LogMyFilms.Debug("GrabberUpdate - Add (" + wProperty + "): '" + strOldValue + "' -> '" + strNewValue + "'");
                          }
                          else
                          {
                            LogMyFilms.Debug("GrabberUpdate - not added (unsupported) - (" + wProperty + "): '" + strOldValue + "' -> '" + strNewValue + "'");
                          }
                        }
                        catch (Exception ex)
                        {
                          LogMyFilms.Debug("GrabberUpdate - cannot add Property '" + wProperty + "' to Selectionmenu - reason: " + ex.Message);
                        }
                        i = i + 1;
                      }

                      dlgMultiSelect.DoModal(GetID);
                      updateItems.AddRange(from t in dlgMultiSelect.ListItems where t.Selected select t.TVTag.ToString());
                      LogMyFilms.Debug("GrabberUpdate - '" + updateItems.Count + "' updateItems selected !");
                      if (dlgMultiSelect.DialogModalResult == ModalResult.Cancel) return; // user cancelled
                      if (dlgMultiSelect.DialogModalResult == ModalResult.OK && updateItems.Count == 0) return; // Nothing was selected
                      if (dlgMultiSelect.DialogModalResult != ModalResult.OK) returnToMainDialog = true; // user wants to return to options menu
                    }
                    finally
                    {
                      GUIWindowManager.Replace(2100, dlgMultiSelectOld);
                    }

                    #endregion
                  }

                  switch (strChoice) // either an update type - or a single property to update
                  {
                    #region switch update options

                    case "all":
                      onlyselected = false;
                      onlymissing = false;
                      onlynonempty = false;
                      break;
                    case "missing":
                      onlyselected = false;
                      onlymissing = true;
                      onlynonempty = false;
                      break;
                    case "all-onlynewdata":
                      onlyselected = false;
                      onlymissing = false;
                      onlynonempty = true;
                      break;
                    default:
                      onlyselected = true;
                      onlymissing = false;
                      onlynonempty = false;
                      break;

                    #endregion
                  }
                }
                while (returnToMainDialog);
                LogMyFilms.Debug("GrabInternetDetails - interactive choice: '" + strChoice + "', onlyselected = '" + onlyselected + "', onlymissing = '" + onlymissing + "', onlynonempty = '" + onlynonempty + "'");
                #endregion
              }

              #region load details data

              // ********************************** now load data, if requested ! ******************************
              if (IsUpdateRequired("OriginalTitle", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["OriginalTitle"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.OriginalTitle], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
              {
                title = Result[(int)Grabber_URLClass.Grabber_Output.OriginalTitle];
                wtitle = MyFilms.r[MyFilms.conf.StrIndex]["OriginalTitle"].ToString();
                if (wtitle.Contains(MyFilms.conf.TitleDelim)) wtitle = wtitle.Substring(wtitle.LastIndexOf(MyFilms.conf.TitleDelim) + 1);
                if (wtitle != title) Remove_Backdrops_Fanart(wtitle, true);

                // Add Collection from internet grabber
                if (!string.IsNullOrEmpty(Result[(int)Grabber_URLClass.Grabber_Output.Collection]) && string.IsNullOrEmpty(moviehead))
                {
                  moviehead = Result[(int)Grabber_URLClass.Grabber_Output.Collection] + @"\";
                }
                if (MyFilms.conf.StrTitle1 == "OriginalTitle") MyFilms.r[MyFilms.conf.StrIndex]["OriginalTitle"] = moviehead + title;
                else MyFilms.r[MyFilms.conf.StrIndex]["OriginalTitle"] = title;
              }

              if (IsUpdateRequired("TranslatedTitle", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["TranslatedTitle"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.TranslatedTitle], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
              {
                ttitle = Result[(int)Grabber_URLClass.Grabber_Output.TranslatedTitle];
                if ("TranslatedTitle" == strChoice)
                {
                  if (string.IsNullOrEmpty(ttitle) && MyFilms.conf.StrTitle1 == "TranslatedTitle" && !string.IsNullOrEmpty(MyFilms.r[MyFilms.conf.StrIndex]["TranslatedTitle"].ToString())) // Added to fill ttitle with otitle in case ttitle is empty and mastertitle = ttitle and mastertitle is empty
                    ttitle = Result[(int)Grabber_URLClass.Grabber_Output.OriginalTitle];
                }
                wtitle = MyFilms.r[MyFilms.conf.StrIndex]["TranslatedTitle"].ToString();
                if (wtitle.Contains(MyFilms.conf.TitleDelim)) wtitle = wtitle.Substring(wtitle.LastIndexOf(MyFilms.conf.TitleDelim) + 1);
                if (wtitle != ttitle) Remove_Backdrops_Fanart(wtitle, true);
                if (MyFilms.conf.StrTitle1 == "TranslatedTitle")
                {
                  // Add Collection from internet grabber
                  if (!string.IsNullOrEmpty(Result[(int)Grabber_URLClass.Grabber_Output.Collection]) && string.IsNullOrEmpty(moviehead))
                  {
                    moviehead = Result[(int)Grabber_URLClass.Grabber_Output.Collection] + @"\";
                  }
                  MyFilms.r[MyFilms.conf.StrIndex]["TranslatedTitle"] = moviehead + ttitle;
                }
                else MyFilms.r[MyFilms.conf.StrIndex]["TranslatedTitle"] = ttitle;
              }

              //if (IsUpdateRequired("Collection", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Collection"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Collection], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
              //  MyFilms.r[MyFilms.conf.StrIndex]["Collection"] = Result[(int)Grabber_URLClass.Grabber_Output.Collection];

              if (IsUpdateRequired("Description", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Description"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Description], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                MyFilms.r[MyFilms.conf.StrIndex]["Description"] = Result[(int)Grabber_URLClass.Grabber_Output.Description];

              if (IsUpdateRequired("Rating", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Rating"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Rating], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
              {
                if (Result[(int)Grabber_URLClass.Grabber_Output.Rating].Length > 0)
                {
                  var provider = new NumberFormatInfo();
                  provider.NumberDecimalSeparator = ".";
                  provider.NumberDecimalDigits = 1;
                  decimal wnote = Convert.ToDecimal(Result[(int)Grabber_URLClass.Grabber_Output.Rating], provider);
                  if (string.IsNullOrEmpty(MyFilms.r[MyFilms.conf.StrIndex]["Rating"].ToString()) || !onlymissing)
                    MyFilms.r[MyFilms.conf.StrIndex]["Rating"] = string.Format("{0:F1}", wnote);
                }
              }
              if (IsUpdateRequired("Actors", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Actors"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Actors], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                if (string.IsNullOrEmpty(MyFilms.r[MyFilms.conf.StrIndex]["Actors"].ToString()) || !onlymissing)
                  MyFilms.r[MyFilms.conf.StrIndex]["Actors"] = Result[(int)Grabber_URLClass.Grabber_Output.Actors];
              if (IsUpdateRequired("Director", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Director"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Director], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
              {
                director = Result[(int)Grabber_URLClass.Grabber_Output.Director];
                MyFilms.r[MyFilms.conf.StrIndex]["Director"] = Result[(int)Grabber_URLClass.Grabber_Output.Director];
              }
              if (IsUpdateRequired("Producer", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Producer"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Producer], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                MyFilms.r[MyFilms.conf.StrIndex]["Producer"] = Result[(int)Grabber_URLClass.Grabber_Output.Producer];
              if (IsUpdateRequired("Year", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Year"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Year], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
              {
                try { year = Convert.ToInt16(Result[(int)Grabber_URLClass.Grabber_Output.Year]); }
                catch { year = 1900; }
                MyFilms.r[MyFilms.conf.StrIndex]["Year"] = year.ToString();
              }

              if (IsUpdateRequired("Country", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Country"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Country], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                MyFilms.r[MyFilms.conf.StrIndex]["Country"] = Result[(int)Grabber_URLClass.Grabber_Output.Country];
              if (IsUpdateRequired("Category", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Category"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Category], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                MyFilms.r[MyFilms.conf.StrIndex]["Category"] = Result[(int)Grabber_URLClass.Grabber_Output.Category];
              if (IsUpdateRequired("URL", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["URL"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.URL], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                if (MyFilms.conf.StrStorage != "URL")
                  MyFilms.r[MyFilms.conf.StrIndex]["URL"] = Result[(int)Grabber_URLClass.Grabber_Output.URL];
              if (IsUpdateRequired("Comments", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Comments"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Comments], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                MyFilms.r[MyFilms.conf.StrIndex]["Comments"] = Result[(int)Grabber_URLClass.Grabber_Output.Comments];
              if (IsUpdateRequired("Languages", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Languages"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Language], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                MyFilms.r[MyFilms.conf.StrIndex]["Languages"] =
                  Result[(int)Grabber_URLClass.Grabber_Output.Language];

              #region AMC4 extended fields
              if (MyFilms.conf.StrFileType == Configuration.CatalogType.AntMovieCatalog4Xtended)
              {
                if (IsUpdateRequired("Writer", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Writer"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Writer], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                  MyFilms.r[MyFilms.conf.StrIndex]["Writer"] = Result[(int)Grabber_URLClass.Grabber_Output.Writer];
                if (IsUpdateRequired("TagLine", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["TagLine"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Tagline], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                  MyFilms.r[MyFilms.conf.StrIndex]["TagLine"] = Result[(int)Grabber_URLClass.Grabber_Output.Tagline];
                if (IsUpdateRequired("Certification", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Certification"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Certification], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                  MyFilms.r[MyFilms.conf.StrIndex]["Certification"] = Result[(int)Grabber_URLClass.Grabber_Output.Certification];
                if (IsUpdateRequired("IMDB_Id", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["IMDB_Id"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.IMDB_Id], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                  MyFilms.r[MyFilms.conf.StrIndex]["IMDB_Id"] = Result[(int)Grabber_URLClass.Grabber_Output.IMDB_Id];
                if (IsUpdateRequired("IMDB_Rank", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["IMDB_Rank"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.IMDB_Rank], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                  MyFilms.r[MyFilms.conf.StrIndex]["IMDB_Rank"] = Result[(int)Grabber_URLClass.Grabber_Output.IMDB_Rank];
                if (IsUpdateRequired("TMDB_Id", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["TMDB_Id"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.TMDB_Id], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                  MyFilms.r[MyFilms.conf.StrIndex]["TMDB_Id"] = Result[(int)Grabber_URLClass.Grabber_Output.TMDB_Id];
                if (IsUpdateRequired("Studio", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Studio"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Studio], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                  MyFilms.r[MyFilms.conf.StrIndex]["Studio"] = Result[(int)Grabber_URLClass.Grabber_Output.Studio];
                if (IsUpdateRequired("Edition", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Edition"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Edition], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                  MyFilms.r[MyFilms.conf.StrIndex]["Edition"] = Result[(int)Grabber_URLClass.Grabber_Output.Edition];
                //if (IsUpdateRequired("Fanart", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Fanart"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Fanart], grabtype, onlyselected, onlymissing, onlynonempty, updateItems)) 
                //  MyFilms.r[MyFilms.conf.StrIndex]["Fanart"] = Result[(int)Grabber_URLClass.Grabber_Output.Fanart];
                //if (IsUpdateRequired("Trailer", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Trailer"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Trailer], grabtype, onlyselected, onlymissing, onlynonempty, updateItems)) 
                //  MyFilms.r[MyFilms.conf.StrIndex]["Trailer"] = Result[(int)Grabber_URLClass.Grabber_Output.Trailer];
              }
              #endregion

              if (grabtype == GrabType.All && IsUpdateRequired("Picture", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Picture"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.PicturePathLong], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                grabb_Internet_Details_Informations_Cover(Result, interactive, GetID, wscript, grabtype, sTitles);

              #endregion

              #endregion
            }

            if (grabtype == GrabType.Person)
            {
              #region Person

              #region Load existing person info
              IMDBActor person = null;
              var actorList = new ArrayList();
              VideoDatabase.GetActorByName(MyFilms.conf.StrTIndex, actorList);
              LogMyFilms.Debug("GrabberUpdate - found '" + actorList.Count + "' results for '" + MyFilms.conf.StrTIndex + "'");
              if (actorList.Count > 0 && actorList.Count < 5)
              {
                LogMyFilms.Debug("IMDB first search result: '" + actorList[0] + "'");
                string[] strActor = actorList[0].ToString().Split(new char[] { '|' });
                // int actorID = (strActor[0].Length > 0 && strActor.Count() > 1) ? Convert.ToInt32(strActor[0]) : 0; // string actorname = strActor[1];
                int actorId;
                int.TryParse(strActor[0], out actorId);
                person = actorId > 0 ? VideoDatabase.GetActorInfo(actorId) : new IMDBActor();
              }
              #endregion

              string strChoice = "all"; // defaults to "all", if no other choice
              var imageUrls = new Dictionary<string, string>();

              if (interactive) // Dialog only in interactive mode
              #region interactive selection dialog
              {
                var choiceViewMenu = new List<string>();
                var dlgmenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                dlgmenu.Reset();
                dlgmenu.SetHeading(GUILocalizeStrings.Get(10798797)); // Choose update option ...
                dlgmenu.Add(" *** " + GUILocalizeStrings.Get(10798734) + " *** ");
                choiceViewMenu.Add("all");
                dlgmenu.Add(" *** " + GUILocalizeStrings.Get(10798735) + " *** ");
                choiceViewMenu.Add("missing");
                dlgmenu.Add(" *** " + GUILocalizeStrings.Get(10798730) + " *** ");
                choiceViewMenu.Add("all-onlynewdata");

                //if (File.Exists(GUIGraphicsContext.Skin + @"\MyFilmsDialogMultiSelect.xml"))
                //{
                //  dlgmenu.Add(" *** " + GUILocalizeStrings.Get(10798799) + " *** "); // Select multiple fields for update ...
                //  choiceViewMenu.Add("multiplefields");
                //}
                #region populate selection menu

                string[] PropertyList = new string[]
                      {
                        // "TMDB_Id", "IMDB_Id",
                        "OriginalTitle", // Name
                        "TranslatedTitle", // also known as (currently not supported)
                        "Picture", 
                        "Description", // biographie
                        "Comments", 
                        "Rating", // rating (if available)
                        "Actors", // filmographie
                        "Year", 
                        "Country", // birthplace
                        "URL", // URL to webpage
                        "Generic1", "Generic2", "Generic3", 
                        // "Photos", 
                        "PersonImages", // all images, if available
                        "PictureURL" // webUrl to main picture
                      };
                string personProperty;
                string strOldValue = "";
                string strNewValue = "";

                try
                {
                  personProperty = "name";
                  strOldValue = (person != null && person.Name.Length > 0) ? person.Name : "";
                  strNewValue = Result[(int)Grabber_URLClass.Grabber_Output.OriginalTitle];
                  dlgmenu.Add(GUILocalizeStrings.Get(10799301) + ": '" + strOldValue.Replace(Environment.NewLine, " # ") + "' -> '" + strNewValue.Replace(Environment.NewLine, " # ") + "'");
                  choiceViewMenu.Add(personProperty);
                  LogMyFilms.Debug("GrabberUpdate - Add to menu (" + personProperty + "): '" + strOldValue + "' -> '" + strNewValue + "'");

                  personProperty = "dateofbirth";
                  strOldValue = (person != null && person.DateOfBirth.Length > 0) ? person.DateOfBirth : "";
                  strNewValue = Result[(int)Grabber_URLClass.Grabber_Output.Comments];
                  dlgmenu.Add(GUILocalizeStrings.Get(10799302) + ": '" + strOldValue.Replace(Environment.NewLine, " # ") + "' -> '" + strNewValue.Replace(Environment.NewLine, " # ") + "'");
                  choiceViewMenu.Add(personProperty);
                  LogMyFilms.Debug("GrabberUpdate - Add to menu (" + personProperty + "): '" + strOldValue + "' -> '" + strNewValue + "'");

                  personProperty = "placeofbirth";
                  strOldValue = (person != null && person.PlaceOfBirth.Length > 0) ? person.PlaceOfBirth : "";
                  strNewValue = Result[(int)Grabber_URLClass.Grabber_Output.Country];
                  dlgmenu.Add(GUILocalizeStrings.Get(10799303) + ": '" + strOldValue.Replace(Environment.NewLine, " # ") + "' -> '" + strNewValue.Replace(Environment.NewLine, " # ") + "'");
                  choiceViewMenu.Add(personProperty);
                  LogMyFilms.Debug("GrabberUpdate - Add to menu (" + personProperty + "): '" + strOldValue + "' -> '" + strNewValue + "'");

                  personProperty = "biography";
                  strOldValue = (person != null && person.Biography.Length > 0) ? person.Biography : "";
                  strNewValue = Result[(int)Grabber_URLClass.Grabber_Output.Description];
                  dlgmenu.Add(GUILocalizeStrings.Get(10799304) + ": '" + strOldValue.Replace(Environment.NewLine, " # ") + "' -> '" + strNewValue.Replace(Environment.NewLine, " # ") + "'");
                  choiceViewMenu.Add(personProperty);
                  LogMyFilms.Debug("GrabberUpdate - Add to menu (" + personProperty + "): '" + strOldValue + "' -> '" + strNewValue + "'");
#if MP13
                  strOldValue = (person != null && person.DateOfDeath.Length > 0) ? person.DateOfDeath : "";
                  strOldValue = (person != null && person.PlaceOfDeath.Length > 0) ? person.PlaceOfDeath : "";
                  strOldValue = (person != null && person.LastUpdate.Length > 0) ? person.LastUpdate : "";
#endif
                  // main image
                  personProperty = "coverimage";
                  strOldValue = (person != null && person.ThumbnailUrl.Length > 0) ? person.ThumbnailUrl : "";
                  strNewValue = Result[(int)Grabber_URLClass.Grabber_Output.PictureURL];
                  dlgmenu.Add(GUILocalizeStrings.Get(10798682) + ": '" + strOldValue.Replace(Environment.NewLine, " # ") + "' -> '" + strNewValue.Replace(Environment.NewLine, " # ") + "'");
                  choiceViewMenu.Add(personProperty);
                  imageUrls.Add(personProperty, strNewValue);
                  LogMyFilms.Debug("GrabberUpdate - Add to menu (" + personProperty + "): '" + strOldValue + "' -> '" + strNewValue + "'");

                  // add additional images, if returned by grabber
                  string multipersonimages = Result[(int)Grabber_URLClass.Grabber_Output.PersonImages];
                  LogMyFilms.Debug("GrabberUpdate - multipersonimages = '" + multipersonimages + "'");
                  int i = 1;
                  string[] personimagesUrls = multipersonimages.Split(new char[] { ',', '|' });
                  Regex reg = new Regex(@"\(((?!\)).)*\)");
                  foreach (string personimagesUrl in personimagesUrls)
                  {
                    personProperty = "coverimage" + i.ToString();
                    strNewValue = reg.Replace(personimagesUrl, "").Trim();
                    if (strNewValue != Result[(int)Grabber_URLClass.Grabber_Output.PictureURL]) // do not add main image twice!
                    {
                      dlgmenu.Add(GUILocalizeStrings.Get(10798682) + " " + i.ToString() + ": '" + strOldValue.Replace(Environment.NewLine, " # ") + "' -> '" + strNewValue.Replace(Environment.NewLine, " # ") + "'");
                      choiceViewMenu.Add(personProperty);
                      imageUrls.Add(personProperty, strNewValue);
                      LogMyFilms.Debug("GrabberUpdate - Add to menu (" + personProperty + "): '" + strOldValue + "' -> '" + strNewValue + "'");
                      i++;
                    }
                  }
                }
                catch (Exception ex)
                {
                  LogMyFilms.Debug("GrabberUpdate - Error adding Person property to Selectionmenu: " + ex.Message);
                }
                #endregion

                dlgmenu.DoModal(GetID);
                if (dlgmenu.SelectedLabel == -1) return;
                strChoice = choiceViewMenu[dlgmenu.SelectedLabel];
                LogMyFilms.Debug("GrabInternetDetails - interactive choice: '" + strChoice + "'");
              }
              #endregion

              #region load details data for person
              switch (strChoice)
              {
                case "name":
                  person.Name = Result[(int)Grabber_URLClass.Grabber_Output.OriginalTitle];
                  break;
                case "dateofbirth":
                  person.DateOfBirth = Result[(int)Grabber_URLClass.Grabber_Output.Comments];
                  break;
                case "placeofbirth":
                  person.PlaceOfBirth = Result[(int)Grabber_URLClass.Grabber_Output.Country];
                  break;
                case "biography":
                  person.Biography = Result[(int)Grabber_URLClass.Grabber_Output.Description];
                  break;
                case "coverimage":
                  person.ThumbnailUrl = Result[(int)Grabber_URLClass.Grabber_Output.PictureURL];
                  // ToDo: Download Image
                  break;

                case "all":
                  person.Name = Result[(int)Grabber_URLClass.Grabber_Output.OriginalTitle];
                  person.DateOfBirth = Result[(int)Grabber_URLClass.Grabber_Output.Comments];
                  person.PlaceOfBirth = Result[(int)Grabber_URLClass.Grabber_Output.Country];
                  person.Biography = Result[(int)Grabber_URLClass.Grabber_Output.Description];
                  person.ThumbnailUrl = Result[(int)Grabber_URLClass.Grabber_Output.PictureURL];
                  // ToDo: Download Image
                  break;

                case "missing":
                  if (string.IsNullOrEmpty(person.Name)) person.Name = Result[(int)Grabber_URLClass.Grabber_Output.OriginalTitle];
                  if (string.IsNullOrEmpty(person.DateOfBirth)) person.DateOfBirth = Result[(int)Grabber_URLClass.Grabber_Output.Comments];
                  if (string.IsNullOrEmpty(person.PlaceOfBirth)) person.PlaceOfBirth = Result[(int)Grabber_URLClass.Grabber_Output.Country];
                  if (string.IsNullOrEmpty(person.Biography)) person.Biography = Result[(int)Grabber_URLClass.Grabber_Output.Description];
                  if (string.IsNullOrEmpty(person.ThumbnailUrl)) person.ThumbnailUrl = Result[(int)Grabber_URLClass.Grabber_Output.PictureURL];
                  // ToDo: Download Image
                  break;

                case "all-onlynewdata":
                  if (string.IsNullOrEmpty(Result[(int)Grabber_URLClass.Grabber_Output.OriginalTitle])) person.Name = Result[(int)Grabber_URLClass.Grabber_Output.OriginalTitle];
                  if (string.IsNullOrEmpty(Result[(int)Grabber_URLClass.Grabber_Output.Comments])) person.DateOfBirth = Result[(int)Grabber_URLClass.Grabber_Output.Comments];
                  if (string.IsNullOrEmpty(Result[(int)Grabber_URLClass.Grabber_Output.Country])) person.PlaceOfBirth = Result[(int)Grabber_URLClass.Grabber_Output.Country];
                  if (string.IsNullOrEmpty(Result[(int)Grabber_URLClass.Grabber_Output.Description])) person.Biography = Result[(int)Grabber_URLClass.Grabber_Output.Description];
                  if (string.IsNullOrEmpty(Result[(int)Grabber_URLClass.Grabber_Output.PictureURL]) && Result[(int)Grabber_URLClass.Grabber_Output.PictureURL].ToLower().StartsWith("http")) person.ThumbnailUrl = Result[(int)Grabber_URLClass.Grabber_Output.PictureURL];
                  // ToDo: Download Image
                  break;

                default:
                  if (strChoice.StartsWith("coverimage"))
                  {
                    person.ThumbnailUrl = imageUrls[strChoice];
                    LogMyFilms.Debug("GrabInternetDetails - set person URL to: " + person.ThumbnailUrl);
                  }
                  break;
              }

              LogMyFilms.Debug("GrabInternetDetails - downloadimage: '" + Result[(int)Grabber_URLClass.Grabber_Output.PicturePathLong]);

              #region Add or update actor to video database
              try
              {
                //#if MP1X
                //                  int actorId = VideoDatabase.AddActor(person.Name);
                //#else
                //                  int actorId = VideoDatabase.AddActor(null, person.Name);
                //#endif
                int actorId = GUIUtils.AddActor(null, person.Name);
                if (actorId > 0)
                {
                  if (!string.IsNullOrEmpty(person.Biography)) // clean up before saving ...
                  {
                    if (person.Biography.StartsWith("From Wikipedia, the free encyclopedia")) person.Biography = person.Biography.Replace("From Wikipedia, the free encyclopedia", "").TrimStart(new char[] { '.' }).Trim(new char[] { ' ', '\r', '\n' });
                  }
                  VideoDatabase.SetActorInfo(actorId, person);
                  //VideoDatabase.AddActorToMovie(_movieDetails.ID, actorId);
                }
              }
              catch (Exception ex) { LogMyFilms.Debug("Error adding person to VDB: " + ex.Message, ex.StackTrace); }
              #endregion

              #region load missing images ...
              if (!string.IsNullOrEmpty(MyFilms.conf.StrPathArtist) && !string.IsNullOrEmpty(person.ThumbnailUrl))
              {
                string filename = MyFilms.conf.StrPathArtist + "\\" + person.Name + ".jpg";  // string filename = Path.Combine(MyFilms.conf.StrPathArtist, personname); //File.Exists(MyFilms.conf.StrPathArtist + "\\" + personsname + ".jpg")))
                if (person.ThumbnailUrl.Contains("http:") && (strChoice == "all" || strChoice == "all-onlynewdata" || (!File.Exists(filename) && strChoice == "missing") || strChoice.StartsWith("coverimage")))
                {
                  #region MP Thumb download deactivated, as downloading not yet working !!!
                  //if (person.ThumbnailUrl != string.Empty) // to update MP person thumb dir
                  //{
                  //  string largeCoverArt = Utils.GetLargeCoverArtName(Thumbs.MovieActors, person.Name);
                  //  string coverArt = Utils.GetCoverArtName(Thumbs.MovieActors, person.Name);
                  //  Utils.FileDelete(largeCoverArt);
                  //  Utils.FileDelete(coverArt);
                  //  IMDBFetcher.DownloadCoverArt(Thumbs.MovieActors, person.ThumbnailUrl, person.Name);
                  //  //DownloadCoverArt(Thumbs.MovieActors, imdbActor.ThumbnailUrl, imdbActor.Name);
                  //}
                  #endregion
                  string filename1person = GrabUtil.DownloadPersonArtwork(MyFilms.conf.StrPathArtist, person.ThumbnailUrl, person.Name, false, true, out filename);
                }
              }
              #endregion
              // grabb_Internet_Details_Informations_Cover(Result, interactive, GetID, wscript, grabtype, sTitles);

              #endregion

              #endregion
            }

            if (grabtype == GrabType.Cover)
            {
              #region Cover

              if (string.IsNullOrEmpty(Result[(int)Grabber_URLClass.Grabber_Output.PicturePathLong]))
              {
                if (interactive)
                {
                  GUIUtils.ShowOKDialog(GUILocalizeStrings.Get(10798625));  // no results found
                  // grabb_Internet_Informations(FullMovieName, GetID, true, wscript, FullMoviePath, grabtype, showAll);
                }
                return;
              }
              grabb_Internet_Details_Informations_Cover(Result, interactive, GetID, wscript, grabtype, sTitles);

              #endregion
            }

            if (grabtype == GrabType.MultiCovers)
            {
              #region MultiCovers

              if (string.IsNullOrEmpty(Result[(int)Grabber_URLClass.Grabber_Output.MultiPosters]))
              {
                // no data found
                if (interactive)
                {
                  GUIUtils.ShowOKDialog(GUILocalizeStrings.Get(10798625));  // no results found
                  // grabb_Internet_Informations(FullMovieName, GetID, true, wscript, FullMoviePath, grabtype, showAll);
                }
                return;
              }
              grabb_Internet_Details_Informations_Cover(Result, interactive, GetID, wscript, grabtype, sTitles);

              #endregion
            }

            Update_XML_database();
            LogMyFilms.Info("Database Updated for title/ttitle: " + title + "/" + ttitle);

            if (GetID != MyFilms.ID_MyFilmsCoverManager)
              if (title.Length > 0 && MyFilms.conf.StrFanart && grabtype != GrabType.Person) // Get Fanart
              {
                #region fanart

                // GUIDialogProgress dlgPrgrs = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS); // already defined above !
                if (dlgPrgrs != null)
                {
                  dlgPrgrs.Reset();
                  dlgPrgrs.DisplayProgressBar = false;
                  dlgPrgrs.ShowWaitCursor = true;
                  dlgPrgrs.DisableCancel(true);
                  dlgPrgrs.SetHeading(string.Format("{0} - {1}", "MyFilms", "Artwork Updater"));
                  dlgPrgrs.SetLine(1, "Loading Artwork ...");
                  dlgPrgrs.Percentage = 0;
                  dlgPrgrs.NeedRefresh();
                  dlgPrgrs.ShouldRenderLayer();
                  dlgPrgrs.StartModal(GUIWindowManager.ActiveWindow);

                  new System.Threading.Thread(delegate()
                      {
                        string imdbid = GetIMDB_Id(MyFilms.r[MyFilms.conf.StrIndex]);
                        GrabArtwork(title, ttitle, (int)year, director, imdbid, MyFilms.conf.StrTitle1, dlgPrgrs);
                        //  dlgPrgrs.Percentage = 100;
                        //  dlgPrgrs.SetLine(1, "Finished loading Movie Details ...");
                        //  dlgPrgrs.NeedRefresh();
                        //  dlgPrgrs.ShouldRenderLayer();
                        //  Thread.Sleep(500);
                        //  dlgPrgrs.ShowWaitCursor = false;
                        //  dlgPrgrs.Close();

                        //GrabArtwork(title, ttitle, (int)year, director, MyFilms.conf.StrTitle1.ToString(), r => 
                        //{
                        //  dlgPrgrs.Percentage = r;
                        //  return dlgPrgrs.ShouldRenderLayer();
                        //});
                        GUIWindowManager.SendThreadCallbackAndWait((p1, p2, data) =>
                            { return 0; }, 0, 0, null);
                      }) { Name = "MyFilmsArtworkLoader", IsBackground = true }.Start();
                  return;
                }
                // System.Collections.Generic.List<grabber.DBMovieInfo> listemovies = Grab.GetFanart(title, ttitle, (int)year, director, MyFilms.conf.StrPathFanart, true, false, MyFilms.conf.StrTitle1.ToString());

                #endregion
              }
            GUIWindowManager.SendThreadCallbackAndWait((p1, p2, data) =>
                {
                  if (GetID != MyFilms.ID_MyFilmsCoverManager)
                    if (DetailsUpdated != null) DetailsUpdated(true); // will launch screen update with new data, if handler registered
                  return 0;
                }, 0, 0, null);
          }) { Name = "MyFilmsDetailsLoader", IsBackground = true }.Start();
    }
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      if (_topTextureName == null)
      {
        _topTextureName = string.Empty;
      }
      if (_bottomTextureName == null)
      {
        _bottomTextureName = string.Empty;
      }
      if (_leftTextureName == null)
      {
        _leftTextureName = string.Empty;
      }
      if (_midTextureName == null)
      {
        _midTextureName = string.Empty;
      }
      if (_rightTextureName == null)
      {
        _rightTextureName = string.Empty;
      }
      if (_tickTextureName == null)
      {
        _tickTextureName = string.Empty;
      }
      if (_tickFill1TextureName == null)
      {
        _tickFill1TextureName = string.Empty;
      }
      if (_tickFill2TextureName == null)
      {
        _tickFill2TextureName = string.Empty;
      }
      if (_tickFill3TextureName == null)
      {
        _tickFill3TextureName = string.Empty;
      }
      if (_fillBackGroundTextureName == null)
      {
        _fillBackGroundTextureName = string.Empty;
      }
      if (_logoTextureName == null)
      {
        _logoTextureName = string.Empty;
      }
      _imageTop = LoadAnimationControl(_parentControlId, _controlId, 0, 0, 0, 0, _topTextureName);
      _imageBottom = LoadAnimationControl(_parentControlId, _controlId, 0, 0, 0, 0, _bottomTextureName);
      _imageLeft = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0, _leftTextureName);
      _imageMid = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0, _midTextureName);
      _imageRight = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0, _rightTextureName);
      _imageTick = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0, _tickTextureName);
      _imageFill1 = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0,
                                         _tickFill1TextureName);
      _imageFill2 = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0,
                                         _tickFill2TextureName);
      _imageFill3 = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0,
                                         _tickFill3TextureName);
      _imageFillBackground = LoadAnimationControl(_parentControlId, _controlId, 0, 0, 0, 0, _fillBackGroundTextureName);
      _imageTop.KeepAspectRatio = false;
      _imageBottom.KeepAspectRatio = false;
      _imageMid.KeepAspectRatio = false;
      _imageRight.KeepAspectRatio = false;
      _imageTick.KeepAspectRatio = false;
      _imageFill1.KeepAspectRatio = false;
      _imageFill2.KeepAspectRatio = false;
      _imageFill3.KeepAspectRatio = false;
      _imageFillBackground.KeepAspectRatio = false;

      _imageTop.ParentControl = this;
      _imageBottom.ParentControl = this;
      _imageMid.ParentControl = this;
      _imageRight.ParentControl = this;
      _imageTick.ParentControl = this;
      _imageFill1.ParentControl = this;
      _imageFill2.ParentControl = this;
      _imageFill3.ParentControl = this;
      _imageFillBackground.ParentControl = this;
      _imageLogo = LoadAnimationControl(_parentControlId, _controlId, 0, 0, 0, 0, _logoTextureName);
      _imageLogo.ParentControl = this;
      FontName = _fontName;
    }
示例#15
0
    /// <summary>
    /// This method gets called when the control is created and all properties has been set
    /// It allows the control todo any initialization
    /// </summary>
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      _imageFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                           _focusedTextureName);
      _imageFocused.ParentControl = this;
      _imageFocused.Filtering = false;
      _imageFocused.DimColor = DimColor;
      _imageFocused.ColourDiffuse = ColourDiffuse;
      _imageFocused.SetBorder(_strBorderTF, _borderPositionTF, _borderTextureRepeatTF, _borderTextureRotateTF,
                              _borderTextureFileNameTF, _borderColorKeyTF, _borderHasCornersTF,
                              _borderCornerTextureRotateTF);
      TileFillTF = _textureFocusTileFill;
      _imageFocused.MaskFileName = _focusedTextureMask;
      _imageFocused.OverlayFileName = _overlayTF;

      _imageNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                              _nonFocusedTextureName);
      _imageNonFocused.ParentControl = this;
      _imageNonFocused.Filtering = false;
      _imageNonFocused.DimColor = DimColor;
      _imageNonFocused.ColourDiffuse = ColourDiffuse;
      _imageNonFocused.SetBorder(_strBorderTNF, _borderPositionTNF, _borderTextureRepeatTNF, _borderTextureRotateTNF,
                                 _borderTextureFileNameTNF, _borderColorKeyTNF, _borderHasCornersTNF,
                                 _borderCornerTextureRotateTNF);
      TileFillTNF = _textureNoFocusTileFill;
      _imageNonFocused.MaskFileName = _nonFocusedTextureMask;
      _imageNonFocused.OverlayFileName = _overlayTNF;

      if (_hoverFilename != string.Empty)
      {
        GUIGraphicsContext.ScaleRectToScreenResolution(ref _hoverX, ref _hoverY, ref _hoverWidth, ref _hoverHeight);
        _hoverImage = LoadAnimationControl(_parentControlId, _controlId, _hoverX, _hoverY, _hoverWidth, _hoverHeight,
                                           _hoverFilename);
        _hoverImage.ParentControl = this;
        _hoverImage.DimColor = DimColor;
        _hoverImage.ColourDiffuse = ColourDiffuse;
        _hoverImage.SetBorder(_strBorderH, _borderPositionH, _borderTextureRepeatH, _borderTextureRotateH,
                              _borderTextureFileNameH, _borderColorKeyH, _borderHasCornersH, _borderCornerTextureRotateH);
        TileFillH = _hoverTileFill;
        _hoverImage.MaskFileName = _hoverMask;
        _hoverImage.OverlayFileName = _overlayH;
      }

      GUILocalizeStrings.LocalizeLabel(ref _label);

      // Use a GUIFadeLabel if a valid scrollStartDelay is specified, otherwise use a GUILabelControl (default)
      if (_scrollStartDelay < 0)
      {
        _labelControl = new GUILabelControl(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName,
                                            _label, _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP, false,
                                            _shadowAngle, _shadowDistance, _shadowColor);
        ((GUILabelControl)_labelControl).TextAlignment = _textAlignment;
        ((GUILabelControl)_labelControl).TextVAlignment = _textVAlignment;
      }
      else
      {
        _labelControl = new GUIFadeLabel(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName,
                                         _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP,
                                         _shadowAngle, _shadowDistance, _shadowColor,
                                         _userWrapString);
        ((GUIFadeLabel)_labelControl).TextAlignment = _textAlignment;
        ((GUIFadeLabel)_labelControl).TextVAlignment = _textVAlignment;
        ((GUIFadeLabel)_labelControl).AllowScrolling = false;
        ((GUIFadeLabel)_labelControl).AllowFadeIn = false;
      }
      _labelControl.DimColor = DimColor;
      _labelControl.ParentControl = this;
    }
    /*public GUIFilmstripControl(int dwParentID, int dwControlId, int dwPosX, int dwPosY, int dwWidth, int dwHeight, 
      string strFontName, 
      string strImageIcon, 
      string strImageIconFocus, 
      int dwitemWidth, int dwitemHeight, 
      int dwSpinWidth, int dwSpinHeight, 
      string strUp, string strDown, 
      string strUpFocus, string strDownFocus, 
      long dwSpinColor, int dwSpinX, int dwSpinY, 
      string strFont, long dwTextColor, long dwSelectedColor, 
      string strScrollbarBackground, string strScrollbarTop, string strScrollbarBottom)
      : base(dwParentID, dwControlId, dwPosX, dwPosY, dwWidth, dwHeight)
    {
    }*/

    /// <summary> 
    /// This function is called after all of the XmlSkinnable fields have been filled
    /// with appropriate data.
    /// Use this to do any construction work other than simple data member assignments,
    /// for example, initializing new reference types, extra calculations, etc..
    /// </summary>
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      if (_positionY > _positionY && _spinControlPositionY < _positionY + _height)
      {
        _spinControlPositionY = _positionY + _height;
      }
      for (int i = 0; i < 30; ++i)
      {
        GUIAnimation anim = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _itemWidth,
                                                 _itemHeight, _imageFolderName);
        anim.ParentControl = this;
        anim.DimColor = DimColor;
        anim.FlipX = _flipX;
        anim.FlipY = _flipY;
        anim.DiffuseFileName = _diffuseFileName;
        anim.MaskFileName = _imageFolderMask;
        //anim.SetAnimations(ThumbAnimations);
        _imageFolder.Add(anim);

        anim = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _itemWidth, _itemHeight,
                                    _imageFolderNameFocus);
        anim.ParentControl = this;
        anim.DimColor = DimColor;
        anim.FlipX = _flipX;
        anim.FlipY = _flipY;
        anim.DiffuseFileName = _diffuseFileName;
        anim.MaskFileName = _imageFolderFocusMask;
        //anim.SetAnimations(ThumbAnimations);
        _imageFolderFocus.Add(anim);

        anim = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _itemWidth, _itemHeight,
                                    _frameName);
        anim.ParentControl = this;
        anim.DimColor = DimColor;
        //anim.FlipX = _flipX;
        //anim.FlipY = _flipY;
        anim.DiffuseFileName = _diffuseFileName;
        anim.MaskFileName = _frameMask;
        //anim.SetAnimations(ThumbAnimations);
        _frameControl.Add(anim);

        anim = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _itemWidth, _itemHeight,
                                    _frameFocusName);
        anim.ParentControl = this;
        anim.DimColor = DimColor;
        //anim.FlipX = _flipX;
        //anim.FlipY = _flipY;
        anim.DiffuseFileName = _diffuseFileName;
        anim.MaskFileName = _frameFocusMask;
        //anim.SetAnimations(ThumbAnimations);
        _frameFocusControl.Add(anim);

        // for label
        GUIFadeLabel fadelabel = new GUIFadeLabel(_parentControlId, _controlId, _positionX, _positionY, _textureWidth,
                                                  _textureHeight, _fontName, _textColor, Alignment.ALIGN_LEFT,
                                                  VAlignment.ALIGN_TOP, 0, 0, 0, " | ");
        fadelabel.ParentControl = this;
        fadelabel.AllowScrolling = false;
        fadelabel.DimColor = DimColor;
        //fadelabel.AllowFadeIn = false;
        _listLabels.Add(fadelabel);
      }

      _upDownControl = new GUISpinControl(_controlId, 0, _spinControlPositionX, _spinControlPositionY, _spinControlWidth,
                                          _spinControlHeight, _upTextureName, _downTextureName, _upTextureNameFocus,
                                          _downTextureNameFocus, _fontName, _spinControlColor,
                                          GUISpinControl.SpinType.SPIN_CONTROL_TYPE_INT, _spinControlAlignment);
      _upDownControl.ParentControl = this;
      _upDownControl.DimColor = DimColor;

      _font = GUIFontManager.GetFont(_fontName);



      // Create the horizontal scrollbar.
      int scrollbarWidth = _scrollbarWidth;
      int scrollbarHeight = _scrollbarHeight;
      GUIGraphicsContext.ScaleHorizontal(ref scrollbarWidth);
      GUIGraphicsContext.ScaleVertical(ref scrollbarHeight);
      int scrollbarPosX = _positionX + (_width / 2) - (scrollbarWidth / 2);

      _horizontalScrollbar = new GUIHorizontalScrollbar(_controlId, 0,
                                                        scrollbarPosX, _positionY + _scrollbarOffsetY,
                                                        scrollbarWidth, scrollbarHeight,
                                                        _scrollbarBackgroundName, _scrollbarLeftName,
                                                        _scrollbarRightName);
      _horizontalScrollbar.ParentControl = this;
      _horizontalScrollbar.DimColor = DimColor;


      _upDownControl.Orientation = eOrientation.Horizontal;
      _upDownControl.SetReverse(true);

      _imageBackground = LoadAnimationControl(0, 0, _backGroundPositionX, _backGroundPositionY, _backGroundWidth,
                                              _backGroundHeight, _backgroundTextureName);
      _imageBackground.ParentControl = this;
      _imageBackground.DimColor = DimColor;

      _imageInfo = new GUIImage(0, 0, _infoImagePositionX, _infoImagePositionY, _infoImageWidth, _infoImageHeight,
                                _infoImageName, 0);
      _imageInfo.ParentControl = this;
      _imageInfo.Filtering = true;
      _imageInfo.KeepAspectRatio = true;
      _imageInfo.ImageAlignment = Alignment.ALIGN_CENTER;
      _imageInfo.ImageVAlignment = VAlignment.ALIGN_MIDDLE;
      _imageInfo.HorizontalAlignment = MediaPortal.Drawing.HorizontalAlignment.Center;
      _imageInfo.VerticalAlignment = MediaPortal.Drawing.VerticalAlignment.Center;
      _imageInfo.DimColor = DimColor;
      _imageInfo.FlipX = _flipInfoImageX;
      _imageInfo.FlipY = _flipInfoImageY;
      _imageInfo.DiffuseFileName = _diffuseInfoImageFileName;
      _imageInfo.MaskFileName = _infoImageMask;

      SetThumbDimensionsLow(_thumbNailPositionX, _thumbNailPositionY, _thumbNailWidth, _thumbNailHeight);
      SetTextureDimensions(_textureWidth, _textureHeight);
    }
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      ImgUpButtonNormal = LoadAnimationControl(WindowId, WindowId + 10000, UpBtnXOffset, UpBtnYOffset, UpBtnWidth,
                                               UpBtnHeight, TextureMoveUpFileName);
      ImgUpButtonFocused = LoadAnimationControl(WindowId, WindowId + 10001, 0, 0, UpBtnWidth, UpBtnHeight,
                                                TextureMoveUpFocusedFileName);
      ImgUpButtonNormal.ParentControl = this;
      ImgUpButtonFocused.ParentControl = this;
      ImgUpButtonNormal.DimColor = DimColor;
      ImgUpButtonFocused.DimColor = DimColor;
      ImgUpButtonNormal.BringIntoView();
      ImgUpButtonFocused.BringIntoView();

      ImgDownButtonNormal = LoadAnimationControl(WindowId, WindowId + 10003, DownBtnXOffset, DownBtnYOffset,
                                                 DownBtnWidth, DownBtnHeight, TextureMoveDownFileName);
      ImgDownButtonFocused = LoadAnimationControl(WindowId, WindowId + 10004, 0, 0, DownBtnWidth, DownBtnHeight,
                                                  TextureMoveDownFocusedFileName);
      ImgDownButtonNormal.ParentControl = this;
      ImgDownButtonFocused.ParentControl = this;
      ImgDownButtonNormal.DimColor = DimColor;
      ImgDownButtonFocused.DimColor = DimColor;
      ImgDownButtonNormal.BringIntoView();
      ImgDownButtonFocused.BringIntoView();

      ImgDeleteButtonNormal = LoadAnimationControl(WindowId, WindowId + 10006, DeleteBtnXOffset, DeleteBtnYOffset,
                                                   DeleteBtnWidth, DeleteBtnHeight, TextureDeleteFileName);
      ImgDeleteButtonFocused = LoadAnimationControl(WindowId, WindowId + 10007, 0, 0, DeleteBtnWidth, DeleteBtnHeight,
                                                    TextureDeleteFocusedFileName);
      ImgDeleteButtonNormal.ParentControl = this;
      ImgDeleteButtonFocused.ParentControl = this;
      ImgDeleteButtonNormal.DimColor = DimColor;
      ImgDeleteButtonFocused.DimColor = DimColor;
      ImgDeleteButtonNormal.BringIntoView();
      ImgDeleteButtonFocused.BringIntoView();

      // Keep track of the original NavigateLeft and NavigateRight values...
      _NavigateLeft = NavigateLeft;
      _NavigateRight = NavigateRight;

      string skinFolderPath = GUIGraphicsContext.GetThemedSkinDirectory(@"\media\");
      ImgUpButtonDisabled = GetDisabledButtonImage(skinFolderPath, TextureMoveUpFileName, WindowId, WindowId + 10002,
                                                   UpBtnXOffset, UpBtnYOffset, UpBtnWidth, UpBtnHeight);

      if (ImgUpButtonDisabled != null)
      {
        ImgDeleteButtonNormal.ParentControl = this;
        ImgUpButtonDisabled.BringIntoView();
      }

      ImgDownButtonDisabled = GetDisabledButtonImage(skinFolderPath, TextureMoveDownFileName, WindowId,
                                                     WindowId + 10005, DownBtnXOffset, DownBtnYOffset, DownBtnWidth,
                                                     DownBtnHeight);

      if (ImgDownButtonDisabled != null)
      {
        ImgDownButtonDisabled.ParentControl = this;
        ImgDownButtonDisabled.BringIntoView();
      }

      ImgDeleteButtonDisabled = GetDisabledButtonImage(skinFolderPath, TextureDeleteFileName, WindowId,
                                                       WindowId + 10008, DeleteBtnXOffset, DeleteBtnYOffset,
                                                       DeleteBtnWidth, DeleteBtnHeight);

      if (ImgDeleteButtonDisabled != null)
      {
        ImgDeleteButtonDisabled.ParentControl = this;
        ImgDeleteButtonDisabled.BringIntoView();
      }
    }
        /// <summary>
        /// This method gets called when the control is created and all properties has been set
        /// It allows the control todo any initialization
        /// </summary>
        public override void FinalizeConstruction()
        {
            base.FinalizeConstruction();
            _imageFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                                 _focusedTextureName);
            _imageFocused.ParentControl = this;
            _imageFocused.Filtering     = false;
            _imageFocused.DimColor      = DimColor;
            _imageFocused.SetBorder(_strBorderTF, _borderPositionTF, _borderTextureRepeatTF, _borderTextureRotateTF,
                                    _borderTextureFileNameTF, _borderColorKeyTF, _borderHasCornersTF,
                                    _borderCornerTextureRotateTF);

            _imageNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                                    _nonFocusedTextureName);
            _imageNonFocused.ParentControl = this;
            _imageNonFocused.Filtering     = false;
            _imageNonFocused.DimColor      = DimColor;
            _imageNonFocused.SetBorder(_strBorderTNF, _borderPositionTNF, _borderTextureRepeatTNF, _borderTextureRotateTNF,
                                       _borderTextureFileNameTNF, _borderColorKeyTNF, _borderHasCornersTNF,
                                       _borderCornerTextureRotateTNF);
            GUILocalizeStrings.LocalizeLabel(ref _label);


            if (_scrollStartDelay < 0)
            {
                _labelControl = new GUILabelControl(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName,
                                                    _label, _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP, false,
                                                    _shadowAngle, _shadowDistance, _shadowColor);
                ((GUILabelControl)_labelControl).ParentControl  = this;
                ((GUILabelControl)_labelControl).DimColor       = DimColor;
                ((GUILabelControl)_labelControl).TextAlignment  = _textAlignment;
                ((GUILabelControl)_labelControl).TextVAlignment = _textVAlignment;
            }
            else
            {
                _labelControl = new GUIFadeLabel(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName,
                                                 _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP,
                                                 _shadowAngle, _shadowDistance, _shadowColor,
                                                 _userWrapString);
                ((GUIFadeLabel)_labelControl).TextAlignment  = _textAlignment;
                ((GUIFadeLabel)_labelControl).TextVAlignment = _textVAlignment;
                ((GUIFadeLabel)_labelControl).AllowScrolling = false;
                ((GUIFadeLabel)_labelControl).AllowFadeIn    = false;
            }

            string spinFontName = _fontName;

            if (_spinTextInButton)
            {
                // When the spin control font name is null the spin control will not render the text.
                // _spinTextInButton will render the spin control text in the button label.
                spinFontName = null;
            }

            _spinControl = new GUISpinControl(GetID, 0, _positionX + _width - _spinWidth, _positionY, _spinWidth,
                                              _spinHeight, _upTextureName, _downTextureName,
                                              _upTextureNameFocus, _downTextureNameFocus,
                                              spinFontName, _textColor, _spinType, _spinAlignment);
            _spinControl.ParentControl = this;
            _spinControl.DimColor      = DimColor;
            _spinControl.ShowRange     = _showRange;
            _spinControl.Digits        = _digits;
            _spinControl.SetReverse(_reverse);
            _spinControl.Orientation = _orientation;
            _spinControl.CycleItems  = _cycleItems;
            _spinControl.SetShadow(_shadowAngle, _shadowDistance, _shadowColor);
            _spinControl.PrefixText  = _prefixText;
            _spinControl.SuffixText  = _suffixText;
            _spinControl.TextOffsetX = _spinTextOffsetX;
            _spinControl.TextOffsetY = _spinTextOffsetY;

            // Pass all of the subitems to the spin control.
            for (int i = 0; i < SubItemCount; ++i)
            {
                _spinControl.AddSubItem(GetSubItem(i));
            }
            for (int i = 0; i < SubItemCount; ++i)
            {
                RemoveSubItem(i);
            }
        }
    /// <summary>
    /// This method gets called when the control is created and all properties has been set
    /// It allows the control todo any initialization
    /// </summary>
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();

      _imageCheckMarkFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY,
                                                    _checkMarkWidth, _checkMarkHeight, _checkMarkFocusTextureName);
      _imageCheckMarkFocused.ParentControl = this;
      _imageCheckMarkFocused.DimColor = DimColor;

      _imageCheckMarkNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY,
                                                       _checkMarkWidth, _checkMarkHeight, _checkMarkNoFocusTextureName);
      _imageCheckMarkNonFocused.ParentControl = this;
      _imageCheckMarkNonFocused.DimColor = DimColor;

      if (_fontName != "" && _fontName != "-")
      {
        _font = GUIFontManager.GetFont(_fontName);
      }

      GUILocalizeStrings.LocalizeLabel(ref _label);
    }
示例#20
0
    /// <summary> 
    /// This function is called after all of the XmlSkinnable fields have been filled
    /// with appropriate data.
    /// Use this to do any construction work other than simple data member assignments,
    /// for example, initializing new reference types, extra calculations, etc..
    /// </summary>
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      _imageBackGround = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                              _backgroundTextureName);
      _imageBackGround.ParentControl = this;
      _imageBackGround.DimColor = DimColor;

      _imageLeft = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0, _leftTextureName);
      _imageLeft.ParentControl = this;
      _imageLeft.DimColor = DimColor;

      _imageMid = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0, _midTextureName);
      _imageMid.ParentControl = this;
      _imageMid.DimColor = DimColor;

      _imageRight = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0, _rightTextureName);
      _imageRight.ParentControl = this;
      _imageRight.DimColor = DimColor;

      _imageBackGround.KeepAspectRatio = false;
      _imageMid.KeepAspectRatio = false;
      _imageRight.KeepAspectRatio = false;
      if (_property == null)
      {
        _property = string.Empty;
      }
      if (_property.IndexOf("#") >= 0)
      {
        _containsProperty = true;
      }
    }
示例#21
0
        /// <summary>
        /// This method gets called when the control is created and all properties has been set
        /// It allows the control to do any initialization
        /// </summary>
        public override void FinalizeConstruction()
        {
            base.FinalizeConstruction();
            _imageFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                                 _focusedTextureName);
            _imageFocused.ParentControl = this;
            _imageFocused.Filtering     = false;
            _imageFocused.DimColor      = DimColor;
            _imageFocused.ColourDiffuse = ColourDiffuse;
            _imageFocused.SetBorder(_strBorderTF, _borderPositionTF, _borderTextureRepeatTF, _borderTextureRotateTF,
                                    _borderTextureFileNameTF, _borderColorKeyTF, _borderHasCornersTF,
                                    _borderCornerTextureRotateTF);
            TileFillTF = _textureFocusTileFill;
            _imageFocused.MaskFileName    = _focusedTextureMask;
            _imageFocused.OverlayFileName = _overlayTF;

            _imageNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                                    _nonFocusedTextureName);
            _imageNonFocused.ParentControl = this;
            _imageNonFocused.Filtering     = false;
            _imageNonFocused.DimColor      = DimColor;
            _imageNonFocused.ColourDiffuse = ColourDiffuse;
            _imageNonFocused.SetBorder(_strBorderTNF, _borderPositionTNF, _borderTextureRepeatTNF, _borderTextureRotateTNF,
                                       _borderTextureFileNameTNF, _borderColorKeyTNF, _borderHasCornersTNF,
                                       _borderCornerTextureRotateTNF);
            TileFillTNF = _textureNoFocusTileFill;
            _imageNonFocused.MaskFileName    = _nonFocusedTextureMask;
            _imageNonFocused.OverlayFileName = _overlayTNF;

            if (_hoverFilename != string.Empty)
            {
                GUIGraphicsContext.ScaleRectToScreenResolution(ref _hoverX, ref _hoverY, ref _hoverWidth, ref _hoverHeight);
                _hoverImage = LoadAnimationControl(_parentControlId, _controlId, _hoverX, _hoverY, _hoverWidth, _hoverHeight,
                                                   _hoverFilename);
                _hoverImage.ParentControl = this;
                _hoverImage.DimColor      = DimColor;
                _hoverImage.ColourDiffuse = ColourDiffuse;
                _hoverImage.SetBorder(_strBorderH, _borderPositionH, _borderTextureRepeatH, _borderTextureRotateH,
                                      _borderTextureFileNameH, _borderColorKeyH, _borderHasCornersH, _borderCornerTextureRotateH);
                TileFillH = _hoverTileFill;
                _hoverImage.MaskFileName    = _hoverMask;
                _hoverImage.OverlayFileName = _overlayH;
            }

            GUILocalizeStrings.LocalizeLabel(ref _label);

            // Use a GUIFadeLabel if a valid scrollStartDelay is specified, otherwise use a GUILabelControl (default)
            if (_scrollStartDelay < 0)
            {
                _labelControl = new GUILabelControl(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName,
                                                    _label, _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP, false,
                                                    _shadowAngle, _shadowDistance, _shadowColor);
                ((GUILabelControl)_labelControl).TextAlignment  = _textAlignment;
                ((GUILabelControl)_labelControl).TextVAlignment = _textVAlignment;
            }
            else
            {
                _labelControl = new GUIFadeLabel(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName,
                                                 _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP,
                                                 _shadowAngle, _shadowDistance, _shadowColor,
                                                 _userWrapString);
                ((GUIFadeLabel)_labelControl).TextAlignment  = _textAlignment;
                ((GUIFadeLabel)_labelControl).TextVAlignment = _textVAlignment;
                ((GUIFadeLabel)_labelControl).AllowScrolling = false;
                ((GUIFadeLabel)_labelControl).AllowFadeIn    = false;
            }
            _labelControl.DimColor      = DimColor;
            _labelControl.ParentControl = this;
        }
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      int x1 = 16;
      int y1 = 16;
      GUIGraphicsContext.ScalePosToScreenResolution(ref x1, ref y1);
      _imageFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                           _textureFocusName);
      _imageFocused.ParentControl = this;
      _imageFocused.DimColor = DimColor;

      _imageNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                              _textureNoFocusName);
      _imageNonFocused.ParentControl = this;
      _imageNonFocused.DimColor = DimColor;

      _imageBackground = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                              _backgroundTextureName);
      _imageBackground.ParentControl = this;
      _imageBackground.DimColor = DimColor;

      _imageLeft = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _leftTextureWidth, _leftTextureHeight, _leftTextureName);
      _imageLeft.DimColor = DimColor;
      _imageLeft.ParentControl = this;

      _imageLeftFocus = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _leftTextureFocusWidth, _leftTextureFocusHeight,
                                             _leftFocusName);
      _imageLeftFocus.ParentControl = this;
      _imageLeftFocus.DimColor = DimColor;

      _imageRight = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _rightTextureWidth, _rightTextureHeight, _rightTextureName);
      _imageRight.ParentControl = this;
      _imageRight.DimColor = DimColor;

      _imageRightFocus = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _rightTextureFocusWidth, _rightTextureFocusHeight,
                                              _rightFocusName);
      _imageRightFocus.ParentControl = this;
      _imageRightFocus.DimColor = DimColor;

      if (_fontName != "" && _fontName != "-")
      {
        _font = GUIFontManager.GetFont(_fontName);
      }
      GUILocalizeStrings.LocalizeLabel(ref _label);
      _imageFocused.Filtering = false;
      _imageNonFocused.Filtering = false;
      _imageBackground.Filtering = false;
      _imageLeft.Filtering = false;
      _imageLeftFocus.Filtering = false;
      _imageRight.Filtering = false;
      _imageRightFocus.Filtering = false;
      _labelControl = new GUILabelControl(_parentControlId);
      _labelControl.CacheFont = true;
      _labelControl.ParentControl = this;
      _labelControl.SetShadow(_shadowAngle, _shadowDistance, _shadowColor);
    }
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      _imageSpinUp = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                          _upTextureName);
      _imageSpinUp.ParentControl = this;
      _imageSpinUp.DimColor = DimColor;

      _imageSpinDown = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                            _downTextureName);
      _imageSpinDown.ParentControl = this;
      _imageSpinDown.DimColor = DimColor;

      _imageSpinUpFocus = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                               _upTextureNameFocus);
      _imageSpinUpFocus.ParentControl = this;
      _imageSpinUpFocus.DimColor = DimColor;

      _imageSpinDownFocus = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                                 _downTextureNameFocus);
      _imageSpinDownFocus.ParentControl = this;
      _imageSpinDownFocus.DimColor = DimColor;

      _imageSpinUp.Filtering = false;
      _imageSpinDown.Filtering = false;
      _imageSpinUpFocus.Filtering = false;
      _imageSpinDownFocus.Filtering = false;
      _labelControl = new GUILabelControl(_parentControlId);
      _labelControl.CacheFont = true;
      _labelControl.ParentControl = this;
      _labelControl.DimColor = DimColor;
      _labelControl.SetShadow(_shadowAngle, _shadowDistance, _shadowColor);
    }
示例#24
0
    internal static void Launch_Movie_Trailer(int selectItem, int GetID, GUIAnimation m_SearchAnimation)
    //-------------------------------------------------------------------------------------------
    // Play Movie Trailers !!!
    //-------------------------------------------------------------------------------------------
    {
      // Run externaly Program before Playing if defined in setup
      SetProcessAnimationStatus(true, m_SearchAnimation);
      LogMyFilms.Debug("(Play Movie Trailer) selectItem = '" + selectItem + "' - GetID = '" + GetID + "' - m_SearchAnimation = '" + m_SearchAnimation + "'");

      if (Helper.FieldIsSet(MyFilms.conf.CmdPar)) RunProgram(MyFilms.conf.CmdExe, MyFilms.r[MyFilms.conf.StrIndex][MyFilms.conf.CmdPar].ToString());

      if (g_Player.Playing) g_Player.Stop();
      // search all files
      var newItems = new ArrayList();
      int movieIndex = 0;
      bool noResumeMovie = true;

      LogMyFilms.Debug("MyFilmsDetails (Launch_Movie_Trailer): new do Moviesearch with '" + selectItem + "' (Selected_Item");
      //Change back, if method in original properly adapted with bool Trailer
      SearchAllFiles(MyFilms.r[selectItem], false, ref noResumeMovie, ref newItems, ref movieIndex, true, "");
      LogMyFilms.Debug("MyFilmsDetails (Launch_Movie_Trailer): newItems.Count: '" + newItems.Count + "'");
      if (newItems.Count > 20)
      // Maximum 20 entries (limitation for MP dialogFileStacking)
      {
        GUIUtils.ShowOKDialog("", MyFilms.r[selectItem][MyFilms.conf.StrSTitle].ToString(), "maximum 20 entries for the playlist", "");
        LogMyFilms.Info("Too many entries found for movie '" + MyFilms.r[selectItem][MyFilms.conf.StrSTitle] + "', number of entries found = " + newItems.Count.ToString());
        return;
      }
      SetProcessAnimationStatus(false, m_SearchAnimation);
      if (newItems.Count > 1)
      {
        var dlgmenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
        dlgmenu.Reset();
        dlgmenu.SetHeading(GUILocalizeStrings.Get(10798704)); // Trailer ...
        dlgmenu.Add(GUILocalizeStrings.Get(10798740)); // play all trailers 

        foreach (object t in newItems)
        {
          var movieFileName = (string)t;
          long wsize = File.Exists(movieFileName) ? new FileInfo(movieFileName).Length : 0;
          string wsizeformatted = string.Format("{0} MB", wsize / 1048576);
          if (movieFileName.Contains("\\"))
            dlgmenu.Add(movieFileName.Substring(movieFileName.LastIndexOf("\\", StringComparison.Ordinal) + 1) + " (" + wsizeformatted + ")"); // add moviename to menu
          else
            dlgmenu.Add(movieFileName + " (" + wsizeformatted + ")"); // add moviename to menu
        }

        dlgmenu.DoModal(GetID);
        if (dlgmenu.SelectedLabel == -1) return;
        //if (dlgmenu.SelectedLabel > 0) // 0 = Play all trailers - so >0 -> a specific choice has been taken ...
        //IMovieIndex = dlgmenu.SelectedId; // is "1" - as "0" is used for play all movies ...
        movieIndex = dlgmenu.SelectedLabel;

        //GUIDialogFileStacking dlg = (GUIDialogFileStacking)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_FILESTACKING);
        //if (null != dlg)
        //{
        //    dlg.SetNumberOfFiles(newItems.Count);
        //    dlg.DoModal(GUIWindowManager.ActiveWindow);
        //    int selectedFileIndex = dlg.SelectedFile;
        //    if (selectedFileIndex < 1) return;
        //    IMovieIndex = selectedFileIndex++;
        //}
      }
      if (newItems.Count > 0)
      {
        playlistPlayer.Reset();
        playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_VIDEO_TEMP;
        PlayList playlist = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO_TEMP);
        playlist.Clear();

        if (movieIndex > 0)
        {
          var movieFileName = (string)newItems[movieIndex - 1]; // as in menu there is "all-option" as first index 0 ...
          var newitem = new PlayListItem();
          newitem.FileName = movieFileName;
          LogMyFilms.Info("Play specific movie trailer: '" + movieFileName + "'");
          newitem.Type = PlayListItem.PlayListItemType.Video;
          playlist.Add(newitem);
        }
        else // if play all trailers is chosen add all available trailers to playlist
        {
          foreach (object t in newItems)
          {
            var movieFileName = (string)t;
            var newitem = new PlayListItem();
            newitem.FileName = movieFileName;
            LogMyFilms.Info("Add trailer to playlist: '" + movieFileName + "'");
            newitem.Type = PlayListItem.PlayListItemType.Video;
            playlist.Add(newitem);
          }
        }
        // play movie...
        //PlayMovieFromPlayListTrailer(NoResumeMovie, IMovieIndex - 1);
        PlayMovieFromPlayListTrailer(0); // always start with first trailer ...
      }
      else
      {
        LogMyFilms.Info("File not found for movie '" + MyFilms.r[selectItem][MyFilms.conf.StrSTitle] + "'");
        bool tryOther = false;
        GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO);
        dlgYesNo.Reset();
        dlgYesNo.SetHeading(GUILocalizeStrings.Get(107986) + " " + MyFilms.r[selectItem][MyFilms.conf.StrSTitle]);
        dlgYesNo.SetLine(2, GUILocalizeStrings.Get(10798737));
        dlgYesNo.SetLine(3, GUILocalizeStrings.Get(10798738));
        dlgYesNo.DoModal(GUIWindowManager.ActiveWindow);
        if (dlgYesNo.IsConfirmed) tryOther = true;

        if (tryOther) //if (GUIUtils.ShowYesNoDialog(GUILocalizeStrings.Get(107986) + " " + MyFilms.r[selectItem][MyFilms.conf.StrSTitle], GUILocalizeStrings.Get(10798737) + "\n" + GUILocalizeStrings.Get(10798738))) //my films & Titel //no video found locally // Try Youtube?
        {
          var dlgmenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
          var choiceViewMenu = new List<string>();
          dlgmenu.Reset();
          choiceViewMenu.Clear();
          dlgmenu.SetHeading(GUILocalizeStrings.Get(10798704)); // Trailer ...

          dlgmenu.Add(GUILocalizeStrings.Get(10798711)); //search youtube trailer with onlinevideos
          choiceViewMenu.Add("playtraileronlinevideos");
          dlgmenu.Add(GUILocalizeStrings.Get(10798712)); //search apple itunes trailer with onlinevideos 10798716
          choiceViewMenu.Add("playtraileronlinevideosappleitunes");
          dlgmenu.Add(GUILocalizeStrings.Get(10798716)); //search IMDB trailer with onlinevideos
          choiceViewMenu.Add("playtraileronlinevideosimdbtrailer");
          dlgmenu.Add(GUILocalizeStrings.Get(712) + " ..."); //Return ...
          choiceViewMenu.Add("return");

          dlgmenu.DoModal(GetID);
          if (dlgmenu.SelectedLabel == -1) return;

          string site;
          string titleextension = string.Empty;
          string path = MyFilms.r[MyFilms.conf.StrIndex][MyFilms.conf.StrStorage].ToString();
          if (path.Contains(";"))
            path = path.Substring(0, path.IndexOf(";", System.StringComparison.Ordinal));
          if (path.Contains("\\"))
            path = path.Substring(0, path.LastIndexOf("\\", System.StringComparison.Ordinal));

          switch (choiceViewMenu[dlgmenu.SelectedLabel].ToLower())
          {
            case "playtraileronlinevideos":
              site = "YouTube";
              titleextension = " " + MyFilms.r[MyFilms.conf.StrIndex]["Year"] + " trailer" + ((MyFilms.conf.GrabberOverrideLanguage.Length > 0) ? (" " + MyFilms.conf.GrabberOverrideLanguage) : "");
              break;
            case "playtraileronlinevideosappleitunes":
              site = "iTunes Movie Trailers";
              break;
            case "playtraileronlinevideosimdbtrailer":
              site = "IMDb Movie Trailers";
              break;
            default:
              return;
          }
          // Load OnlineVideo Plugin with Searchparameters for YouTube and movie to Search ... OV reference for parameters: site:<sitename>|category:<categoryname>|search:<searchstring>|VKonfail:<true,false>|return:<Locked,Root>
          if (Helper.IsOnlineVideosAvailableAndEnabled)
          {
            string title = GetSearchTitle(MyFilms.r, MyFilms.conf.StrIndex, "");
            string oVstartparams = "site:" + site + "|category:|search:" + title + titleextension + "|return:Locked" + "|downloaddir:" + path + "|downloadmenuentry:" + GUILocalizeStrings.Get(10798749) + " (" + title + ")";
            //GUIPropertyManager.SetProperty("Onlinevideos.startparams", OVstartparams);
            GUIPropertyManager.SetProperty("#OnlineVideos.startparams.Site", site);
            GUIPropertyManager.SetProperty("#OnlineVideos.startparams.Category", "");
            GUIPropertyManager.SetProperty("#OnlineVideos.startparams.Search", title + titleextension);
            GUIPropertyManager.SetProperty("#OnlineVideos.startparams.Return", "Locked");
            GUIPropertyManager.SetProperty("#OnlineVideos.startparams.downloaddir", path);
            //GUIPropertyManager.SetProperty("#OnlineVideos.startparams.downloadfilename", "");
            GUIPropertyManager.SetProperty("#OnlineVideos.startparams.downloadmenuentry", GUILocalizeStrings.Get(10798749) + " (" + title + ")"); // download to movie directory
            LogMyFilms.Debug("Starting OnlineVideos with '" + oVstartparams.ToString() + "'");
            // should this be set here to make original movie doesn't get set to watched??
            // trailerPlayed = true;

            GUIWindowManager.ActivateWindow((int)MyFilms.ExternalPluginWindows.OnlineVideos, oVstartparams);

            GUIPropertyManager.SetProperty("#OnlineVideos.startparams.Site", "");
            GUIPropertyManager.SetProperty("#OnlineVideos.startparams.Category", "");
            GUIPropertyManager.SetProperty("#OnlineVideos.startparams.Search", "");
            GUIPropertyManager.SetProperty("#OnlineVideos.startparams.Return", "");
            GUIPropertyManager.SetProperty("#OnlineVideos.startparams.downloaddir", "");
            GUIPropertyManager.SetProperty("#OnlineVideos.startparams.downloadfilename", "");
            GUIPropertyManager.SetProperty("#OnlineVideos.startparams.downloadmenuentry", "");
          }
          else
          {
            // GUIUtils.ShowNotifyDialog("OnlineVideo plugin not installed or wrong version");
            GUIUtils.ShowOKDialog("OnlineVideo plugin not installed or wrong version", "Minimum Version required: " + MyFilmsSettings.GetRequiredMinimumVersion(MyFilmsSettings.MinimumVersion.OnlineVideos), "", "");
          }
        }
      }
    }
示例#25
0
    public static void Launch_Movie(int select_item, int GetID, GUIAnimation m_SearchAnimation, PlayerOption playeroption)
    //-------------------------------------------------------------------------------------------
    // Play Movie
    //-------------------------------------------------------------------------------------------
    {
      LogMyFilms.Debug("Launch_Movie() select_item = '" + select_item + "' - GetID = '" + GetID + "' - m_SearchAnimation = '" + m_SearchAnimation + "', playeroption = '" + Enum.GetName(typeof(PlayerOption), playeroption) + "'");
      //enableNativeAutoplay(); // in case, other plugin disabled it - removed, as we now do start external player ourselves ...

      #region Version Select Dialog
      string filestorage = MyFilms.r[select_item][MyFilms.conf.StrStorage].ToString();
      if (Helper.FieldIsSet(MyFilms.conf.StrStorage))
      {
        Regex filmver = new Regex(@"\[\[([^\#]*)##([^\]]*)\]\]");
        MatchCollection filmverMatches = filmver.Matches(filestorage);
        if (filmverMatches.Count > 0)
        {
          GUIDialogMenu versionmenu =
            (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
          versionmenu.Reset();
          versionmenu.SetHeading("Select Version");
          List<string> filestr = new List<string>();
          for (int i = 0; i < filmverMatches.Count; i++)
          {
            versionmenu.Add(filmverMatches[i].Groups[2].Value);
            filestr.Add(filmverMatches[i].Groups[1].Value);
          }
          versionmenu.DoModal(GetID);
          if (versionmenu.SelectedLabel == -1) return;
          filestorage = filestr[versionmenu.SelectedLabel];
        }
      }

      #endregion

      #region handle WOL
      // Guzzi: Added WOL to start remote host before playing the files
      // Wake up the TV server, if required
      // HandleWakeUpNas();
      // LogMyFilms.Info("Launched HandleWakeUpNas() to start movie'" + MyFilms.r[select_item][MyFilms.conf.StrSTitle.ToString()] + "'");

      if (MyFilms.conf.StrCheckWOLenable)
      {
        WakeOnLanManager wakeOnLanManager = new WakeOnLanManager();
        int wTimeout = MyFilms.conf.StrWOLtimeout;
        bool isActive;
        string UNCpath = filestorage;
        string NasServerName;
        string NasMACAddress;

        if (UNCpath.StartsWith("\\\\")) UNCpath = (UNCpath.Substring(2, UNCpath.Substring(2).IndexOf("\\") + 0)).ToLower();
        if ((UNCpath.Equals(MyFilms.conf.StrNasName1, StringComparison.InvariantCultureIgnoreCase)) ||
            (UNCpath.Equals(MyFilms.conf.StrNasName2, StringComparison.InvariantCultureIgnoreCase)) ||
            (UNCpath.Equals(MyFilms.conf.StrNasName3, StringComparison.InvariantCultureIgnoreCase)))
        {
          isActive = WakeOnLanManager.Ping(UNCpath, wTimeout);

          if (!isActive) // Only if NAS server is not yet already rzunning !
          {
            if (MyFilms.conf.StrCheckWOLuserdialog)
            {
              if (!(GUIUtils.ShowYesNoDialog(GUILocalizeStrings.Get(107986), "Film    : '" + MyFilms.r[select_item][MyFilms.conf.StrSTitle.ToString()] + "'" + "\n" + "Server  : '" + UNCpath + "'" + "\n" + "Status  : '" + GUILocalizeStrings.Get(10798742)))) // srv name + " - (offline) - start ?"
                return;
            }

            // Search the NAS where movie is located:
            if ((UNCpath.Equals(MyFilms.conf.StrNasName1, StringComparison.InvariantCultureIgnoreCase)) &&
                (MyFilms.conf.StrNasMAC1.Length > 1))
            {
              NasServerName = MyFilms.conf.StrNasName1;
              NasMACAddress = MyFilms.conf.StrNasMAC1;
            }
            else if ((UNCpath.Equals(MyFilms.conf.StrNasName2, StringComparison.InvariantCultureIgnoreCase)) &&
                     (MyFilms.conf.StrNasMAC2.Length > 1))
            {
              NasServerName = MyFilms.conf.StrNasName2;
              NasMACAddress = MyFilms.conf.StrNasMAC2;
            }
            else if ((UNCpath.Equals(MyFilms.conf.StrNasName3, StringComparison.InvariantCultureIgnoreCase)) &&
                     (MyFilms.conf.StrNasMAC3.Length > 1))
            {
              NasServerName = MyFilms.conf.StrNasName3;
              NasMACAddress = MyFilms.conf.StrNasMAC3;
            }
            else
            {
              NasServerName = String.Empty;
              NasMACAddress = String.Empty;
            }

            // Start NAS Server

            bool SuccessFulStart = wakeOnLanManager.WakeupSystem(wakeOnLanManager.GetHwAddrBytes(NasMACAddress), NasServerName, wTimeout);

            if (MyFilms.conf.StrCheckWOLuserdialog)
            {
              if (SuccessFulStart)
                GUIUtils.ShowNotifyDialog("'" + NasServerName + "' " + GUILocalizeStrings.Get(10798743)); //successfully started 
              else
                GUIUtils.ShowOKDialog("'" + NasServerName + "' " + GUILocalizeStrings.Get(10798744)); // could not be started 
            }
          }
        }
        else
        {
          GUIUtils.ShowOKDialog("", ("Server '" + UNCpath + "' " + GUILocalizeStrings.Get(10798746)), GUILocalizeStrings.Get(10798747), ""); // Automatic NAS start not possible ... 
          return;
        }
      }

      #endregion

      SetProcessAnimationStatus(true, m_SearchAnimation);
      #region Run externaly Program before Playing if defined in setup
      if (Helper.FieldIsSet(MyFilms.conf.CmdPar))
        RunProgram(MyFilms.conf.CmdExe, MyFilms.r[MyFilms.conf.StrIndex][MyFilms.conf.CmdPar].ToString());
      #endregion

      if (g_Player.Playing) g_Player.Stop();

      // search all files
      var newItems = new ArrayList();
      bool noResumeMovie = true;
      int movieIndex = 0;

      SearchAllFiles(MyFilms.r[select_item], false, ref noResumeMovie, ref newItems, ref movieIndex, false, filestorage);
      
      //  ToDo: add code to call population of trailers array and insert num of configured trailers into playlist
      // newItems.Insert(0, <trailers>);
      
      if (newItems.Count > 20) // Maximum 20 entries (limitation for MP dialogFileStacking)
      {
        GUIUtils.ShowOKDialog(MyFilms.r[select_item][MyFilms.conf.StrSTitle].ToString(), "maximum 20 entries for the playlist", "", "");
        LogMyFilms.Info("Too many entries found for movie '" + MyFilms.r[select_item][MyFilms.conf.StrSTitle] + "', number of entries found = " + newItems.Count);
        return;
      }
      SetProcessAnimationStatus(false, m_SearchAnimation);

      #region optional part selection dialog
      if (newItems.Count > 1)
      {
        if (noResumeMovie)
        {
          var dlg = (GUIDialogFileStacking)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_FILESTACKING);
          if (null != dlg)
          {
            dlg.SetNumberOfFiles(newItems.Count);
            dlg.DoModal(GUIWindowManager.ActiveWindow);
            int selectedFileIndex = dlg.SelectedFile;
            if (selectedFileIndex < 1) return;
            movieIndex = selectedFileIndex++;
          }
        }
      }
      #endregion

      if (newItems.Count > 0)
      {
        // Check, if the content returned is a BR playlist to supress internal player and dialogs
        bool isBRcontent = false;
        string mediapath = filestorage;
        if (newItems[0].ToString().ToLower().EndsWith("bdmv")) isBRcontent = true;
        bool isMpVideo = Utils.IsVideo(newItems[0].ToString());
        LogMyFilms.Info("Launch_Movie() - starting playback: isBRcontent = '" + isBRcontent + "', isMpVideo = '" + isMpVideo + "', #items = '" + newItems.Count + "', first item = '" + newItems[0] + "'), filestorage = '" + filestorage + "'");

        switch (playeroption)
        {
          case PlayerOption.External:
            try
            {
              LogMyFilms.Info("Launch_Movie() - start external player - path = '" + MyFilms.conf.ExternalPlayerPath + "', argument (filestorage) = '" + filestorage + "'");
              LaunchExternalPlayer(filestorage);
            } catch (Exception ex) { LogMyFilms.Info("Launch_Movie() - calling external player ended with exception: " + ex); }
            break;
          case PlayerOption.BluRayPlayerLauncher:
            LogMyFilms.Info("Launch_Movie() - activate blurayplayer plugin");
            GUIWindowManager.ActivateWindow((int)MyFilms.ExternalPluginWindows.BluRayPlayerLauncher);
            break;
          case PlayerOption.Internal:
            bool externalplayerextensiondetected = MyFilms.conf.ExternalPlayerExtensions.Split(new Char[] { ';' }, StringSplitOptions.RemoveEmptyEntries).Any(s => filestorage.ToLower().Contains(s.ToLower()));
            if (externalplayerextensiondetected && MyFilms.conf.ExternalPlayerPath.Length > 0) // check, if this is configured to use external player via extensions in setup
            {
              #region external player playback (myfilms)
              LogMyFilms.Info("Launch_Movie() - extension for external player detected! - start external player - path = '" + MyFilms.conf.ExternalPlayerPath + "', argument (filestorage) = '" + filestorage + "'");
              try
              {
                LaunchExternalPlayer(filestorage);
              } catch (Exception ex) { LogMyFilms.Info("Launch_Movie() - calling external player ended with exception: " + ex); }
              #endregion
            }
            else if (isMpVideo || (isBRcontent && Helper.IsBdHandlerAvailableAndEnabled)) // use internal playback, if suppoerted or BD handler is installed
            {
              #region internal playback
              LogMyFilms.Info("Launch_Movie() - start internal playback");
              playlistPlayer.Reset();
              playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_VIDEO_TEMP;
              PlayList playlist = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO_TEMP);
              playlist.Clear();

              foreach (object t in newItems)
              {
                var movieFileName = (string)t;
                // ToDo: Check, if that is necessary - from MP1.3.x to get e.g. Mediainfo registered AddFileToDatabase(movieFileName);
                var newitem = new PlayListItem();
                newitem.FileName = movieFileName;
                newitem.Type = PlayListItem.PlayListItemType.Video;
                playlist.Add(newitem);
              }
              // ask for start movie Index

              MyFilms.conf.MyFilmsPlaybackActive = true; // Set Playbackhandler to active
              PlayMovieFromPlayList(noResumeMovie, movieIndex - 1); // play movie...
              #endregion
            }
            else if (isBRcontent && Helper.IsBluRayPlayerLauncherAvailableAndEnabled) // use BRplayerLauncher fir BR content, if installed
            {
              #region  BluRayPlayerLauncher playback
              LogMyFilms.Info("Launch_Movie() - activate blurayplayer plugin");
              GUIWindowManager.ActivateWindow((int)MyFilms.ExternalPluginWindows.BluRayPlayerLauncher);
              #endregion
            }
            else // playback not successful - notify user!
            {
              #region no playback option successful - notify user
              LogMyFilms.Info("Launch_Movie() - Internal Playback not successful - playback not started!");
              GUIUtils.ShowOKDialog("No playback possible, please check your setup. \nInstall BR Player Launcher, BDhandler or external player for unsupported media.");
              #endregion
            }
            break;
        }
      }
      else
      {
        //if (first)
        //// ask for mounting file first time
        //{
        var dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO);
        dlgYesNo.SetHeading(GUILocalizeStrings.Get(107986)); //my films
        dlgYesNo.SetLine(1, GUILocalizeStrings.Get(219)); //no disc
        if (Helper.FieldIsSet(MyFilms.conf.StrIdentItem))
          if (MyFilms.conf.StrIdentLabel.Length > 0)
            dlgYesNo.SetLine(2, MyFilms.conf.StrIdentLabel + " = " + MyFilms.r[select_item][MyFilms.conf.StrIdentItem]); //Label Identification for Media
          else
            dlgYesNo.SetLine(2, "'" + MyFilms.conf.StrIdentItem + "' = " + MyFilms.r[select_item][MyFilms.conf.StrIdentItem]); //ANT Item Identification for Media
        else
          dlgYesNo.SetLine(2, "' disc n° = " + MyFilms.r[select_item]["Number"]); //ANT Number for Identification Media 
        dlgYesNo.DoModal(GetID);
        if (dlgYesNo.IsConfirmed) 
          Launch_Movie(select_item, GetID, m_SearchAnimation, playeroption);
        //}
        else
        {
          GUIUtils.ShowOKDialog("", GUILocalizeStrings.Get(1036), MyFilms.r[select_item][MyFilms.conf.StrSTitle].ToString(), ""); //no video found
          LogMyFilms.Info("File not found for movie '" + MyFilms.r[select_item][MyFilms.conf.StrSTitle] + "'");
        }
      }
    }
示例#26
0
    //-------------------------------------------------------------------------------------------
    //  Dowload backdrops on theMovieDB.org
    //-------------------------------------------------------------------------------------------        
    public static void Download_Backdrops_Fanart(string wtitle, string wttitle, string wftitle, string director, string imdbid, string year, bool choose, int wGetID, string savetitle, string personartworkpath, bool loadFanart, bool loadPersonImages, GUIAnimation searchanimation)
    {
      new Thread(delegate()
      {
        var grab = new Grabber_URLClass();
        int wyear = 0;
        try { wyear = Convert.ToInt32(year); }
        catch { }
        try
        {
          SetProcessAnimationStatus(true, searchanimation);  // GUIWaitCursor.Init(); GUIWaitCursor.Show();
          List<DbMovieInfo> listemovies = grab.GetFanart(
            wtitle,
            savetitle,
            wyear,
            director,
            imdbid,
            MyFilms.conf.StrPathFanart,
            true,
            choose,
            MyFilms.conf.StrTitle1,
            personartworkpath);
          SetProcessAnimationStatus(false, searchanimation);  //GUIWaitCursor.Hide();
          //System.Collections.Generic.List<grabber.DBMovieInfo> listemovies = Grab.GetFanart(wtitle, wttitle, wyear, director, MyFilms.conf.StrPathFanart, true, choose);
          LogMyFilms.Debug("(DownloadBackdrops) - listemovies: '" + wtitle + "', '" + wttitle + "', '" + wyear + "', '" + director + "', '" + MyFilms.conf.StrPathFanart + "', 'true', '" + choose.ToString() + "', '" + MyFilms.conf.StrTitle1 + "'");
          int listCount = listemovies.Count;
          LogMyFilms.Debug("(DownloadBackdrops) - listemovies: Result Listcount: '" + listCount.ToString() + "'");

          if (choose) listCount = 2;
          switch (listCount)
          {
            case 0:
              break;
            case 1:
              LogMyFilms.Debug("Fanart " + listemovies[0].Name.Substring(listemovies[0].Name.LastIndexOf("\\") + 1) + " downloaded for " + wttitle);
              if (listemovies[0].Persons.Count > 0)
              {
                LogMyFilms.Debug("PersonArtwork: " + listemovies[0].Persons.Count.ToString() + " Persons checked for " + wttitle);
                foreach (DbPersonInfo person in listemovies[0].Persons)
                {
                  LogMyFilms.Debug("PersonArtwork: " + person.Images.Count.ToString() + " images found for " + person.Name);
                }
              }
              break;
            default:

              var wotitle_tableau = new ArrayList();
              var wttitle_tableau = new ArrayList();
              var wotitle_sub_tableau = new ArrayList();
              var wttitle_sub_tableau = new ArrayList();
              const int MinChars = 2;
              bool Filter = true;

              var dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
              if (dlg == null) return;
              dlg.Reset();
              dlg.SetHeading(loadFanart ? GUILocalizeStrings.Get(1079862) : GUILocalizeStrings.Get(1079900));  // Load fanart (online)  // Download person images (selected film)
              dlg.Add("  *****  " + GUILocalizeStrings.Get(1079860) + "  *****  "); //manual selection
              foreach (DbMovieInfo t in listemovies)
              {
                string dialoginfoline = t.Name + "  (" + t.Year + ")";
                if (loadFanart) dialoginfoline += " - Fanarts: " + t.Backdrops.Count;
                if (loadPersonImages) dialoginfoline += " - Persons: " + t.Persons.Count.ToString();
                dlg.Add(dialoginfoline);
                LogMyFilms.Debug("TMDB listemovies: " + t.Name + "  (" + t.Year + ") - Fanarts: " + t.Backdrops.Count + " - TMDB-Id: " + t.Identifier + " - Persons: " + t.Persons.Count.ToString());
              }
              if (!(dlg.SelectedLabel > -1))
              {
                dlg.SelectedLabel = -1;
                dlg.DoModal(wGetID);
              }
              if (dlg.SelectedLabel == 0)
              {
                #region Get SubTitles and Subwords from otitle and ttitle

                wotitle_tableau = MyFilms.SubTitleGrabbing(wtitle);
                wttitle_tableau = MyFilms.SubTitleGrabbing(wttitle);
                wotitle_sub_tableau = MyFilms.SubWordGrabbing(wtitle, MinChars, Filter);
                // Min 3 Chars, Filter true (no der die das)
                wttitle_sub_tableau = MyFilms.SubWordGrabbing(wttitle, MinChars, Filter);
                // Min 3 Chars, Filter true (no der die das)
                //First Show Dialog to choose Otitle, Ttitle or substrings - or Keyboard to manually enter searchstring!!!
                var dlgSearchFilm = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                if (dlgSearchFilm == null) return;
                dlgSearchFilm.Reset();
                dlgSearchFilm.SetHeading(GUILocalizeStrings.Get(1079859)); // choose search expression
                dlgSearchFilm.Add("  *****  " + GUILocalizeStrings.Get(1079858) + "  *****  ");
                //manual selection with keyboard
                //dlgs.Add(wtitle); //Otitle
                dlgSearchFilm.Add(savetitle); //Otitle = savetitle
                dlgSearchFilm.Add(wttitle); //Ttitle
                foreach (object t in from object t in wotitle_tableau where t.ToString().Length > 1 select t)
                {
                  dlgSearchFilm.Add(t.ToString());
                }
                foreach (object t in from object t in wttitle_tableau where t.ToString().Length > 1 select t)
                {
                  dlgSearchFilm.Add(t.ToString());
                }
                foreach (object t in from object t in wotitle_sub_tableau where t.ToString().Length > 1 select t)
                {
                  dlgSearchFilm.Add(t.ToString());
                }
                foreach (object t in from object t in wttitle_sub_tableau where t.ToString().Length > 1 select t)
                {
                  dlgSearchFilm.Add(t.ToString());
                }
                //Now all titles and Substrings listed in dialog !
                //dlgs.Add("  *****  " + GUILocalizeStrings.Get(1079860) + "  *****  "); //manual selection
                if (!(dlgSearchFilm.SelectedLabel > -1))
                {
                  dlgSearchFilm.SelectedLabel = -1;
                  dlgSearchFilm.DoModal(wGetID);
                }
                if (dlgSearchFilm.SelectedLabel == 0) // enter manual searchstring via VK
                {
                  var keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
                  if (null == keyboard) return;
                  keyboard.Reset();
                  keyboard.SetLabelAsInitialText(false); // set to false, otherwise our intial text is cleared
                  keyboard.Text = wtitle;
                  keyboard.DoModal(wGetID);
                  if ((keyboard.IsConfirmed) && (keyboard.Text.Length > 0))
                  {
                    //Remove_Backdrops_Fanart(wtitle, true);
                    //Remove_Backdrops_Fanart(wttitle, true);
                    //Remove_Backdrops_Fanart(wftitle, true);
                    Download_Backdrops_Fanart(
                      keyboard.Text,
                      string.Empty,
                      string.Empty,
                      string.Empty,
                      string.Empty,
                      string.Empty,
                      true,
                      wGetID,
                      savetitle,
                      personartworkpath,
                      loadFanart,
                      loadPersonImages,
                      searchanimation);
                  }
                  break;
                }
                if (dlgSearchFilm.SelectedLabel > 0 && dlgSearchFilm.SelectedLabel < 3) // if one of otitle or ttitle selected, keep year and director
                {
                  Download_Backdrops_Fanart(
                    dlgSearchFilm.SelectedLabelText,
                    wttitle,
                    wftitle,
                    year,
                    director,
                    string.Empty,
                    true,
                    wGetID,
                    savetitle,
                    personartworkpath,
                    loadFanart,
                    loadPersonImages,
                    searchanimation);
                  //Download_Backdrops_Fanart(string wtitle, string wttitle, string director, string year, bool choose,int wGetID, string savetitle)
                  break;
                }
                if (dlgSearchFilm.SelectedLabel > 2) // For subitems, search without year and director !
                {
                  Download_Backdrops_Fanart(
                    dlgSearchFilm.SelectedLabelText,
                    wttitle,
                    wftitle,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    true,
                    wGetID,
                    savetitle,
                    personartworkpath,
                    loadFanart,
                    loadPersonImages,
                    searchanimation);
                  //Download_Backdrops_Fanart(string wtitle, string wttitle, string director, string year, bool choose,int wGetID, string savetitle)
                  break;
                }

                #endregion
              }
              if (dlg.SelectedLabel > 0)
              {
                // Load Fanart  -> show progress dialog !

                var dlgPrgrs = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS);
                if (dlgPrgrs != null)
                {
                  dlgPrgrs.Reset();
                  dlgPrgrs.DisplayProgressBar = true;
                  dlgPrgrs.ShowWaitCursor = false;
                  dlgPrgrs.DisableCancel(true);
                  dlgPrgrs.SetHeading("MyFilms Artwork Download");
                  dlgPrgrs.StartModal(GUIWindowManager.ActiveWindow);
                  dlgPrgrs.SetLine(1, "Loading Artwork ...");
                  dlgPrgrs.Percentage = 0;

                  #region load fanarts ...
                  bool first = true;
                  string filename = string.Empty;
                  string filename1 = string.Empty;
                  //if (MyFilms.conf.StrTitle1 == "OriginalTitle")
                  //  wttitle = savetitle; // Was wttitle = wtitle;
                  int i = 0;
                  if (loadFanart) // Download Fanart
                  {
                    if (dlgPrgrs != null) dlgPrgrs.SetLine(1, "Loading Fanart for '" + savetitle + "'");

                    foreach (string backdrop in listemovies[dlg.SelectedLabel - 1].Backdrops)
                    {
                      filename1 = Grabber.GrabUtil.DownloadBacdropArt(MyFilms.conf.StrPathFanart, backdrop, savetitle, true, first, out filename);
                      if (dlgPrgrs != null) dlgPrgrs.SetLine(2, "loading '" + System.IO.Path.GetFileName(filename) + "'");
                      if (dlgPrgrs != null) dlgPrgrs.Percentage = i * 100 / listemovies[dlg.SelectedLabel - 1].Backdrops.Count;
                      LogMyFilms.Debug("Fanart " + filename1.Substring(filename1.LastIndexOf("\\") + 1) + " downloaded for " + savetitle);

                      if (filename == string.Empty) filename = filename1;
                      if (!(filename == "already" && filename1 == "already")) filename = "added";
                      first = false;
                      i++;
                    }
                  }
                  #endregion

                  listemovies[0].Name = filename;

                  if (loadPersonImages) // Download PersonArtwork
                  {
                    string filenameperson = string.Empty;
                    string filename1person = string.Empty;
                    string filename2person = string.Empty;
                    LogMyFilms.Debug(
                      "Person Artwork - " + listemovies[0].Persons.Count + " persons found - now loading artwork");
                    if (!string.IsNullOrEmpty(personartworkpath) && listemovies[0].Persons != null &&
                        listemovies[0].Persons.Count > 0)
                    {
                      if (dlgPrgrs != null) dlgPrgrs.SetLine(1, "Loading person images for '" + wttitle + "'");
                      if (dlgPrgrs != null) dlgPrgrs.SetLine(2, "");

                      foreach (Grabber.DbPersonInfo person in listemovies[0].Persons)
                      {
                        bool firstpersonimage = true;
                        bool onlysinglepersonimage = true;
                        var persondetails = new DbPersonInfo();
                        var theMoviedb = new TheMoviedb();
                        persondetails = theMoviedb.GetPersonsById(person.Id, string.Empty);
                        LogMyFilms.Debug("Person Artwork: found '" + persondetails.Images.Count + "' TMDB images for '" + persondetails.Name + "' in movie '" + savetitle + "'");
                        if (dlgPrgrs != null) dlgPrgrs.SetLine(2, "loading '" + persondetails.Name + "'");
                        if (dlgPrgrs != null) dlgPrgrs.Percentage = 0;

                        if (persondetails.Images.Count > 0)
                        {
                          i = 0;
                          foreach (var image in persondetails.Images)
                          {
                            filename1person = Grabber.GrabUtil.DownloadPersonArtwork(personartworkpath, image, persondetails.Name, true, firstpersonimage, out filenameperson);
                            if (dlgPrgrs != null) dlgPrgrs.SetLine(2, "loading '" + persondetails.Name + "' (TMDB - #" + i + ")");
                            if (dlgPrgrs != null) dlgPrgrs.Percentage = i * 100 / persondetails.Images.Count;

                            LogMyFilms.Debug("Person Artwork " + filename1person.Substring(filename1person.LastIndexOf("\\") + 1) + " downloaded for '" + persondetails.Name + "' in movie '" + savetitle + "', path='" + filename1person + "'");
                            if (filenameperson == string.Empty) filenameperson = filename1person;
                            if (!(filenameperson == "already" && filename1person == "already")) filenameperson = "added";
                            firstpersonimage = false;
                            i++;
                            if (onlysinglepersonimage) break;
                          }
                        }
                      }
                    }
                    else if (string.IsNullOrEmpty(personartworkpath)) LogMyFilms.Debug("No Personartwork loaded - Personartworkpath is not set in setup!");
                  }
                  if (dlgPrgrs != null) dlgPrgrs.Percentage = 100;
                  dlgPrgrs.ShowWaitCursor = false;
                  dlgPrgrs.SetLine(1, GUILocalizeStrings.Get(1079846));
                  dlgPrgrs.SetLine(2, "");
                  Thread.Sleep(50);
                  dlgPrgrs.Close(); // Done...
                  return;
                }
              }
              break;
          }
        }
        catch (Exception ex)
        {
          LogMyFilms.DebugException("Thread 'MyFilmsTMDBLoader' - exception! - ", ex);
        }
        GUIWindowManager.SendThreadCallbackAndWait((p1, p2, data) =>
        {
          //dlgPrgrs.ShowWaitCursor = false;
          // enter here what to load after background thread has finished !
          if (DetailsUpdated != null) DetailsUpdated(true);
          return 0;
        }, 0, 0, null);
      }) { Name = "MyFilmsTMDBLoader", IsBackground = true }.Start();
    }
示例#27
0
    //-------------------------------------------------------------------------------------------
    //  Dowload TMDBinfos (Poster(s), Movieinfos) on theMovieDB.org
    //-------------------------------------------------------------------------------------------        
    public static void Download_TMDB_Posters(string wtitle, string wttitle, string director, string year, bool choose, int wGetID, string savetitle, GUIAnimation searchanimation)
    {
      string oldPicture = MyFilmsDetail.getGUIProperty("picture");
      string newPicture = ""; // full path to new picture
      string newPictureCatalogname = ""; // entry to be stored in catalog
      if (string.IsNullOrEmpty(oldPicture)) 
        oldPicture = "";

      if (!Directory.Exists(MyFilms.conf.StrPathImg + "\\" + MyFilms.conf.StrPicturePrefix))
        try
        {
          Directory.CreateDirectory(MyFilms.conf.StrPathImg + "\\" + MyFilms.conf.StrPicturePrefix);
        }
        catch (Exception) { }
      var grab = new Grabber_URLClass();
      string language = CultureInfo.CurrentCulture.Name.Substring(0, 2);
      int wyear = 0;
      try { wyear = Convert.ToInt32(year); }
      catch { }
      new Thread(delegate()
        {
          try
          {
            SetProcessAnimationStatus(true, searchanimation); // GUIWaitCursor.Init(); GUIWaitCursor.Show();
            List<DbMovieInfo> listemovies = grab.GetTMDBinfos(wtitle, wttitle, wyear, director, MyFilms.conf.StrPathImg + "\\" + MyFilms.conf.StrPicturePrefix, true, choose, MyFilms.conf.StrTitle1, language);
            SetProcessAnimationStatus(false, searchanimation); // GUIWaitCursor.Hide();
            LogMyFilms.Debug("(TMDB-Infos) - listemovies: '" + wtitle + "', '" + wttitle + "', '" + wyear + "', '" + director + "', '" + MyFilms.conf.StrPathImg + "\\" + MyFilms.conf.StrPicturePrefix + "', 'true', '" + choose.ToString() + "', '" + MyFilms.conf.StrTitle1 + "', '" + language + "'");
            int listCount = listemovies.Count;
            LogMyFilms.Debug("(TMDB-Infos) - listemovies: Result Listcount: '" + listCount + "'");

            if (choose)
              listCount = 2;
            switch (listCount)
            {
              case 0:
                break;
              case 1:
                LogMyFilms.Info("Posters " + listemovies[0].Name.Substring(listemovies[0].Name.LastIndexOf("\\") + 1) + " downloaded for " + wttitle);
                break;
              default:

                var wotitle_tableau = new ArrayList();
                var wttitle_tableau = new ArrayList();
                var wotitle_sub_tableau = new ArrayList();
                var wttitle_sub_tableau = new ArrayList();
                const int MinChars = 2;
                bool Filter = true;

                var dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                if (dlg == null) return;
                dlg.Reset();
                dlg.SetHeading(GUILocalizeStrings.Get(1079857)); // Load TMDB data (online)
                dlg.Add("  *****  " + GUILocalizeStrings.Get(1079860) + "  *****  "); //manual selection
                foreach (DbMovieInfo t in listemovies)
                {
                  dlg.Add(t.Name + "  (" + t.Year + ") - Posters: " + t.Posters.Count + " - Id" + t.Identifier);
                  LogMyFilms.Debug("TMDB listemovies: " + t.Name + "  (" + t.Year + ") - Posters: " + t.Posters.Count + " - TMDB-Id: " + t.Identifier);
                }
                if (!(dlg.SelectedLabel > -1))
                {
                  dlg.SelectedLabel = -1;
                  dlg.DoModal(wGetID);
                }
                if (dlg.SelectedLabel == 0)
                {
                  #region Get SubTitles and Subwords from otitle and ttitle
                  wotitle_tableau = MyFilms.SubTitleGrabbing(wtitle);
                  wttitle_tableau = MyFilms.SubTitleGrabbing(wttitle);
                  wotitle_sub_tableau = MyFilms.SubWordGrabbing(wtitle, MinChars, Filter); // Min 3 Chars, Filter true (no der die das)
                  wttitle_sub_tableau = MyFilms.SubWordGrabbing(wttitle, MinChars, Filter); // Min 3 Chars, Filter true (no der die das)
                  //First Show Dialog to choose Otitle, Ttitle or substrings - or Keyboard to manually enter searchstring!!!
                  var dlgs = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                  if (dlgs == null) return;
                  dlgs.Reset();
                  dlgs.SetHeading(GUILocalizeStrings.Get(1079859)); // choose search expression
                  dlgs.Add("  *****  " + GUILocalizeStrings.Get(1079858) + "  *****  "); //manual selection with keyboard
                  //dlgs.Add(wtitle); //Otitle
                  dlgs.Add(savetitle); //Otitle = savetitle
                  dlgs.Add(wttitle); //Ttitle
                  foreach (object t in from object t in wotitle_tableau where t.ToString().Length > 1 select t)
                  {
                    dlgs.Add(t.ToString());
                  }
                  foreach (object t in from object t in wttitle_tableau where t.ToString().Length > 1 select t)
                  {
                    dlgs.Add(t.ToString());
                  }
                  foreach (object t in from object t in wotitle_sub_tableau where t.ToString().Length > 1 select t)
                  {
                    dlgs.Add(t.ToString());
                  }
                  foreach (object t in from object t in wttitle_sub_tableau where t.ToString().Length > 1 select t)
                  {
                    dlgs.Add(t.ToString());
                  }
                  //Now all titles and Substrings listed in dialog !
                  //dlgs.Add("  *****  " + GUILocalizeStrings.Get(1079860) + "  *****  "); //manual selection
                  if (!(dlgs.SelectedLabel > -1))
                  {
                    dlgs.SelectedLabel = -1;
                    dlgs.DoModal(wGetID);
                  }
                  if (dlgs.SelectedLabel == 0)
                  {
                    var keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
                    if (null == keyboard) return;
                    keyboard.Reset();
                    keyboard.SetLabelAsInitialText(false); // set to false, otherwise our intial text is cleared
                    keyboard.Text = wtitle;
                    keyboard.DoModal(wGetID);
                    if ((keyboard.IsConfirmed) && (keyboard.Text.Length > 0))
                    {
                      Download_TMDB_Posters(keyboard.Text, wttitle, string.Empty, string.Empty, true, wGetID, savetitle, searchanimation);
                    }
                    break;
                  }
                  if (dlgs.SelectedLabel > 0 && dlgs.SelectedLabel < 3) // if one of otitle or ttitle selected, keep year and director
                  {
                    Download_TMDB_Posters(dlgs.SelectedLabelText, wttitle, year, director, true, wGetID, savetitle, searchanimation);
                    //Download_TMDB_Posters(string wtitle, string wttitle, string director, string year, bool choose,int wGetID, string savetitle)
                    break;
                  }
                  if (dlgs.SelectedLabel > 2) // For subitems, search without year and director !
                  {
                    Download_TMDB_Posters(dlgs.SelectedLabelText, wttitle, string.Empty, string.Empty, true, wGetID, savetitle, searchanimation);
                    //Download_TMDB_Posters(string wtitle, string wttitle, string director, string year, bool choose,int wGetID, string savetitle)
                    break;
                  }
                  #endregion
                }
                if (dlg.SelectedLabel > 0)
                {
                  // Load Posters  -> show progress dialog !

                  var dlgPrgrs = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS);
                  if (dlgPrgrs != null)
                  {
                    dlgPrgrs.Reset();
                    dlgPrgrs.DisplayProgressBar = true;
                    dlgPrgrs.ShowWaitCursor = false;
                    dlgPrgrs.DisableCancel(true);
                    dlgPrgrs.SetHeading("MyFilms Artwork Download");
                    dlgPrgrs.StartModal(GUIWindowManager.ActiveWindow);
                    dlgPrgrs.SetLine(1, "Loading Artwork ...");
                    dlgPrgrs.Percentage = 0;

                    bool first = true;
                    string filename = string.Empty;
                    string filename1 = string.Empty;
                    if (MyFilms.conf.StrTitle1 == "OriginalTitle")
                      wttitle = savetitle; // Was wttitle = wtitle;
                    int i = 0;
                    if (dlgPrgrs != null) dlgPrgrs.SetLine(1, "Loading Poster for '" + savetitle + "'");
                    foreach (string poster in listemovies[dlg.SelectedLabel - 1].Posters)
                    {
                      filename1 = Grabber.GrabUtil.DownloadCovers(MyFilms.conf.StrPathImg + "\\" + MyFilms.conf.StrPicturePrefix, poster, wttitle, true, first, out filename);
                      if (dlgPrgrs != null) dlgPrgrs.SetLine(2, "loading '" + System.IO.Path.GetFileName(filename) + "'");
                      if (dlgPrgrs != null) dlgPrgrs.Percentage = i * 100 / listemovies[dlg.SelectedLabel - 1].Posters.Count;
                      LogMyFilms.Info("Poster " + filename1.Substring(filename1.LastIndexOf("\\") + 1) + " downloaded for " + wttitle);
                      if (first)
                        newPicture = filename1;
                      if (filename == string.Empty)
                        filename = filename1;
                      if (!(filename == "already" && filename1 == "already"))
                        filename = "added";
                      first = false;
                      i++;
                    }
                    foreach (string person in listemovies[dlg.SelectedLabel - 1].Actors)
                    {
                      // ToDo: Load Actorinfodetails (API Call to be written in grabber) and download Person Artwork
                    }
                    listemovies[0].Name = filename;

                    newPictureCatalogname = GetPictureCatalogNameFromFilename(newPicture);

                    if (wGetID != MyFilms.ID_MyFilmsCoverManager)
                    {
                      if (!choose)
                      {
                        MyFilms.r[MyFilms.conf.StrIndex]["Picture"] = newPictureCatalogname;
                        Update_XML_database();
                        LogMyFilms.Info("(Update_XML_database()) - Database Updated for created Coverthumb: " + newPicture);
                      }
                      else
                      {
                        //TMDB_Details_Select();
                        setGUIProperty("picture", newPicture);
                        GUIWindowManager.Process(); // To Update GUI display ...

                        var dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO);
                        dlgYesNo.SetHeading(GUILocalizeStrings.Get(1079870)); // choice
                        dlgYesNo.SetLine(1, "");
                        dlgYesNo.SetLine(2, GUILocalizeStrings.Get(10798733)); // Replace cover with new one
                        dlgYesNo.SetLine(3, "");
                        dlgYesNo.DoModal(wGetID);
                        if (!(dlgYesNo.IsConfirmed))
                        {
                          setGUIProperty("picture", oldPicture);
                          GUIWindowManager.Process();
                          return;
                        }
                        MyFilms.r[MyFilms.conf.StrIndex]["Picture"] = newPictureCatalogname;
                        Update_XML_database();
                        LogMyFilms.Info("(Update_XML_database()) - Database Updated with '" + newPictureCatalogname + "' for created Coverthumb '" + newPicture + "'");
                      }
                    }
                  }
                  if (dlgPrgrs != null) dlgPrgrs.Percentage = 100; dlgPrgrs.ShowWaitCursor = false; dlgPrgrs.SetLine(1, GUILocalizeStrings.Get(1079846)); dlgPrgrs.SetLine(2, ""); Thread.Sleep(50); dlgPrgrs.Close(); // Done...
                  // return;
                }
                break;
            }
          }
          catch (Exception ex)
          {
            LogMyFilms.DebugException("Thread 'MyFilmsTMDBLoader' - exception! - ", ex);
          }
          GUIWindowManager.SendThreadCallbackAndWait((p1, p2, data) =>
            {
              if (DetailsUpdated != null) DetailsUpdated(true);
              return 0;
            }, 0, 0, null);
        }) { Name = "MyFilmsTMDBLoader", IsBackground = true }.Start();
    }
示例#28
0
        /// <summary>
        /// This method should be used to call methods in GUI that might take a few seconds.
        /// The Wait Cursor will be shown while executing the task and the result handler will be called on MediaPortal's Main thread.
        /// </summary>
        /// <param name="task">method to invoke on a background thread</param>
        /// <param name="resultHandler">method to invoke on the GUI Thread with the result of the task</param>
        /// <param name="taskDescription">description of the task to be invoked - will be shown in the error message if execution fails or times out</param>
        /// <param name="timeout">true: use the timeout, or false: wait forever</param>
        /// <param name="searchanimation">Animation as waiting symbol</param>
        /// <returns>true, if the task could be successfully started in the background</returns>
        internal bool ExecuteInBackgroundAndCallback(Func<object> task, Action<bool, object> resultHandler, string taskDescription, bool timeout, GUIAnimation searchanimation)
        {
            // make sure only one background task can be executed at a time
              if (!IsBusy && Monitor.TryEnter(this))
              {
            try
            {
              IsBusy = true;
              abortedByUser = false;
              _CurrentResultHandler = resultHandler;
              _CurrentTaskDescription = taskDescription;
              _CurrentResult = null;
              _CurrentError = null;

              // while this is null the task has not finished (or later on timeout),
              // true indicates successfull completion and false error
              _CurrentTaskSuccess = null;

              // init and show the wait cursor in MediaPortal
              // GUIWaitCursor.Init(); GUIWaitCursor.Show();
              MyFilmsDetail.SetProcessAnimationStatus(true, searchanimation);

              backgroundThread = new Thread(delegate()
              {
            try
            {
              _CurrentResult = task.Invoke();
              _CurrentTaskSuccess = true;
            }
            catch (ThreadAbortException)
            {
              if (!abortedByUser)
                LogMyFilms.Info("Timeout waiting for results.");

              Thread.ResetAbort();
            }
            catch (Exception threadException)
            {
              _CurrentError = threadException;
              LogMyFilms.Info(threadException.ToString());
              _CurrentTaskSuccess = false;
            }
            timeoutTimer.Stop();

            // hide the wait cursor
            // GUIWaitCursor.Hide();
            MyFilmsDetail.SetProcessAnimationStatus(false, searchanimation);

            // execute the ResultHandler on the Main Thread
            GUIWindowManager.SendThreadCallbackAndWait((p1, p2, o) =>
            {
              ExecuteTaskResultHandler();
              return 0;
            }, 0, 0, null);
              })
              {
            Name = "MyFilmsGUIBackgroundTask",
            IsBackground = true
              };

              // disable timeout when debugging
              if (timeout && !System.Diagnostics.Debugger.IsAttached)
            timeoutTimer.Start();

              // start background task
              backgroundThread.Start();

              // successfully started the background task
              return true;
            }
            catch (Exception ex)
            {
              LogMyFilms.Error(ex.Message);
              IsBusy = false;
              _CurrentResultHandler = null;

              // hide the wait cursor
              // GUIWaitCursor.Hide();
              MyFilmsDetail.SetProcessAnimationStatus(false, searchanimation);

              // could not start the background task
              return false;
            }
              }
              else
              {
            LogMyFilms.Info("Another thread tried to execute a task in background.");
            return false;
              }
        }
示例#29
0
    //-------------------------------------------------------------------------------------------
    //  Grab URL Internet Movie Informations and update the XML database and refresh screen
    //  -> Selection of grabber script
    //-------------------------------------------------------------------------------------------        
    public static void grabb_Internet_Informations(string fullMovieName, int GetID, bool choosescript, string wscript, string fullMoviePath, GrabType grabtype, bool showAll, Searchtitles sTitles, GUIAnimation searchanimation)
    {
      LogMyFilms.Debug("(grabb_Internet_Informations) with grabtype = '" + grabtype + "', title = '" + fullMovieName + "', choosescript = '" + choosescript + "', grabberfile = '" + wscript + "'");
      if (choosescript)
      {
        if (!Directory.Exists(MyFilmsSettings.GetPath(MyFilmsSettings.Path.GrabberScripts)))
        {
          GUIUtils.ShowOKDialog(string.Format(GUILocalizeStrings.Get(1079876), MyFilmsSettings.GetPath(MyFilmsSettings.Path.GrabberScripts)), GUILocalizeStrings.Get(1079877), "", "");
          LogMyFilms.Info("My Films : The Directory grabber config files doesn't exists. Verify your Configuration !");
          return;
        }

        if (!Directory.Exists(MyFilmsSettings.GetPath(MyFilmsSettings.Path.GrabberScripts) + @"\user"))
        {
          try { Directory.CreateDirectory(MyFilmsSettings.GetPath(MyFilmsSettings.Path.GrabberScripts) + @"\user"); }
          catch (Exception ex) { LogMyFilms.Debug("Error creating user script directory: '" + ex.Message + "'"); }
        }

        // Grabber Directory filled, search for XML scripts files
        var dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
        dlg.Reset();
        dlg.SetHeading(GUILocalizeStrings.Get(10798706)); // "Choose internet grabber script"
        if (dlg == null) return;
        var scriptfile = new ArrayList();

        if (MyFilms.conf.StrGrabber_cnf.Length > 0 && (grabtype == GrabType.Details || grabtype == GrabType.All))
        {
          try
          {
            var defaultScript = new GrabberScript(MyFilms.conf.StrGrabber_cnf);
            defaultScript.Load(MyFilms.conf.StrGrabber_cnf);
            scriptfile.Add(MyFilms.conf.StrGrabber_cnf);
            dlg.Add(MyFilms.conf.StrGrabber_cnf.Substring(MyFilms.conf.StrGrabber_cnf.LastIndexOf("\\", System.StringComparison.Ordinal) + 1) + " (default)");
            dlg.SelectedLabel = 0;
          }
          catch (Exception)
          {
            LogMyFilms.Error("The default script is not compatible with current MyFilms version - please change your settings !");
          }
        }
        var dirsInf = new DirectoryInfo(MyFilmsSettings.GetPath(MyFilmsSettings.Path.GrabberScripts));
        FileSystemInfo[] sfiles = dirsInf.GetFileSystemInfos();

        foreach (FileSystemInfo sfi in sfiles)
        {
          if ((sfi.Extension.ToLower() == ".xml") && (sfi.FullName != MyFilms.conf.StrGrabber_cnf))
          {
            var script = new GrabberScript(sfi.FullName);
            script.Load(sfi.FullName);
            string displayName = "";
            string displayNamePost = "";
            switch (grabtype)
            {
              case GrabType.MultiCovers:
                displayNamePost = script.Type.ToLower().Contains("multicovers") ? " - (Multi Cover)" : " - (Single Cover)";
                break;
            }
            if (ShouldGrabberBeAdded(script, grabtype, showAll))
            {
              if (!string.IsNullOrEmpty(script.DBName))
              {
                displayName += script.DBName;
                if (!string.IsNullOrEmpty(script.Language)) displayName += " (" + script.Language + ")";
                displayName += displayNamePost;
              }
              else displayName += sfi.Name;
              dlg.Add(displayName);
              scriptfile.Add(sfi.FullName);
            }
          }
        }
        // add choice to show all languages
        if (!showAll && !string.IsNullOrEmpty(MyFilms.conf.ItemSearchGrabberScriptsFilter))
          dlg.Add(GUILocalizeStrings.Get(10798765)); // Show all

        if (scriptfile.Count > 0)
        {
          dlg.DoModal(GetID);
          if (dlg.SelectedLabel == -1)
            return;
          if (dlg.SelectedLabelText == GUILocalizeStrings.Get(10798765))
          {
            grabb_Internet_Informations(fullMovieName, GetID, true, wscript, fullMoviePath, grabtype, true, sTitles, searchanimation);
            return;
          }
          if (dlg.SelectedLabel > -1)
            wscript = scriptfile[dlg.SelectedLabel].ToString();
        }
      }
      grabb_Internet_Informations_Search(fullMovieName, GetID, wscript, fullMoviePath, grabtype, sTitles, searchanimation);
    }
示例#30
0
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      if (_topTextureName == null)
      {
        _topTextureName = string.Empty;
      }
      if (_bottomTextureName == null)
      {
        _bottomTextureName = string.Empty;
      }
      if (_leftTextureName == null)
      {
        _leftTextureName = string.Empty;
      }
      if (_midTextureName == null)
      {
        _midTextureName = string.Empty;
      }
      if (_rightTextureName == null)
      {
        _rightTextureName = string.Empty;
      }
      if (_tickTextureName == null)
      {
        _tickTextureName = string.Empty;
      }
      if (_tickFill1TextureName == null)
      {
        _tickFill1TextureName = string.Empty;
      }
      if (_tickFill2TextureName == null)
      {
        _tickFill2TextureName = string.Empty;
      }
      if (_tickFill3TextureName == null)
      {
        _tickFill3TextureName = string.Empty;
      }
      if (_markerTextureName == null)
      {
        _markerTextureName = string.Empty;
      }
      if (_fillBackGroundTextureName == null)
      {
        _fillBackGroundTextureName = string.Empty;
      }
      if (_logoTextureName == null)
      {
        _logoTextureName = string.Empty;
      }
      _imageTop = LoadAnimationControl(_parentControlId, _controlId, 0, 0, 0, 0, _topTextureName);
      _imageBottom = LoadAnimationControl(_parentControlId, _controlId, 0, 0, 0, 0, _bottomTextureName);
      _imageLeft = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0, _leftTextureName);
      _imageMid = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0, _midTextureName);
      _imageRight = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0, _rightTextureName);
      _imageTick = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0, _tickTextureName);
      _imageFill1 = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0,
                                         _tickFill1TextureName);
      _imageFill2 = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0,
                                         _tickFill2TextureName);
      _imageFill3 = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0,
                                         _tickFill3TextureName);
      _imageFillBackground = LoadAnimationControl(_parentControlId, _controlId, 0, 0, 0, 0, _fillBackGroundTextureName);
      _imageTop.KeepAspectRatio = false;
      _imageBottom.KeepAspectRatio = false;
      _imageMid.KeepAspectRatio = false;
      _imageRight.KeepAspectRatio = false;
      _imageTick.KeepAspectRatio = false;
      _imageFill1.KeepAspectRatio = false;
      _imageFill2.KeepAspectRatio = false;
      _imageFill3.KeepAspectRatio = false;
      _imageFillBackground.KeepAspectRatio = false;

      _imageTop.ParentControl = this;
      _imageBottom.ParentControl = this;
      _imageMid.ParentControl = this;
      _imageRight.ParentControl = this;
      _imageTick.ParentControl = this;
      _imageFill1.ParentControl = this;
      _imageFill2.ParentControl = this;
      _imageFill3.ParentControl = this;
      _imageFillBackground.ParentControl = this;
      _imageLogo = LoadAnimationControl(_parentControlId, _controlId, 0, 0, 0, 0, _logoTextureName);
      _imageLogo.ParentControl = this;
      FontName = _fontName;
      
      //create an image for the markers that we will move around and render as needed.
      string strText = GUIPropertyManager.Parse(LabelMarkerStarts);
      if (strText.Length > 0)
      {
        _imageFillMarker = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0,
                                                _markerTextureName);
        _imageFillMarker.KeepAspectRatio = false;
        _imageFillMarker.ParentControl = this;
      }
    }
示例#31
0
    internal static void SetProcessAnimationStatus(bool enable, GUIAnimation guiSearchAnimation)
    {
      try
      {
        if (guiSearchAnimation != null)
        {
          if (enable)
            guiSearchAnimation.AllocResources();
          else
            guiSearchAnimation.Dispose();

          guiSearchAnimation.Visible = enable;
        }
        else
        {
          LogMyFilms.Warn("SetProcessAnimationStatus '" + enable + "' - skin control missing? - falling back to MP GUIWaitCursor()");
          if (enable && !MyFilms.animationStatus)
          {
            MyFilms.animationStatus = true;
            GUIWaitCursor.Init();
            GUIWaitCursor.Show();
          }
          else if (!enable && MyFilms.animationStatus)
          {
            MyFilms.animationStatus = false;
            GUIWaitCursor.Hide();
          }
        }
      }
      catch (Exception ex)
      {
        LogMyFilms.Error("SetProcessAnimationStatus() -  '" + enable + "' - skin control missing? : " + ex.Message);
      }
    }
示例#32
0
    internal static void LoadCollectionImages(DataRow[] r1, int index, bool interactive, GUIAnimation animation)
    {
      if (!File.Exists(GUIGraphicsContext.Skin + @"\MyFilmsDialogImageSelect.xml"))
      {
        if (interactive) GUIUtils.ShowNotifyDialog("Missing Skin File");
        return;
      }
      // var dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
      var dlgMenuOrg = (GUIWindow)GUIWindowManager.GetWindow(2012);
      var dlg = new GUIDialogImageSelect();
      if (dlg == null) return;
      dlg.Init();
      GUIWindowManager.Replace(2009, dlg);

      //var dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
      //var dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO);
      //var dlgPrgrs = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS);

      new Thread(delegate(object o)
      {
        try
        {
          SetProcessAnimationStatus(true, animation);
          #region select and load collection image
          string titlename = Helper.TitleWithoutGroupName(r1[index][MyFilms.conf.StrTitle1].ToString());
          string titlename2 = (Helper.FieldIsSet(MyFilms.conf.StrTitle2)) ? Helper.TitleWithoutGroupName(r1[index][MyFilms.conf.StrTitle2].ToString()) : "";
          string collectionname = Helper.TitleFirstGroupName(r1[index][MyFilms.conf.StrTitle1].ToString());
          string collectionSafeName = GrabUtil.CreateFilename(collectionname);

          string path;
          #region Retrieve original directory of mediafiles
          try
          {
            path = r1[index][MyFilms.conf.StrStorage].ToString();
            if (path.Contains(";")) path = path.Substring(0, path.IndexOf(";", StringComparison.Ordinal));
            //path = Path.GetDirectoryName(path);
            //if (path == null || !Directory.Exists(path))
            //{
            //  LogMyFilms.Warn("Directory of movie '" + titlename + "' doesn't exist anymore - check your DB");
            //  return;
            //}
            if (path.Contains("\\")) path = path.Substring(0, path.LastIndexOf("\\", StringComparison.Ordinal));

            // LogMyFilms.Debug("(SearchAndDownloadTrailerOnlineTMDB) get media directory name: '" + path + "'");
          }
          catch (Exception)
          {
            LogMyFilms.Debug("SearchAndDownloadTrailerOnlineTMDB() error with directory of movie '" + titlename + "' - check your DB");
            return;
          }
          #endregion

          string imdb = "";
          #region get imdb number for better search match
          if (!string.IsNullOrEmpty(r1[index]["IMDB_Id"].ToString()))
            imdb = r1[index]["IMDB_Id"].ToString();
          else if (!string.IsNullOrEmpty(r1[index]["URL"].ToString()))
          {
            string urLstring = r1[index]["URL"].ToString();
            var cutText = new Regex("" + @"tt\d{7}" + "");
            var m = cutText.Match(urLstring);
            if (m.Success) imdb = m.Value;
          }
          #endregion

          int year;

          LogMyFilms.Debug("LoadCollectionImages() - movietitle = '" + titlename + "', collectionname = '" + collectionSafeName + "', collectionSafeName = '" + collectionSafeName + "', interactive = '" + interactive + "'");

          string language = CultureInfo.CurrentCulture.Name.Substring(0, 2);
          var api = new Tmdb(MyFilms.TmdbApiKey, language); // language is optional, default is "en"
          TmdbConfiguration tmdbConf = api.GetConfiguration();
          foreach (string size in tmdbConf.images.poster_sizes) LogMyFilms.Debug("Available TMDB Poster Size: '" + size + "'");
          // foreach (string size in tmdbConf.images.backdrop_sizes) LogMyFilms.Debug("Available TMDB Backdrop Size: '" + size + "'");
          try
          {
            int selectedMovieId = 0;

            #region search matching TMDB movie id
            if (imdb.Contains("tt"))
            {
              TmdbMovie movie = api.GetMovieByIMDB(imdb);
              if (movie.id > 0)
              {
                selectedMovieId = movie.id;
              }
            }

            if (selectedMovieId == 0) // no movie found by tmdb search
            {
              TmdbMovieSearch moviesfound;
              if (int.TryParse(r1[index]["Year"].ToString(), out year))
              {
                moviesfound = api.SearchMovie(titlename, 1, "", null, year);
                if (moviesfound.results.Count == 0) moviesfound = api.SearchMovie(titlename, 1, null);
              }
              else
              {
                moviesfound = api.SearchMovie(r1[index][MyFilms.conf.StrTitle1].ToString(), 1, null);
                if (moviesfound.results.Count == 0 && titlename2.Length > 0)
                {
                  if (int.TryParse(r1[index]["Year"].ToString(), out year))
                  {
                    moviesfound = api.SearchMovie(titlename2, 1, "", null, year);
                    if (moviesfound.results.Count == 0) moviesfound = api.SearchMovie(titlename2, 1, null);
                  }
                }
              }
              SetProcessAnimationStatus(false, animation);

              if (moviesfound.results.Count == 1 && !interactive)
              {
                selectedMovieId = moviesfound.results[0].id;
              }
              else
              {
                LogMyFilms.Debug("LoadCollectionImages() - Movie Search Results: '" + moviesfound.total_results.ToString() + "' for movie '" + titlename + "'");
                if (!interactive) return;
                else
                {
                  if (moviesfound.results.Count == 0)
                  {
                    while (selectedMovieId == 0)
                    {
                      selectedMovieId = SearchTmdbMovie(titlename, titlename, titlename2, year, language, true);
                      if (selectedMovieId == -1) return; // cancel search
                    }
                  }
                  else
                  {
                    var choiceMovies = new List<TmdbMovie>();
                    if (dlg == null) return;
                    dlg.Reset();
                    dlg.SetHeading(GUILocalizeStrings.Get(10798992)); // Select movie ...

                    foreach (TmdbMovie movieResult in moviesfound.results)
                    {
                      dlg.Add(movieResult.title + " (" + movieResult.release_date + ")");
                      choiceMovies.Add(movieResult);
                    }
                    dlg.DoModal(GUIWindowManager.ActiveWindow);
                    if (dlg.SelectedLabel == -1) return;
                    selectedMovieId = choiceMovies[dlg.SelectedLabel].id;
                  }
                }
              }

              // now load the artwork
            }
            #endregion

            if (selectedMovieId == 0)
            {
              LogMyFilms.Debug("SearchAndDownloadTrailerOnlineTMDB - no movie found - no trailers added to DL queue - returning");
              if (interactive) GUIUtils.ShowNotifyDialog(GUILocalizeStrings.Get(10798995)); // No matching movie found !
              return;
            }

            SetProcessAnimationStatus(true, animation);
            #region now load the details and collection images info
            TmdbMovie tmdbMovie = api.GetMovieInfo(selectedMovieId);
            TmdbCollection collection = api.GetCollectionInfo(tmdbMovie.belongs_to_collection.id);
            var collectionPosters = new List<CollectionPoster>();
            var backdrops = new List<CollectionBackdrop>();

            LogMyFilms.Debug("TMDB - Value found - movie   = '" + (tmdbMovie.title ?? "") + "'" + " (" + tmdbMovie.release_date + ")");
            LogMyFilms.Debug("TMDB - Value found - belongs to collection id = '" + collection.id.ToString() + "', name  = '" + (collection.name ?? "") + "'");

            TmdbCollectionImages collectionImages = api.GetCollectionImages(collection.id, language);
            LogMyFilms.Debug("TMDB - Collection Posters found for language = '" + language + "' : '" + collectionImages.posters.Count + "'");
            collectionPosters.AddRange(collectionImages.posters);
            backdrops.AddRange(collectionImages.backdrops);
            collectionImages = api.GetCollectionImages(collection.id, null);
            LogMyFilms.Debug("TMDB - Collection Posters found: '" + collectionImages.posters.Count + "'");
            collectionPosters.AddRange(collectionImages.posters);
            backdrops.AddRange(collectionImages.backdrops);

            collectionPosters.Distinct();
            backdrops.Distinct();

            //foreach (CollectionBackdrop backdrop in backdrops)
            //{
            //  string fanartUrl = tmdbConf.images.base_url + "original" + backdrop.file_path;
            //  LogMyFilms.Debug("TMDB - Backdrop found = '" + fanartUrl + "'");
            //}
            #endregion

            if (collectionPosters.Count == 0)
            {
              SetProcessAnimationStatus(false, animation);
              GUIUtils.ShowNotifyDialog(GUILocalizeStrings.Get(10798760), GUILocalizeStrings.Get(10798625)); // load group covers, no result found
              return;
            }

            #region load collection images into selection menu
            var choicePosters = new List<CollectionPoster>();
            if (dlg == null) return;
            dlg.Reset();
            dlg.SetHeading(GUILocalizeStrings.Get(10798760)); // Load collection cover (Tmdb)
            foreach (CollectionPoster poster in collectionPosters)
            {
              string posterUrlSmall = tmdbConf.images.base_url + "w154" + poster.file_path;
              string posterUrl = tmdbConf.images.base_url + "w500" + poster.file_path;
              LogMyFilms.Debug("TMDB - Collection Poster found = '" + posterUrl + "'");
              var item = new GUIListItem();
              item.Label = poster.width + " x " + poster.height;
              item.IconImage = posterUrlSmall;
              item.ThumbnailImage = posterUrl;
              dlg.Add(item);
              choicePosters.Add(poster);
            }
            #endregion
            SetProcessAnimationStatus(false, animation);

            dlg.DoModal(GUIWindowManager.ActiveWindow);
            if (dlg.SelectedLabel == -1) return;
            CollectionPoster selectedPoster = choicePosters[dlg.SelectedLabel];

            #region load collection cover images and fanart
            SetProcessAnimationStatus(true, animation);
            try
            {
              #region Poster

              string localThumb = MyFilms.conf.StrPicturePrefix.Length > 0
                             ? MyFilms.conf.StrPathImg + "\\" + MyFilms.conf.StrPicturePrefix + collectionSafeName + ".jpg"
                             : Path.Combine(MyFilms.conf.StrPathImg, collectionSafeName + ".jpg");
              string remoteThumb = tmdbConf.images.base_url + "w500" + selectedPoster.file_path;
              LogMyFilms.Debug("GetImagesTMDB() - localThumb = '" + localThumb + "'");
              LogMyFilms.Debug("GetImagesTMDB() - remoteThumb = '" + remoteThumb + "'");

              if (!string.IsNullOrEmpty(remoteThumb) && !string.IsNullOrEmpty(localThumb))
              {
                if (File.Exists(localThumb)) try { File.Delete(localThumb); }
                  catch (Exception) { }
                Thread.Sleep(10);
                if (GrabUtil.DownloadImage(remoteThumb, localThumb))
                {
                  string coverThumbDir = MyFilmsSettings.GetPath(MyFilmsSettings.Path.ThumbsCache) + @"\MyFilms_Movies";
                  string strThumb = MediaPortal.Util.Utils.GetCoverArtName(coverThumbDir, collectionSafeName); // cached cover
                  if (!string.IsNullOrEmpty(strThumb) && strThumb.Contains("."))
                  {
                    string strThumbSmall = strThumb.Substring(0, strThumb.LastIndexOf(".", StringComparison.Ordinal)) + "_s" + Path.GetExtension(strThumb);  // cached cover for Icons - small resolution
                    if (!string.IsNullOrEmpty(localThumb) && localThumb != MyFilms.conf.DefaultCover)
                    {
                      Picture.CreateThumbnail(localThumb, strThumbSmall, 100, 150, 0, Thumbs.SpeedThumbsSmall);
                      Picture.CreateThumbnail(localThumb, strThumb, MyFilms.cacheThumbWith, MyFilms.cacheThumbHeight, 0, Thumbs.SpeedThumbsLarge);
                      LogMyFilms.Debug("Creating thumbimage for collection: '" + collection + "'");
                    }
                  }
                  //// notify that image has been downloaded
                  //item.NotifyPropertyChanged("PosterImageFilename");
                  SetProcessAnimationStatus(false, animation);
                  if (interactive) GUIUtils.ShowNotifyDialog(GUILocalizeStrings.Get(1079846)); // Done !
                }
              }
              #endregion

              #region Fanart
              if (MyFilms.conf.StrFanart)
              {
                //string fanartUrl = tmdbConf.images.base_url + "original" + movie.MovieSearchResult.backdrop_path;
                //string filename;
                //string filename1 = GrabUtil.DownloadBacdropArt(MyFilms.conf.StrPathFanart, fanartUrl, item.Label, true, true, out filename);
                //// LogMyFilms.Debug("Fanart " + filename1.Substring(filename1.LastIndexOf("\\") + 1) + " downloaded for " + item.Label);

                ////movie.MovieImages = api.GetMovieImages(movie.MovieSearchResult.id, language);
                ////if (movie.MovieImages.posters.Count == 0)
                ////{
                ////  movie.MovieImages = api.GetMovieImages(movie.MovieSearchResult.id, null);
                ////  LogMyFilms.Debug("GetImagesTMDB() - no '" + language + "' posters found - used default and found '" + movie.MovieImages.posters.Count + "'");
                ////}
                ////int ii = 0;
                ////foreach (Backdrop fanart in movie.MovieImages.backdrops)
                ////{
                ////  if (ii == 0)
                ////  {
                ////    string fanartUrl = tmdbConf.images.base_url + "original" + fanart.file_path;
                ////    string filename;
                ////    string filename1 = GrabUtil.DownloadBacdropArt(MyFilms.conf.StrPathFanart, fanartUrl, item.Label, true, (i == 0), out filename);
                ////    LogMyFilms.Debug("Fanart " + filename1.Substring(filename1.LastIndexOf("\\") + 1) + " downloaded for " + item.Label);
                ////  }
                ////  ii++;
                ////}
              }
              #endregion

            }
            catch (Exception ex)
            {
              LogMyFilms.Debug("GetImagesForTmdbCollection() - Error: '" + ex.Message + "'");
              LogMyFilms.Debug("GetImagesForTmdbCollection() - Exception: '" + ex.StackTrace + "'");
              SetProcessAnimationStatus(false, animation);
            }
            #endregion
          #endregion
          }
          catch (Exception tex)
          {
            LogMyFilms.DebugException("CollectionArtwork() - error in TMDB grabbing movie '" + titlename + "': " + tex.Message, tex);
            SetProcessAnimationStatus(false, animation);
          }
        }
        catch (Exception ex)
        {
          LogMyFilms.DebugException("Thread 'LoadCollectionImages' - exception! - ", ex);
        }
        finally
        {
          GUIWindowManager.Replace(2009, dlgMenuOrg);
          SetProcessAnimationStatus(false, animation);
        }
        GUIWindowManager.SendThreadCallbackAndWait((p1, p2, data) =>
        {
          // after background thread has finished !
          return 0;
        }, 0, 0, null);
      }) { Name = "LoadCollectionImages", IsBackground = true }.Start();
    }
示例#33
0
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();

      HasCamera = _hasCamera;
      Camera = new System.Drawing.Point(_cameraXPos, _cameraYPos);

      _font1 = GUIFontManager.GetFont(_fontName1);
      _font2 = GUIFontManager.GetFont(_fontName2);

      // Create the background.
      _imageBackground = LoadAnimationControl(_controlId, 0, _backgroundPositionX, _backgroundPositionY,
                                              _backgroundWidth, _backgroundHeight, _backgroundTextureName);
      _imageBackground.ParentControl = this;
      _imageBackground.DimColor = DimColor;

      // Create the foreground.
      _imageForeground = LoadAnimationControl(_controlId, 0, _foregroundPositionX, _foregroundPositionY,
                                              _foregroundWidth, _foregroundHeight, _foregroundTextureName);
      _imageForeground.ParentControl = this;
      _imageForeground.DimColor = DimColor;

      // Create a single focus frame for the card that is in focus.
      _frameFocus = LoadAnimationControl(0, 0,
                                         0, 0,
                                         _cardWidth, _cardHeight,
                                         _frameFocusName);
      _frameFocus.ParentControl = null;
      _frameFocus.DimColor = DimColor;
      _frameFocus.FlipY = _flipY;
      _frameFocus.DiffuseFileName = _diffuseFilename;
      _frameFocus.MaskFileName = _maskFilename;
      _frameFocus.AllocResources();

      // Create the card labels.
      int y = _positionY + _label1OffsetY;
      _label1 = new GUILabelControl(_controlId, 0,
                                    0, y,
                                    Width, 0,
                                    _fontName1, "", 0x0,
                                    Alignment.ALIGN_CENTER, VAlignment.ALIGN_TOP,
                                    false,
                                    _shadowAngle, _shadowDistance, _shadowColor);

      y = _positionY + _label2OffsetY;
      _label2 = new GUILabelControl(_controlId, 0,
                                    0, y,
                                    Width, 0,
                                    _fontName2, "", 0x0,
                                    Alignment.ALIGN_CENTER, VAlignment.ALIGN_TOP,
                                    false,
                                    _shadowAngle, _shadowDistance, _shadowColor);

      // Create the horizontal scrollbar.
      int scrollbarWidth = _scrollbarWidth;
      int scrollbarHeight = _scrollbarHeight;
      GUIGraphicsContext.ScaleHorizontal(ref scrollbarWidth);
      GUIGraphicsContext.ScaleVertical(ref scrollbarHeight);
      int scrollbarPosX = _positionX + (_width / 2) - (scrollbarWidth / 2);

      _horizontalScrollbar = new GUIHorizontalScrollbar(_controlId, 0,
                                                        scrollbarPosX, _positionY + _scrollbarOffsetY,
                                                        scrollbarWidth, scrollbarHeight,
                                                        _scrollbarBackgroundTextureName, _scrollbarLeftTextureName,
                                                        _scrollbarRightTextureName);
      _horizontalScrollbar.ParentControl = this;
      _horizontalScrollbar.DimColor = DimColor;

      // Create controls for the back of the selected card.  All of the controls are provided as a single subitem.      
      XmlDocument doc = new XmlDocument();

      if (SubItemCount > 0) // avoid exception when no SubItems are available
      {
        doc.LoadXml((string)GetSubItem(0));
        XmlNodeList nodeList = doc.DocumentElement.SelectNodes("/controls/*");
        IDictionary<string, string> defines = new Dictionary<string, string>(); // An empty set of defines.
        foreach (XmlNode node in nodeList)
        {
          try
          {
            GUIControl newControl = GUIControlFactory.Create(_windowId, node, defines, null);
            _cardBackControls.Add(newControl);
          }
          catch (Exception ex)
          {
            Log.Error("GUICoverFlow: Unable to load control. exception:{0}", ex.ToString());
          }
        }
      }
    }
示例#34
0
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      _lowItemHeight = _itemHeight;
      _lowItemWidth = _itemWidth;
      _lowTextureWidth = _textureWidth;
      _lowTextureHeight = _textureHeight;

      _controlUpDown = new GUISpinControl(GetID, 0, _spinControlPositionX, _spinControlPositionY,
                                          _spinControlWidth, _spinControlHeight,
                                          _upTextureName, _downTextureName, _upTextureNameFocus, _downTextureNameFocus,
                                          _fontName, _spinControlColor,
                                          GUISpinControl.SpinType.SPIN_CONTROL_TYPE_INT,
                                          _spinControlAlignment);
      _controlUpDown.ParentControl = this;
      _controlUpDown.DimColor = DimColor;

      int xpos = 5 + _positionX + _width;
      if (xpos + 15 > GUIGraphicsContext.Width)
      {
        xpos = GUIGraphicsContext.Width - 15;
      }
      _verticalScrollBar = new GUIVerticalScrollbar(_controlId, 0,
                                                    5 + _positionX + _width + _scrollbarXOff, _positionY,
                                                    _scrollbarWidth, _height,
                                                    _scrollbarBackGroundTextureName, _scrollbarTopTextureName,
                                                    _scrollbarBottomTextureName);
      _verticalScrollBar.ParentControl = this;
      _verticalScrollBar.SendNotifies = false;
      _verticalScrollBar.DimColor = DimColor;
      _font = GUIFontManager.GetFont(_fontName);
      SetTextureDimensions(_textureWidth, _textureHeight);
      SetThumbDimensionsLow(_xPositionThumbNail, _yPositionThumbNail, _thumbNailWidth, _thumbNailHeight);

      _frameNoFocusControl = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _itemWidth,
                                                  _itemHeight,
                                                  _frameNoFocusName);
      _frameNoFocusControl.ParentControl = this;
      _frameNoFocusControl.DimColor = DimColor;
      _frameNoFocusControl.MaskFileName = _frameNoFocusMask;
      _frameNoFocusControl.SetAnimations(_allThumbAnimations);


      _frameFocusControl = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _itemWidth,
                                                _itemHeight,
                                                _frameFocusName);
      _frameFocusControl.ParentControl = this;
      _frameFocusControl.DimColor = DimColor;
      _frameFocusControl.MaskFileName = _frameFocusMask;
      _frameFocusControl.SetAnimations(_allThumbAnimations);

      using (Settings xmlreader = new MPSettings())
      {
        _loopDelay = xmlreader.GetValueAsInt("gui", "listLoopDelay", 100);
      }
    }
示例#35
0
 public GUIAnimation(GUIAnimation a)
   : base(a._parentControlId, a._controlId, a._positionX, a._positionY, a._width, a._height)
 {
   _animating = false;
   _isFirstRender = true;
   _iterationCount = 0;
   _startTick = 0;
   _hidePngAnimations = false;
   _triggerList = a._triggerList.GetRange(0, a._triggerList.Count);
   _easing = a._easing;
   _fillBehavior = a._fillBehavior;
   _horizontalAlignment = a._horizontalAlignment;
   _textureNames = a._textureNames;
   _rate = a._rate;
   _duration = a._duration;
   _repeatBehavior = a._repeatBehavior;
   _verticalAlignment = a._verticalAlignment;
   _triggerNames = a._triggerNames;
   InitTriggerList();
 }
        public override void FinalizeConstruction()
        {
            base.FinalizeConstruction();
            ImgUpButtonNormal = LoadAnimationControl(WindowId, WindowId + 10000, UpBtnXOffset, UpBtnYOffset, UpBtnWidth,
                                                     UpBtnHeight, TextureMoveUpFileName);
            ImgUpButtonFocused = LoadAnimationControl(WindowId, WindowId + 10001, 0, 0, UpBtnWidth, UpBtnHeight,
                                                      TextureMoveUpFocusedFileName);
            ImgUpButtonNormal.ParentControl  = this;
            ImgUpButtonFocused.ParentControl = this;
            ImgUpButtonNormal.DimColor       = DimColor;
            ImgUpButtonFocused.DimColor      = DimColor;
            ImgUpButtonNormal.BringIntoView();
            ImgUpButtonFocused.BringIntoView();

            ImgDownButtonNormal = LoadAnimationControl(WindowId, WindowId + 10003, DownBtnXOffset, DownBtnYOffset,
                                                       DownBtnWidth, DownBtnHeight, TextureMoveDownFileName);
            ImgDownButtonFocused = LoadAnimationControl(WindowId, WindowId + 10004, 0, 0, DownBtnWidth, DownBtnHeight,
                                                        TextureMoveDownFocusedFileName);
            ImgDownButtonNormal.ParentControl  = this;
            ImgDownButtonFocused.ParentControl = this;
            ImgDownButtonNormal.DimColor       = DimColor;
            ImgDownButtonFocused.DimColor      = DimColor;
            ImgDownButtonNormal.BringIntoView();
            ImgDownButtonFocused.BringIntoView();

            ImgDeleteButtonNormal = LoadAnimationControl(WindowId, WindowId + 10006, DeleteBtnXOffset, DeleteBtnYOffset,
                                                         DeleteBtnWidth, DeleteBtnHeight, TextureDeleteFileName);
            ImgDeleteButtonFocused = LoadAnimationControl(WindowId, WindowId + 10007, 0, 0, DeleteBtnWidth, DeleteBtnHeight,
                                                          TextureDeleteFocusedFileName);
            ImgDeleteButtonNormal.ParentControl  = this;
            ImgDeleteButtonFocused.ParentControl = this;
            ImgDeleteButtonNormal.DimColor       = DimColor;
            ImgDeleteButtonFocused.DimColor      = DimColor;
            ImgDeleteButtonNormal.BringIntoView();
            ImgDeleteButtonFocused.BringIntoView();

            // Keep track of the original NavigateLeft and NavigateRight values...
            _NavigateLeft  = NavigateLeft;
            _NavigateRight = NavigateRight;

            string skinFolderPath = GUIGraphicsContext.GetThemedSkinDirectory(@"\media\");

            ImgUpButtonDisabled = GetDisabledButtonImage(skinFolderPath, TextureMoveUpFileName, WindowId, WindowId + 10002,
                                                         UpBtnXOffset, UpBtnYOffset, UpBtnWidth, UpBtnHeight);

            if (ImgUpButtonDisabled != null)
            {
                ImgDeleteButtonNormal.ParentControl = this;
                ImgUpButtonDisabled.BringIntoView();
            }

            ImgDownButtonDisabled = GetDisabledButtonImage(skinFolderPath, TextureMoveDownFileName, WindowId,
                                                           WindowId + 10005, DownBtnXOffset, DownBtnYOffset, DownBtnWidth,
                                                           DownBtnHeight);

            if (ImgDownButtonDisabled != null)
            {
                ImgDownButtonDisabled.ParentControl = this;
                ImgDownButtonDisabled.BringIntoView();
            }

            ImgDeleteButtonDisabled = GetDisabledButtonImage(skinFolderPath, TextureDeleteFileName, WindowId,
                                                             WindowId + 10008, DeleteBtnXOffset, DeleteBtnYOffset,
                                                             DeleteBtnWidth, DeleteBtnHeight);

            if (ImgDeleteButtonDisabled != null)
            {
                ImgDeleteButtonDisabled.ParentControl = this;
                ImgDeleteButtonDisabled.BringIntoView();
            }
        }
    /// <summary>
    /// This method gets called when the control is created and all properties has been set
    /// It allows the control todo any initialization
    /// </summary>
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      _imageFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                           _focusedTextureName);
      _imageFocused.ParentControl = this;
      _imageFocused.Filtering = false;
      _imageFocused.DimColor = DimColor;
      _imageFocused.SetBorder(_strBorderTF, _borderPositionTF, _borderTextureRepeatTF, _borderTextureRotateTF,
                              _borderTextureFileNameTF, _borderColorKeyTF, _borderHasCornersTF,
                              _borderCornerTextureRotateTF);

      _imageNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                              _nonFocusedTextureName);
      _imageNonFocused.ParentControl = this;
      _imageNonFocused.Filtering = false;
      _imageNonFocused.DimColor = DimColor;
      _imageNonFocused.SetBorder(_strBorderTNF, _borderPositionTNF, _borderTextureRepeatTNF, _borderTextureRotateTNF,
                                 _borderTextureFileNameTNF, _borderColorKeyTNF, _borderHasCornersTNF,
                                 _borderCornerTextureRotateTNF);
      GUILocalizeStrings.LocalizeLabel(ref _label);


      if (_scrollStartDelay < 0)
      {
        _labelControl = new GUILabelControl(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName,
                                            _label, _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP, false,
                                            _shadowAngle, _shadowDistance, _shadowColor);
        ((GUILabelControl)_labelControl).ParentControl = this;
        ((GUILabelControl)_labelControl).DimColor = DimColor;
        ((GUILabelControl)_labelControl).TextAlignment = _textAlignment;
        ((GUILabelControl)_labelControl).TextVAlignment = _textVAlignment;
      }
      else
      {
        _labelControl = new GUIFadeLabel(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName,
                                         _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP,
                                         _shadowAngle, _shadowDistance, _shadowColor,
                                         _userWrapString);
        ((GUIFadeLabel)_labelControl).TextAlignment = _textAlignment;
        ((GUIFadeLabel)_labelControl).TextVAlignment = _textVAlignment;
        ((GUIFadeLabel)_labelControl).AllowScrolling = false;
        ((GUIFadeLabel)_labelControl).AllowFadeIn = false;
      }

      string spinFontName = _fontName;
      if (_spinTextInButton)
      {
        // When the spin control font name is null the spin control will not render the text.
        // _spinTextInButton will render the spin control text in the button label.
        spinFontName = null;
      }

      _spinControl = new GUISpinControl(GetID, 0, _positionX + _width - _spinWidth, _positionY, _spinWidth,
                                        _spinHeight, _upTextureName, _downTextureName,
                                        _upTextureNameFocus, _downTextureNameFocus,
                                        spinFontName, _textColor, _spinType, _spinAlignment);
      _spinControl.ParentControl = this;
      _spinControl.DimColor = DimColor;
      _spinControl.ShowRange = _showRange;
      _spinControl.Digits = _digits;
      _spinControl.SetReverse(_reverse);
      _spinControl.Orientation = _orientation;
      _spinControl.CycleItems = _cycleItems;
      _spinControl.SetShadow(_shadowAngle, _shadowDistance, _shadowColor);
      _spinControl.PrefixText = _prefixText;
      _spinControl.SuffixText = _suffixText;
      _spinControl.TextOffsetX = _spinTextOffsetX;
      _spinControl.TextOffsetY = _spinTextOffsetY;

      // Pass all of the subitems to the spin control.
      for (int i = 0; i < SubItemCount; ++i)
      {
        _spinControl.AddSubItem(GetSubItem(i));
      }
      for (int i = 0; i < SubItemCount; ++i)
      {
        RemoveSubItem(i);
      }
    }
示例#38
0
    public static bool Play(string stream, bool showPlaybackQualitySelectionDialog, GUIAnimation searchanimation)
    {
      if (string.IsNullOrEmpty(stream)) return false;

      // use onlinevideo youtube siteutils to get playback urls as myfilms only gives us the html page
      if (stream.Contains("youtube.com"))
      {
        // get playback url from streamURL
        LogMyFilms.Info("Getting playback url from page '{0}'", stream);

        try
        {
          bool interactiveSuccessful = false;
          if (showPlaybackQualitySelectionDialog)
          {
            Dictionary<string, string> availableTrailerFiles = GetYoutubeDownloadUrls(stream);
            List<string> choiceView = new List<string>();

            //GUIWindowManager.SendThreadCallbackAndWait((p1, p2, o) =>
            //{
            //  {
                
            //  }
            //  return 0;
            //}, 0, 0, null);
            
            GUIDialogMenu dlg = (MediaPortal.Dialogs.GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
            if (dlg == null) return false;
            dlg.Reset();
            dlg.SetHeading(GUILocalizeStrings.Get(10798994)); // Select quality ...
            foreach (KeyValuePair<string, string> availableTrailerFile in availableTrailerFiles)
            {
              dlg.Add(availableTrailerFile.Key);
              choiceView.Add(availableTrailerFile.Value); // this is the download URL
            }
            dlg.DoModal(GUIWindowManager.ActiveWindow);
            if (dlg.SelectedLabel == -1) return false;
            stream = choiceView[dlg.SelectedLabel];
            interactiveSuccessful = true;
          }

          if (!interactiveSuccessful)
          {
            // OnlineVideosHosterProxy ovHosterProxy = ExternalPlugins::OnlineVideos.CrossDomain.OnlineVideosAppDomain.Domain.CreateInstanceAndUnwrap(typeof(OnlineVideosHosterProxy).Assembly.FullName, typeof(OnlineVideosHosterProxy).FullName) as OnlineVideosHosterProxy;
            // stream = ovHosterProxy.GetVideoUrls(stream);
            stream = ExternalPlugins::OnlineVideos.Hoster.HosterFactory.GetHoster("Youtube").GetVideoUrl(stream);
          }
        }
        catch (Exception ex)
        {
          LogMyFilms.Debug("playback url exception: '{0}'", ex.Message);
          return false;
        }

        if (string.IsNullOrEmpty(stream))
        {
          LogMyFilms.Info("Unable to find playback url from stream!", stream);
          return false;
        }
        LogMyFilms.Info("Found playback url: '{0}'", stream);
      }

      LogMyFilms.Info("Preparing graph for playback of '{0}'", stream);

      PlayerFactory factory = new PlayerFactory(PlayerType.Internal, stream);
      bool? prepareResult = ((OnlineVideosPlayer)factory.PreparedPlayer).PrepareGraph();

      if (prepareResult != true)
      {
        LogMyFilms.Info("Failed to create Player graph.");
        return false;
      }

      GUIBackgroundTask.Instance.ExecuteInBackgroundAndCallback(() =>
      {
        LogMyFilms.Info("OnlineVideo Pre-Buffering Started");
        if (((OnlineVideosPlayer)factory.PreparedPlayer).BufferFile(YouTubeSiteUtil))
        {
          LogMyFilms.Info("OnlineVideo Pre-Buffering Complete");
          return true;
        }
        else
        {
          return null;
        }

      },
      delegate(bool success, object result)
      {
        if (result is bool?)
        {
          (factory.PreparedPlayer as OVSPLayer).GoFullscreen = true;

          IPlayerFactory savedFactory = g_Player.Factory;
          g_Player.Factory = factory;
          try
          {
            g_Player.Play(stream, g_Player.MediaType.Video);
          }
          catch (Exception e)
          {
            LogMyFilms.Warn("Exception while playing stream: {0}", e.Message);
          }
          g_Player.Factory = savedFactory;
        }
        else
        {
          LogMyFilms.Error("Failed to Buffer stream.");
          factory.PreparedPlayer.Dispose();
        }
      },
      "PlayTrailerStream", false, searchanimation);

      return true;
    }
        public override void FinalizeConstruction()
        {
            base.FinalizeConstruction();
            if (_topTextureName == null)
            {
                _topTextureName = string.Empty;
            }
            if (_bottomTextureName == null)
            {
                _bottomTextureName = string.Empty;
            }
            if (_leftTextureName == null)
            {
                _leftTextureName = string.Empty;
            }
            if (_midTextureName == null)
            {
                _midTextureName = string.Empty;
            }
            if (_rightTextureName == null)
            {
                _rightTextureName = string.Empty;
            }
            if (_tickTextureName == null)
            {
                _tickTextureName = string.Empty;
            }
            if (_tickFill1TextureName == null)
            {
                _tickFill1TextureName = string.Empty;
            }
            if (_tickFill2TextureName == null)
            {
                _tickFill2TextureName = string.Empty;
            }
            if (_tickFill3TextureName == null)
            {
                _tickFill3TextureName = string.Empty;
            }
            if (_fillBackGroundTextureName == null)
            {
                _fillBackGroundTextureName = string.Empty;
            }
            if (_logoTextureName == null)
            {
                _logoTextureName = string.Empty;
            }
            _imageTop    = LoadAnimationControl(_parentControlId, _controlId, 0, 0, 0, 0, _topTextureName);
            _imageBottom = LoadAnimationControl(_parentControlId, _controlId, 0, 0, 0, 0, _bottomTextureName);
            _imageLeft   = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0, _leftTextureName);
            _imageMid    = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0, _midTextureName);
            _imageRight  = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0, _rightTextureName);
            _imageTick   = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0, _tickTextureName);
            _imageFill1  = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0,
                                                _tickFill1TextureName);
            _imageFill2 = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0,
                                               _tickFill2TextureName);
            _imageFill3 = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0,
                                               _tickFill3TextureName);
            _imageFillBackground                 = LoadAnimationControl(_parentControlId, _controlId, 0, 0, 0, 0, _fillBackGroundTextureName);
            _imageTop.KeepAspectRatio            = false;
            _imageBottom.KeepAspectRatio         = false;
            _imageMid.KeepAspectRatio            = false;
            _imageRight.KeepAspectRatio          = false;
            _imageTick.KeepAspectRatio           = false;
            _imageFill1.KeepAspectRatio          = false;
            _imageFill2.KeepAspectRatio          = false;
            _imageFill3.KeepAspectRatio          = false;
            _imageFillBackground.KeepAspectRatio = false;

            _imageTop.ParentControl            = this;
            _imageBottom.ParentControl         = this;
            _imageMid.ParentControl            = this;
            _imageRight.ParentControl          = this;
            _imageTick.ParentControl           = this;
            _imageFill1.ParentControl          = this;
            _imageFill2.ParentControl          = this;
            _imageFill3.ParentControl          = this;
            _imageFillBackground.ParentControl = this;
            _imageLogo = LoadAnimationControl(_parentControlId, _controlId, 0, 0, 0, 0, _logoTextureName);
            _imageLogo.ParentControl = this;
            FontName = _fontName;
        }
        public override void FinalizeConstruction()
        {
            base.FinalizeConstruction();
            if (_topTextureName == null)
            {
                _topTextureName = string.Empty;
            }
            if (_bottomTextureName == null)
            {
                _bottomTextureName = string.Empty;
            }
            if (_leftTextureName == null)
            {
                _leftTextureName = string.Empty;
            }
            if (_midTextureName == null)
            {
                _midTextureName = string.Empty;
            }
            if (_rightTextureName == null)
            {
                _rightTextureName = string.Empty;
            }
            if (_tickTextureName == null)
            {
                _tickTextureName = string.Empty;
            }
            if (_tickFill1TextureName == null)
            {
                _tickFill1TextureName = string.Empty;
            }
            if (_tickFill2TextureName == null)
            {
                _tickFill2TextureName = string.Empty;
            }
            if (_tickFill3TextureName == null)
            {
                _tickFill3TextureName = string.Empty;
            }
            if (_markerTextureName == null)
            {
                _markerTextureName = string.Empty;
            }
            if (_fillBackGroundTextureName == null)
            {
                _fillBackGroundTextureName = string.Empty;
            }
            if (_logoTextureName == null)
            {
                _logoTextureName = string.Empty;
            }
            _imageTop    = LoadAnimationControl(_parentControlId, _controlId, 0, 0, 0, 0, _topTextureName);
            _imageBottom = LoadAnimationControl(_parentControlId, _controlId, 0, 0, 0, 0, _bottomTextureName);
            _imageLeft   = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0, _leftTextureName);
            _imageMid    = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0, _midTextureName);
            _imageRight  = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0, _rightTextureName);
            _imageTick   = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0, _tickTextureName);
            _imageFill1  = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0,
                                                _tickFill1TextureName);
            _imageFill2 = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0,
                                               _tickFill2TextureName);
            _imageFill3 = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0,
                                               _tickFill3TextureName);
            _imageFillBackground                 = LoadAnimationControl(_parentControlId, _controlId, 0, 0, 0, 0, _fillBackGroundTextureName);
            _imageTop.KeepAspectRatio            = false;
            _imageBottom.KeepAspectRatio         = false;
            _imageMid.KeepAspectRatio            = false;
            _imageRight.KeepAspectRatio          = false;
            _imageTick.KeepAspectRatio           = false;
            _imageFill1.KeepAspectRatio          = false;
            _imageFill2.KeepAspectRatio          = false;
            _imageFill3.KeepAspectRatio          = false;
            _imageFillBackground.KeepAspectRatio = false;

            _imageTop.ParentControl            = this;
            _imageBottom.ParentControl         = this;
            _imageMid.ParentControl            = this;
            _imageRight.ParentControl          = this;
            _imageTick.ParentControl           = this;
            _imageFill1.ParentControl          = this;
            _imageFill2.ParentControl          = this;
            _imageFill3.ParentControl          = this;
            _imageFillBackground.ParentControl = this;
            _imageLogo = LoadAnimationControl(_parentControlId, _controlId, 0, 0, 0, 0, _logoTextureName);
            _imageLogo.ParentControl = this;
            FontName = _fontName;

            //create an image for the markers that we will move around and render as needed.
            string strText = GUIPropertyManager.Parse(LabelMarkerStarts);

            if (strText.Length > 0)
            {
                _imageFillMarker = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, 0, 0,
                                                        _markerTextureName);
                _imageFillMarker.KeepAspectRatio = false;
                _imageFillMarker.ParentControl   = this;
            }
        }
示例#41
0
    //-------------------------------------------------------------------------------------------
    //  Grab URL Internet Movie Informations and update the XML database and refresh screen
    //  -> Search and select matching movie
    //-------------------------------------------------------------------------------------------        
    public static void grabb_Internet_Informations_Search(string fullMovieName, int GetID, string wscript, string fullMoviePath, GrabType grabtype, Searchtitles sTitles, GUIAnimation searchanimation)
    {
      if (string.IsNullOrEmpty(wscript)) return;
      LogMyFilms.Debug("grabb_Internet_Informations_Search() with title = '" + fullMovieName + "', grabberfile = '" + wscript + "'");
      string movieName = fullMovieName;
      string movieHierarchy = string.Empty;
      string moviePath = fullMoviePath;
      if (MyFilms.conf.TitleDelim.Length > 0)
      {
        movieName = fullMovieName.Substring(fullMovieName.LastIndexOf(MyFilms.conf.TitleDelim, StringComparison.Ordinal) + 1).Trim();
        movieHierarchy = fullMovieName.Substring(0, fullMovieName.LastIndexOf(MyFilms.conf.TitleDelim, StringComparison.Ordinal) + 1).Trim();
      }
      var grab = new Grabber.Grabber_URLClass();
      Grabber_URLClass.IMDBUrl wurl;
      var listUrl = new ArrayList();

      new Thread(delegate()
        {
          SetProcessAnimationStatus(true, searchanimation); // GUIWaitCursor.Init(); GUIWaitCursor.Show();
          try
          {
            // listUrl = Grab.ReturnURL(MovieName, wscript, 1, !MyFilms.conf.StrGrabber_Always, MoviePath); // MoviePath only when nfo reader used !!!
            listUrl = grab.ReturnURL(movieName, wscript, 1, !MyFilms.conf.StrGrabber_Always, "");
          }
          catch (Exception ex)
          {
            LogMyFilms.ErrorException("grabb_Internet_Details_Search() - exception = '" + ex.Message + "'", ex);
          }
          SetProcessAnimationStatus(false, searchanimation); // GUIWaitCursor.Hide();

          int listCount = listUrl.Count;
          if (!MyFilms.conf.StrGrabber_Always)
            listCount = 2;
          switch (listCount)
          {
            case 1: // only one match -> grab details without user interaction
              wurl = (Grabber.Grabber_URLClass.IMDBUrl)listUrl[0];
              grabb_Internet_Details_Informations(wurl.URL, movieHierarchy, wscript, GetID, false, grabtype, sTitles, searchanimation);
              break;
            case 0:
              break;
            default:
              #region manual choice
              var dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
              var choiceViewMenu = new List<string>();
              choiceViewMenu.Clear();

              if (dlg == null) return;
              dlg.Reset();
              dlg.SetHeading(GUILocalizeStrings.Get(924)); // menu
              dlg.Add("  *****  " + GUILocalizeStrings.Get(1079860) + "  *****  "); //manual selection
              choiceViewMenu.Add("manual selection");

              for (int i = 0; i < listUrl.Count; i++)
              {
                wurl = (Grabber.Grabber_URLClass.IMDBUrl)listUrl[i];
                if (wurl.Director.Contains(MyFilms.r[MyFilms.conf.StrIndex]["Director"].ToString()) && wurl.Year.Contains(MyFilms.r[MyFilms.conf.StrIndex]["Year"].ToString()) && !MyFilms.conf.StrGrabber_Always)
                {
                  if (dlg.SelectedLabel == -1)
                    dlg.SelectedLabel = i + 1;
                  else
                    dlg.SelectedLabel = -2;
                }
                string viewTitle = wurl.Title;
                if (!string.IsNullOrEmpty(wurl.Year)) viewTitle += " (" + wurl.Year + ")";
                if (!string.IsNullOrEmpty(wurl.Options)) viewTitle += " - " + wurl.Options + "";
                dlg.Add(viewTitle);
                choiceViewMenu.Add(wurl.Title);
              }
              string[] split = movieName.Trim().Split(new Char[] { ' ', '-' }, StringSplitOptions.RemoveEmptyEntries);
              foreach (string s in split.Where(s => s.Length > 2))
              {
                dlg.Add(GUILocalizeStrings.Get(137) + " '" + s + "'"); // add words from title as search items
                choiceViewMenu.Add(s);
              }
              if (grabtype != GrabType.Person)
              {
                #region add all titles as alternative search expressions
                if (!string.IsNullOrEmpty(sTitles.OriginalTitle) && !choiceViewMenu.Contains(sTitles.OriginalTitle))
                {
                  dlg.Add(GUILocalizeStrings.Get(137) + " '" + sTitles.OriginalTitle + "'"); //search
                  choiceViewMenu.Add(sTitles.OriginalTitle);
                }
                if (!string.IsNullOrEmpty(sTitles.TranslatedTitle) && !choiceViewMenu.Contains(sTitles.TranslatedTitle))
                {
                  dlg.Add(GUILocalizeStrings.Get(137) + " '" + sTitles.TranslatedTitle + "'");
                  choiceViewMenu.Add(sTitles.TranslatedTitle);
                }
                if (!string.IsNullOrEmpty(sTitles.FormattedTitle) && !choiceViewMenu.Contains(sTitles.FormattedTitle))
                {
                  dlg.Add(GUILocalizeStrings.Get(137) + " '" + sTitles.FormattedTitle + "'");
                  choiceViewMenu.Add(sTitles.FormattedTitle);
                }
                if (!string.IsNullOrEmpty(sTitles.MovieDirectoryTitle) && !choiceViewMenu.Contains(sTitles.MovieDirectoryTitle))
                {
                  dlg.Add(GUILocalizeStrings.Get(137) + " '" + sTitles.MovieDirectoryTitle + "'");
                  choiceViewMenu.Add(sTitles.MovieDirectoryTitle);
                }
                if (!string.IsNullOrEmpty(sTitles.MovieFileTitle) && !choiceViewMenu.Contains(sTitles.MovieFileTitle))
                {
                  dlg.Add(GUILocalizeStrings.Get(137) + " '" + sTitles.MovieFileTitle + "'");
                  choiceViewMenu.Add(sTitles.MovieFileTitle);
                }
                #endregion
              }

              if (!(dlg.SelectedLabel > -1))
              {
                dlg.SelectedLabel = -1;
                dlg.DoModal(GetID);
              }
              if (dlg.SelectedLabel == 0)
              {
                VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
                if (null == keyboard) return;
                keyboard.Reset();
                keyboard.SetLabelAsInitialText(false); // set to false, otherwise our intial text is cleared
                keyboard.Text = movieName;
                keyboard.DoModal(GetID);
                if (keyboard.IsConfirmed && keyboard.Text.Length > 0)
                  grabb_Internet_Informations_Search(keyboard.Text, GetID, wscript, moviePath, grabtype, sTitles, searchanimation);
                break;
              }
              if (dlg.SelectedLabel > 0 && dlg.SelectedLabel <= listUrl.Count)
              {
                wurl = (Grabber_URLClass.IMDBUrl)listUrl[dlg.SelectedLabel - 1];
                grabb_Internet_Details_Informations(wurl.URL, movieHierarchy, wscript, GetID, true, grabtype, sTitles, searchanimation);
                break;
              }
              if (dlg.SelectedLabel > listUrl.Count)
              {
                //VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
                //if (null == keyboard) return;
                //keyboard.Reset();
                //keyboard.Text = dlg.SelectedLabelText;
                //// keyboard.Text = choiceViewMenu[dlg.SelectedLabel];
                //keyboard.DoModal(GetID);
                //if ((keyboard.IsConfirmed) && (keyboard.Text.Length > 0))
                //  grabb_Internet_Informations_Search(keyboard.Text, GetID, wscript, MoviePath, grabtype, sTitles);
                string strChoice = choiceViewMenu[dlg.SelectedLabel];
                LogMyFilms.Debug("grabb_Internet_Informations_Search(): (re)search with new search expression: '" + strChoice + "'");
                grabb_Internet_Informations_Search(strChoice, GetID, wscript, moviePath, grabtype, sTitles, searchanimation);
              }
              break;
              #endregion
          }
          GUIWindowManager.SendThreadCallbackAndWait((p1, p2, data) => { return 0; }, 0, 0, null);
        }) { Name = "MyFilmsDetailsLoader", IsBackground = true }.Start();
    }