public SlidePicture(string strFilePath, bool useActualSizeTexture)
    {
        _filePath = strFilePath;

        _rotation = PictureDatabase.GetRotation(_filePath);

        int iMaxWidth  = GUIGraphicsContext.OverScanWidth;
        int iMaxHeight = GUIGraphicsContext.OverScanHeight;

        _useActualSizeTexture = useActualSizeTexture;
        if (_useActualSizeTexture)
        {
            iMaxWidth  = MAX_PICTURE_WIDTH;
            iMaxHeight = MAX_PICTURE_HEIGHT;
        }

        if (!MediaPortal.Util.Utils.IsPicture(strFilePath))
        {
            return;
        }
        else
        {
            _texture = Picture.Load(strFilePath, _rotation, iMaxWidth, iMaxHeight, true, false, true, out _width, out _height);
        }
    }
        private void CreateThumbsAndAddPictureToDB(string file)
        {
            int iRotate = PictureDatabase.GetRotation(file);

            if (iRotate == -1)
            {
                Log.Debug("GUIPictures Setting : Database is not available. File {0} has not been added", file);
            }

            string thumbnailImage  = Util.Utils.GetPicturesThumbPathname(file);
            string thumbnailImageL = Util.Utils.GetPicturesLargeThumbPathname(file);

            if (!_noLargeThumbnails && !File.Exists(thumbnailImageL))
            {
                if (Util.Picture.CreateThumbnail(file, thumbnailImageL, (int)Thumbs.ThumbLargeResolution,
                                                 (int)Thumbs.ThumbLargeResolution, iRotate, Thumbs.SpeedThumbsLarge,
                                                 true, false))
                {
                    Log.Debug("GUIPictures Setting : Creation of missing large thumb successful for {0}", file);
                    count++;
                    SetStatus(String.Format("{0}/{1} thumbnails generated", count, totalFiles));
                }
            }
            if (!File.Exists(thumbnailImage))
            {
                if (Util.Picture.CreateThumbnail(file, thumbnailImage, (int)Thumbs.ThumbResolution,
                                                 (int)Thumbs.ThumbResolution, iRotate, Thumbs.SpeedThumbsSmall,
                                                 false, false))
                {
                    Log.Debug("GUIPictures Setting : Creation of missing thumb successful for {0}", file);
                    count++;
                    SetStatus(String.Format("{0}/{1} thumbnails generated", count, totalFiles));
                }
            }
        }
Beispiel #3
0
        private void Update()
        {
            try
            {
                if (listExifProperties != null && !listExifProperties.IsVisible)
                {
                    listExifProperties.IsVisible = true;

                    if (!listExifProperties.IsEnabled)
                    {
                        GUIControl.EnableControl(GetID, listExifProperties.GetID);
                    }

                    GUIControl.SelectControl(GetID, listExifProperties.GetID);
                    GUIControl.FocusControl(GetID, listExifProperties.GetID);
                    GUIPropertyManager.SetProperty("#itemcount", Util.Utils.GetObjectCountLabel(listExifProperties.Count));
                    listExifProperties.SelectedListItemIndex = _currentSelectedItem;
                    SelectItem();
                }

                if (imgPicture != null)
                {
                    imgPicture.Rotation = PictureDatabase.GetRotation(_currentPicture);
                    imgPicture.Dispose();
                    imgPicture.AllocResources();
                }

                GUIPropertyManager.SetProperty("#pictures.exif.picture", _currentPicture);
            }
            catch (Exception ex)
            {
                Log.Error("GUIPictureExif Update controls Error: {1}", ex.Message);
            }
        }
