Пример #1
0
    private void Add(string name)
    {
        lock (_locker)
        {
            // special treatment for iPhone photo-video pair
            string         movfile = Path.ChangeExtension(name, "mov");
            LocalImageInfo ii      = new LocalImageInfo(name, File.Exists(movfile) ? movfile : null);

            try
            {
                using (var reader = new ExifReader(name))
                {
                    UInt16 orientation;
                    if (reader.GetTagValue(ExifTags.Orientation, out orientation))
                    {
                        ii._orientation = orientation;
                    }

                    DateTime datePictureTaken;
                    if (reader.GetTagValue(ExifTags.DateTimeOriginal, out datePictureTaken))
                    {
                        ii._dateTaken = datePictureTaken;
                    }
                }
            }
            catch (Exception ex)
            {
                ii._messages.Add("Exeption " + ex.ToString());
            }

            _imagesTmp.Add(ii);
        }
    }
Пример #2
0
        public List <LocalImageInfo> GetImages(BaseItem item, IDirectoryService directoryService)
        {
            _logger.LogInformation(item.Path);
            var list = new List <LocalImageInfo>();

            if (Plugin.Instance.Configuration.DisableLocalMetadata)
            {
                _logger.LogInformation("Local Metadata Disabled");
                return(list);
            }


            var filename = item.FileNameWithoutExtension + ".jpg";
            var fullpath = Path.Combine(item.ContainingFolderPath, filename);

            var localimg = new LocalImageInfo();
            var fileInfo = _fileSystem.GetFileSystemInfo(fullpath);

            if (File.Exists(fileInfo.FullName))
            {
                localimg.FileInfo = fileInfo;
                list.Add(localimg);
            }
            return(list);
        }
Пример #3
0
        /// <summary>
        /// Creates a list of <see cref="LocalImageInfo"/> references of the specified type and size, optionally pointing to files that exist.
        /// </summary>
        private static LocalImageInfo[] GetImages(ImageType type, int count, bool validPaths)
        {
            var path   = validPaths ? TestDataImagePath : "invalid path {0}";
            var images = new LocalImageInfo[count];

            for (int i = 0; i < count; i++)
            {
                images[i] = new LocalImageInfo
                {
                    Type     = type,
                    FileInfo = new FileSystemMetadata
                    {
                        FullName = string.Format(CultureInfo.InvariantCulture, path, i)
                    }
                };
            }

            return(images);
        }
        /// <summary>
        /// Retrieves Image.
        /// </summary>
        /// <param name="item"></param>
        /// <param name="directoryService"></param>
        /// <returns></returns>
        public IEnumerable <LocalImageInfo> GetImages(BaseItem item, IDirectoryService directoryService)
        {
            _logger.LogDebug("GetImages: {Name}", item.Name);
            var    list    = new List <LocalImageInfo>();
            string jpgPath = GetSeriesInfo(item.ContainingFolderPath);

            if (String.IsNullOrEmpty(jpgPath))
            {
                return(list);
            }
            if (String.IsNullOrEmpty(jpgPath))
            {
                return(list);
            }
            var localimg = new LocalImageInfo();
            var fileInfo = _fileSystem.GetFileSystemInfo(jpgPath);

            localimg.FileInfo = fileInfo;
            list.Add(localimg);
            return(list);
        }