本文整理汇总了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;
}
示例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;
}
示例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)
{
//.........这里部分代码省略.........
示例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;
}
}
示例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;
}
}