Beispiel #4
0
        private void Update()
        {
            if (m_pTexture != null)
            {
                m_pTexture.Dispose();
            }

            SetLabel(lblCameraModel, string.Empty);
            SetLabel(lblDateTakenLabel, string.Empty);
            SetLabel(lblEquipmentMake, string.Empty);
            SetLabel(lblExposureCompensation, string.Empty);
            SetLabel(lblExposureTime, string.Empty);
            SetLabel(lblFlash, string.Empty);
            SetLabel(lblFstop, string.Empty);
            SetLabel(lblImgDimensions, string.Empty);
            SetLabel(lblImgTitle, string.Empty);
            SetLabel(lblMeteringMode, string.Empty);
            SetLabel(lblResolutions, string.Empty);
            SetLabel(lblShutterSpeed, string.Empty);
            SetLabel(lblViewComments, string.Empty);

            if (!File.Exists(FileName))
            {
                GUIPropertyManager.SetProperty("#selectedthumb", string.Empty);
                return;
            }

            int iRotate = PictureDatabase.GetRotation(FileName);

            m_pTexture = Util.Picture.Load(FileName, iRotate, (int)Thumbs.LargeThumbSize.uhd, (int)Thumbs.LargeThumbSize.uhd,
                                           true, false, out m_iTextureWidth, out m_iTextureHeight);

            ExifMetadata.Metadata metaData = PictureDatabase.GetExifFromDB(FileName);
            if (metaData.IsEmpty())
            {
                metaData = PictureDatabase.GetExifFromFile(FileName);
            }
            if (!metaData.IsEmpty())
            {
                SetLabel(lblCameraModel, metaData.CameraModel.DisplayValue);
                SetLabel(lblDateTakenLabel, metaData.DatePictureTaken.DisplayValue);
                SetLabel(lblEquipmentMake, metaData.EquipmentMake.DisplayValue);
                SetLabel(lblExposureCompensation, metaData.ExposureCompensation.DisplayValue);
                SetLabel(lblExposureTime, metaData.ExposureTime.DisplayValue);
                SetLabel(lblFlash, metaData.Flash.DisplayValue, true);
                SetLabel(lblFstop, metaData.Fstop.DisplayValue);
                SetLabel(lblImgDimensions, metaData.ImageDimensionsAsString());
                SetLabel(lblImgTitle, Path.GetFileNameWithoutExtension(FileName));
                SetLabel(lblMeteringMode, metaData.MeteringMode.DisplayValue, true);
                SetLabel(lblResolutions, metaData.ResolutionAsString());
                SetLabel(lblShutterSpeed, metaData.ShutterSpeed.DisplayValue);
                SetLabel(lblViewComments, metaData.ViewerComments.DisplayValue);

                imgPicture.IsVisible = false;
            }
            metaData.SetExifProperties();
            GUIPropertyManager.SetProperty("#selectedthumb", FileName);
        }
Beispiel #5
0
        private void Update()
        {
            if (m_pTexture != null)
            {
                m_pTexture.Dispose();
            }

            int iRotate = PictureDatabase.GetRotation(FileName);

            m_pTexture = Util.Picture.Load(FileName, iRotate, 1024, 1024, true, false, out m_iTextureWidth,
                                           out m_iTextureHeight);

            lblCameraModel.Label          = string.Empty;
            lblDateTakenLabel.Label       = string.Empty;
            lblEquipmentMake.Label        = string.Empty;
            lblExposureCompensation.Label = string.Empty;
            lblExposureTime.Label         = string.Empty;
            lblFlash.Label         = string.Empty;
            lblFstop.Label         = string.Empty;
            lblImgDimensions.Label = string.Empty;
            lblImgTitle.Label      = string.Empty;
            lblMeteringMode.Label  = string.Empty;
            lblResolutions.Label   = string.Empty;
            lblShutterSpeed.Label  = string.Empty;
            lblViewComments.Label  = string.Empty;

            using (ExifMetadata extractor = new ExifMetadata())
            {
                ExifMetadata.Metadata metaData = extractor.GetExifMetadata(FileName);

                lblCameraModel.Label          = metaData.CameraModel.DisplayValue;
                lblDateTakenLabel.Label       = metaData.DatePictureTaken.DisplayValue;
                lblEquipmentMake.Label        = metaData.EquipmentMake.DisplayValue;
                lblExposureCompensation.Label = metaData.ExposureCompensation.DisplayValue;
                lblExposureTime.Label         = metaData.ExposureTime.DisplayValue;
                lblFlash.Label         = metaData.Flash.DisplayValue;
                lblFstop.Label         = metaData.Fstop.DisplayValue;
                lblImgDimensions.Label = metaData.ImageDimensions.DisplayValue;
                lblImgTitle.Label      = Path.GetFileNameWithoutExtension(FileName);
                lblMeteringMode.Label  = metaData.MeteringMode.DisplayValue;
                lblResolutions.Label   = metaData.Resolution.DisplayValue;
                lblShutterSpeed.Label  = metaData.ShutterSpeed.DisplayValue;
                lblViewComments.Label  = metaData.ViewerComments.DisplayValue;

                imgPicture.IsVisible = false;
            }
            if (File.Exists(FileName))
            {
                GUIPropertyManager.SetProperty("#selectedthumb", FileName);
            }
            else
            {
                GUIPropertyManager.SetProperty("#selectedthumb", string.Empty);
            }
        }
