当前位置: 首页>>代码示例>>C#>>正文


C# IHasImages.IsSaveLocalMetadataEnabled方法代码示例

本文整理汇总了C#中IHasImages.IsSaveLocalMetadataEnabled方法的典型用法代码示例。如果您正苦于以下问题:C# IHasImages.IsSaveLocalMetadataEnabled方法的具体用法?C# IHasImages.IsSaveLocalMetadataEnabled怎么用?C# IHasImages.IsSaveLocalMetadataEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IHasImages的用法示例。


在下文中一共展示了IHasImages.IsSaveLocalMetadataEnabled方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Supports

        public bool Supports(IHasImages item)
        {
            if (item is Photo)
            {
                return false;
            }

            if (!item.IsSaveLocalMetadataEnabled())
            {
                return true;
            }

            // Extracted images will be saved in here
            if (item is Audio)
            {
                return true;
            }

            if (item.SupportsLocalMetadata && !item.AlwaysScanInternalMetadataPath)
            {
                return false;
            }

            return true;
        }
开发者ID:rezafouladian,项目名称:Emby,代码行数:25,代码来源:InternalMetadataFolderImageProvider.cs

示例2: Supports

        public bool Supports(IHasImages item)
        {
            if (!item.IsSaveLocalMetadataEnabled())
            {
                return true;
            }

            // Extracted images will be saved in here
            if (item is Audio)
            {
                return true;
            }

            if (item.SupportsLocalMetadata)
            {
                return false;
            }
            
            return true;
        }
开发者ID:Rycius,项目名称:MediaBrowser,代码行数:20,代码来源:InternalMetadataFolderImageProvider.cs

示例3: SaveImage

        public async Task SaveImage(IHasImages item, Stream source, string mimeType, ImageType type, int? imageIndex, string internalCacheKey, CancellationToken cancellationToken)
        {
            if (string.IsNullOrEmpty(mimeType))
            {
                throw new ArgumentNullException("mimeType");
            }

            var saveLocally = item.SupportsLocalMetadata && item.IsSaveLocalMetadataEnabled() && !item.IsOwnedItem && !(item is Audio);

            if (item is User)
            {
                saveLocally = true;
            }

            if (type != ImageType.Primary && item is Episode)
            {
                saveLocally = false;
            }

            var locationType = item.LocationType;
            if (locationType == LocationType.Remote || locationType == LocationType.Virtual)
            {
                saveLocally = false;

                var season = item as Season;

                // If season is virtual under a physical series, save locally if using compatible convention
                if (season != null && _config.Configuration.ImageSavingConvention == ImageSavingConvention.Compatible)
                {
                    var series = season.Series;

                    if (series != null && series.SupportsLocalMetadata && series.IsSaveLocalMetadataEnabled())
                    {
                        saveLocally = true;
                    }
                }
            }
            if (!string.IsNullOrEmpty(internalCacheKey))
            {
                saveLocally = false;
            }

            if (!imageIndex.HasValue && item.AllowsMultipleImages(type))
            {
                imageIndex = item.GetImages(type).Count();
            }

            var index = imageIndex ?? 0;

            var paths = GetSavePaths(item, type, imageIndex, mimeType, saveLocally);

            var retryPaths = GetSavePaths(item, type, imageIndex, mimeType, false);

            // If there are more than one output paths, the stream will need to be seekable
            var memoryStream = new MemoryStream();
            using (source)
            {
                await source.CopyToAsync(memoryStream).ConfigureAwait(false);
            }

            source = memoryStream;

            var currentImage = GetCurrentImage(item, type, index);
            var savedPaths = new List<string>();

            using (source)
            {
                var currentPathIndex = 0;

                foreach (var path in paths)
                {
                    source.Position = 0;
                    string retryPath = null;
                    if (paths.Length == retryPaths.Length)
                    {
                        retryPath = retryPaths[currentPathIndex];
                    }
                    var savedPath = await SaveImageToLocation(source, path, retryPath, cancellationToken).ConfigureAwait(false);
                    savedPaths.Add(savedPath);
                    currentPathIndex++;
                }
            }

            // Set the path into the item
            SetImagePath(item, type, imageIndex, savedPaths[0]);

            // Delete the current path
            if (currentImage != null && currentImage.IsLocalFile && !savedPaths.Contains(currentImage.Path, StringComparer.OrdinalIgnoreCase))
            {
                var currentPath = currentImage.Path;

                _libraryMonitor.ReportFileSystemChangeBeginning(currentPath);

                try
                {
                    var currentFile = new FileInfo(currentPath);

                    // This will fail if the file is hidden
                    if (currentFile.Exists)
                    {
//.........这里部分代码省略.........
开发者ID:loose-wardrobe,项目名称:Emby,代码行数:101,代码来源:ImageSaver.cs

示例4: EnableImageStub

        private bool EnableImageStub(IHasImages item, ImageType type, LibraryOptions libraryOptions)
        {
            if (item is LiveTvProgram)
            {
                return true;
            }

            if (libraryOptions.DownloadImagesInAdvance)
            {
                return false;
            }

            if (item.LocationType == LocationType.Remote || item.LocationType == LocationType.Virtual)
            {
                return true;
            }

            if (!item.IsSaveLocalMetadataEnabled())
            {
                return true;
            }

            if (item is IItemByName && !(item is MusicArtist))
            {
                var hasDualAccess = item as IHasDualAccess;
                if (hasDualAccess == null || hasDualAccess.IsAccessedByName)
                {
                    return true;
                }
            }

            switch (type)
            {
                case ImageType.Primary:
                    return false;
                case ImageType.Thumb:
                    return false;
                default:
                    return true;
            }
        }
开发者ID:t-andre,项目名称:Emby,代码行数:41,代码来源:ItemImageProvider.cs

示例5: EnableImageStub

        private bool EnableImageStub(IHasImages item, ImageType type)
        {
            if (item.LocationType == LocationType.Remote || item.LocationType == LocationType.Virtual)
            {
                return true;
            }

            if (!item.IsSaveLocalMetadataEnabled())
            {
                return true;
            }

            if (item is IItemByName && !(item is MusicArtist))
            {
                var hasDualAccess = item as IHasDualAccess;
                if (hasDualAccess == null || hasDualAccess.IsAccessedByName)
                {
                    return true;
                }
            }

            switch (type)
            {
                case ImageType.Primary:
                    return false;
                case ImageType.Thumb:
                    return false;
                case ImageType.Logo:
                    return false;
                case ImageType.Backdrop:
                    return false;
                case ImageType.Screenshot:
                    return false;
                default:
                    return true;
            }
        }
开发者ID:KoetseJ,项目名称:Emby,代码行数:37,代码来源:ItemImageProvider.cs


注:本文中的IHasImages.IsSaveLocalMetadataEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。