Beispiel #6
0
        private void CreateThumbsAndAddPictureToDB(string file)
        {
            int iRotate = PictureDatabase.GetRotation(file);

            if (iRotate == -1)
            {
                Log.Debug("PictureDatabase: Database is not available. File {0} has not been added", file);
            }

            //Thread.Sleep(30);
            //add remote check
            //if ()
            //{
            string thumbnailImage = String.Format(@"{0}\{1}.jpg", Thumbs.Pictures,
                                                  Util.Utils.EncryptLine(file));

            //if (recreateThumbs || !File.Exists(thumbnailImage))
            if (!File.Exists(thumbnailImage))
            {
                if (Util.Picture.CreateThumbnail(file, thumbnailImage, (int)Thumbs.ThumbResolution,
                                                 (int)Thumbs.ThumbResolution, iRotate, Thumbs.SpeedThumbsSmall))
                {
                    Log.Debug("PictureDatabase: Creation of missing thumb successful for {0}", file);
                }
            }

            if (!noLargeThumbnails)
            {
                thumbnailImage = String.Format(@"{0}\{1}L.jpg", Thumbs.Pictures, Util.Utils.EncryptLine(file));
                //if (recreateThumbs || !File.Exists(thumbnailImage))
                if (!File.Exists(thumbnailImage))
                {
                    if (Util.Picture.CreateThumbnail(file, thumbnailImage, (int)Thumbs.ThumbLargeResolution,
                                                     (int)Thumbs.ThumbLargeResolution, iRotate,
                                                     Thumbs.SpeedThumbsLarge))
                    {
                        Log.Debug("PictureDatabase: Creation of missing large thumb successful for {0}", file);
                    }
                }
            }
            //}
        }
Beispiel #7
0
        private void CreateThumbsAndAddPictureToDB(string file)
        {
            int iRotate = PictureDatabase.GetRotation(file);

            string thumbnailImage = MediaPortal.Util.Utils.GetPicturesThumbPathname(file);

            if (!File.Exists(thumbnailImage))
            {
                MediaPortal.Util.Picture.CreateThumbnail(file, thumbnailImage, (int)Thumbs.ThumbResolution, (int)Thumbs.ThumbResolution, iRotate, Thumbs.SpeedThumbsSmall, false, false);
            }

            if (!noLargeThumbnails)
            {
                thumbnailImage = MediaPortal.Util.Utils.GetPicturesLargeThumbPathname(file);
                //if (recreateThumbs || !File.Exists(thumbnailImage))
                if (!File.Exists(thumbnailImage))
                {
                    MediaPortal.Util.Picture.CreateThumbnail(file, thumbnailImage, (int)Thumbs.ThumbLargeResolution, (int)Thumbs.ThumbLargeResolution, iRotate, Thumbs.SpeedThumbsLarge, true, false);
                }
            }
        }
            /// <summary>
            /// creates cached thumbs in MP's thumbs dir
            /// </summary>
            private void PerformRequest()
            {
                Stopwatch benchclock = new Stopwatch();

                benchclock.Start();
                string             path     = _filepath;
                List <GUIListItem> itemlist = null;

                vDir.SetExtensions(Util.Utils.PictureExtensions);

                if (!vDir.IsRemote(path))
                {
                    itemlist = vDir.GetDirectoryUnProtectedExt(path, true);

                    foreach (GUIListItem item in itemlist)
                    {
                        if (GUIGraphicsContext.CurrentState == GUIGraphicsContext.State.STOPPING)
                        {
                            return;
                        }
                        if (String.IsNullOrEmpty(item.Path))
                        {
                            continue;
                        }
                        if (path.Length >= item.Path.Length)
                        {
                            Log.Warn("GUIPictures: Omitting outside path {0} from check share {1}", item.Path, path);
                            continue;
                        }
                        if (!item.IsFolder)
                        {
                            if (item.Path.ToLowerInvariant().Contains(@"folder.jpg"))
                            {
                                continue;
                            }

                            int iRotate = PictureDatabase.GetRotation(item.Path);
                            if (iRotate == -1)
                            {
                                Log.Debug("PictureDatabase: Database is not available. File {0} has not been added", item.Path);
                            }

                            string thumbnailImage  = Util.Utils.GetPicturesThumbPathname(item.Path);
                            string thumbnailImageL = Util.Utils.GetPicturesLargeThumbPathname(item.Path);

                            if (!noLargeThumbnails && !File.Exists(thumbnailImageL))
                            {
                                if (Util.Picture.CreateThumbnail(item.Path, thumbnailImageL, (int)Thumbs.ThumbLargeResolution,
                                                                 (int)Thumbs.ThumbLargeResolution, iRotate, Thumbs.SpeedThumbsLarge,
                                                                 true, false))
                                {
                                    Log.Debug("PictureDatabase: Creation of missing large thumb successful for {0}", item.Path);
                                    countfiles++;
                                }
                            }
                            if (!File.Exists(thumbnailImage))
                            {
                                if (Util.Picture.CreateThumbnail(item.Path, thumbnailImage, (int)Thumbs.ThumbResolution,
                                                                 (int)Thumbs.ThumbResolution, iRotate, Thumbs.SpeedThumbsSmall,
                                                                 false, false))
                                {
                                    Log.Debug("PictureDatabase: Creation of missing thumb successful for {0}", item.Path);
                                    countfiles++;
                                }
                            }
                        }
                    }
                }
            }