本文整理汇总了C#中IResourceAccessor类的典型用法代码示例。如果您正苦于以下问题:C# IResourceAccessor类的具体用法?C# IResourceAccessor怎么用?C# IResourceAccessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IResourceAccessor类属于命名空间,在下文中一共展示了IResourceAccessor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: MountingDataProxy
/// <summary>
/// Creates a new instance of this class which is based on the given <paramref name="baseAccessor"/>.
/// </summary>
/// <param name="key">Key which is used for this instance.</param>
/// <param name="baseAccessor">Resource accessor denoting a filesystem resource.</param>
public MountingDataProxy(string key, IResourceAccessor baseAccessor)
{
_key = key;
_baseAccessor = baseAccessor;
if (!MountResource())
throw new EnvironmentException("Cannot mount resource '{0}' to local file system", baseAccessor);
}
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:12,代码来源:MountingDataProxy.cs
示例2: TryExtractMetadata
public override bool TryExtractMetadata(IResourceAccessor mediaItemAccessor, IDictionary<Guid, MediaItemAspect> extractedAspectData, bool forceQuickMode)
{
try
{
IResourceAccessor metaFileAccessor;
if (!CanExtract(mediaItemAccessor, extractedAspectData, out metaFileAccessor)) return false;
Argus.Recording recording;
using (metaFileAccessor)
{
using (Stream metaStream = ((IFileSystemResourceAccessor)metaFileAccessor).OpenRead())
recording = (Argus.Recording)GetTagsXmlSerializer().Deserialize(metaStream);
}
// Handle series information
SeriesInfo seriesInfo = GetSeriesFromTags(recording);
if (seriesInfo.IsCompleteMatch)
{
if (!forceQuickMode)
SeriesTvDbMatcher.Instance.FindAndUpdateSeries(seriesInfo);
seriesInfo.SetMetadata(extractedAspectData);
}
return true;
}
catch (Exception e)
{
// Only log at the info level here - And simply return false. This lets the caller know that we
// couldn't perform our task here.
ServiceRegistration.Get<ILogger>().Info("ArgusRecordingSeriesMetadataExtractor: Exception reading resource '{0}' (Text: '{1}')", mediaItemAccessor.CanonicalLocalResourcePath, e.Message);
}
return false;
}
开发者ID:aspik,项目名称:MediaPortal-2,代码行数:33,代码来源:ArgusRecordingMetadataExtractor.cs
示例3: TryCreateResourceAccessor
public bool TryCreateResourceAccessor(string path, out IResourceAccessor result)
{
// TODO: support different ResourceAccessors for either local files (single seat) or network streams (multi seat). Current implementation always uses
// network streams, even in single seat.
result = SlimTvResourceAccessor.GetResourceAccessor(path);
return result != null;
}
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:7,代码来源:SlimTvResourceProvider.cs
示例4: ResourceAccessorTextureImageSource
/// <summary>
/// Constructs a <see cref="ResourceAccessorTextureImageSource"/> for the given data.
/// </summary>
/// <param name="resourceAccessor">The resource accessor to load the texture data from.</param>
/// <param name="rotation">Desired rotation for the given image.</param>
public ResourceAccessorTextureImageSource(IResourceAccessor resourceAccessor, RightAngledRotation rotation)
{
_key = resourceAccessor.CanonicalLocalResourcePath.Serialize();
_resourceAccessor = resourceAccessor;
_stream = _resourceAccessor.OpenRead();
_rotation = rotation;
}
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:12,代码来源:ResourceAccessorTextureImageSource.cs
示例5: Load
/// <summary>
/// Sets the font manager up with the specified <paramref name="resourcesCollection"/>.
/// This method will load the font defaults (family and size) and the font files from the
/// resource collection.
/// </summary>
public static void Load(IResourceAccessor resourcesCollection)
{
Unload();
string defaultFontFilePath = resourcesCollection.GetResourceFilePath(
SkinResources.FONTS_DIRECTORY + Path.DirectorySeparatorChar + DEFAULT_FONT_FILE);
XPathDocument doc = new XPathDocument(defaultFontFilePath);
XPathNavigator nav = doc.CreateNavigator();
nav.MoveToChild(XPathNodeType.Element);
_defaultFontFamily = nav.GetAttribute("FontFamily", string.Empty);
string defaultFontSize = nav.GetAttribute("FontSize", string.Empty);
_defaultFontSize = int.Parse(defaultFontSize);
// Iterate over font family descriptors
foreach (string descriptorFilePath in resourcesCollection.GetResourceFilePaths(
"^" + SkinResources.FONTS_DIRECTORY + "\\\\.*\\.desc$").Values)
{
doc = new XPathDocument(descriptorFilePath);
nav = doc.CreateNavigator();
nav.MoveToChild(XPathNodeType.Element);
string familyName = nav.GetAttribute("Name", string.Empty);
if (string.IsNullOrEmpty(familyName))
throw new ArgumentException("FontManager: Failed to parse family name for font descriptor file '{0}'", descriptorFilePath);
string ttfFile = nav.GetAttribute("Ttf", string.Empty);
if (string.IsNullOrEmpty(ttfFile))
throw new ArgumentException("FontManager: Failed to parse ttf name for font descriptor file '{0}'", descriptorFilePath);
string fontFilePath = resourcesCollection.GetResourceFilePath(
SkinResources.FONTS_DIRECTORY + Path.DirectorySeparatorChar + ttfFile);
FontFamily family = new FontFamily(familyName, fontFilePath);
_families[familyName] = family;
}
}
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:39,代码来源:FontManager.cs
示例6: TryCreateResourceAccessor
public bool TryCreateResourceAccessor(string path, out IResourceAccessor result)
{
result = null;
if (!IsResource(path))
return false;
result = new RawUrlResourceAccessor(path);
return true;
}
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:9,代码来源:RawUrlResourceProvider.cs
示例7: TryCreateResourceAccessor
public bool TryCreateResourceAccessor(string path, out IResourceAccessor result)
{
if (!IsResource(path))
{
result = null;
return false;
}
result = new NetworkNeighborhoodResourceAccessor(this, path);
return true;
}
开发者ID:jgauffin,项目名称:MediaPortal-2,代码行数:10,代码来源:NetworkNeighborhoodResourceProvider.cs
示例8: AddSourceFilterOverride
public static void AddSourceFilterOverride(Action fallbackAction, IResourceAccessor resourceAccessor, IGraphBuilder graphBuilder)
{
string sourceFilterName = GetSourceFilterName(resourceAccessor.ResourcePathName);
if (string.IsNullOrEmpty(sourceFilterName))
{
fallbackAction();
}
else
{
AddStreamSourceFilter(sourceFilterName, resourceAccessor, graphBuilder);
}
}
开发者ID:aspik,项目名称:MediaPortal-2,代码行数:12,代码来源:PlayerHelpers.cs
示例9: ZipResourceProxy
public ZipResourceProxy(string key, IResourceAccessor zipFileAccessor)
{
_key = key;
_zipFileResourceAccessor = zipFileAccessor;
_zipFileStream = _zipFileResourceAccessor.OpenRead(); // Not sure if the ZipFile closes the stream appropriately, so we keep a reference to it
try
{
_zipFile = new ZipFile(_zipFileStream);
}
catch
{
_zipFileStream.Dispose();
throw;
}
}
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:15,代码来源:ZipResourceProxy.cs
示例10: IsoResourceProxy
public IsoResourceProxy(string key, IResourceAccessor isoFileResourceAccessor)
{
_key = key;
_isoFileResourceAccessor = isoFileResourceAccessor;
_underlayingStream = _isoFileResourceAccessor.OpenRead();
try
{
_diskFileSystem = GetFileSystem(_underlayingStream);
}
catch
{
_underlayingStream.Dispose();
throw;
}
}
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:16,代码来源:IsoResourceProxy.cs
示例11: ConnectFile
public static bool ConnectFile(string nativeSystemId, ResourcePath nativeResourcePath, out IResourceAccessor result)
{
IRemoteResourceInformationService rris = ServiceRegistration.Get<IRemoteResourceInformationService>();
result = null;
bool isFileSystemResource;
bool isFile;
string resourcePathName;
string resourceName;
DateTime lastChanged;
long size;
if (!rris.GetResourceInformation(nativeSystemId, nativeResourcePath,
out isFileSystemResource, out isFile, out resourcePathName, out resourceName, out lastChanged, out size) ||
!isFile)
return false;
result = new RemoteFileResourceAccessor(nativeSystemId, nativeResourcePath, resourcePathName, resourceName, lastChanged, size);
return true;
}
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:17,代码来源:RemoteFileResourceAccessor.cs
示例12: LocalFsResourceAccessorHelper
/// <summary>
/// Creates a new <see cref="LocalFsResourceAccessor"/> instance. The given <paramref name="mediaItemAccessor"/> will be either directly used or
/// given over to the <see cref="StreamedResourceToLocalFsAccessBridge"/>. The caller must call <see cref="Dispose"/> on the created <see cref="LocalFsResourceAccessorHelper"/>
/// instance but must not dispose the given <paramref name="mediaItemAccessor"/>.
/// </summary>
/// <param name="mediaItemAccessor">IResourceAccessor.</param>
public LocalFsResourceAccessorHelper(IResourceAccessor mediaItemAccessor)
{
_localFsra = mediaItemAccessor as ILocalFsResourceAccessor;
_disposeLfsra = null;
if (_localFsra != null)
return;
IFileSystemResourceAccessor localFsra = (IFileSystemResourceAccessor) mediaItemAccessor.Clone();
try
{
_localFsra = StreamedResourceToLocalFsAccessBridge.GetLocalFsResourceAccessor(localFsra);
_disposeLfsra = _localFsra;
}
catch (Exception)
{
localFsra.Dispose();
throw;
}
}
开发者ID:davinx,项目名称:MediaPortal-2,代码行数:25,代码来源:LocalFsResourceAccessorHelper.cs
示例13: AddStreamSourceFilter
public static void AddStreamSourceFilter(string sourceFilterName, IResourceAccessor resourceAccessor, IGraphBuilder graphBuilder)
{
IBaseFilter sourceFilter = null;
try
{
if (sourceFilterName == Utils.FilterName)
{
var filterPath = FileUtils.BuildAssemblyRelativePath(@"MPUrlSourceSplitter\MPUrlSourceSplitter.ax");
sourceFilter = FilterLoader.LoadFilterFromDll(filterPath, new Guid(Utils.FilterCLSID));
if (sourceFilter != null)
{
graphBuilder.AddFilter(sourceFilter, Utils.FilterName);
}
}
else
{
sourceFilter = FilterGraphTools.AddFilterByName(graphBuilder, FilterCategory.LegacyAmFilterCategory, sourceFilterName);
}
if (sourceFilter == null)
throw new UPnPRendererExceptions(string.Format("Could not create instance of source filter: '{0}'", sourceFilterName));
string url = resourceAccessor.ResourcePathName;
var filterStateEx = sourceFilter as OnlineVideos.MPUrlSourceFilter.IFilterStateEx;
if (filterStateEx != null)
LoadAndWaitForMPUrlSourceFilter(url, filterStateEx);
else
{
var fileSourceFilter = sourceFilter as IFileSourceFilter;
if (fileSourceFilter != null)
Marshal.ThrowExceptionForHR(fileSourceFilter.Load(resourceAccessor.ResourcePathName, null));
else
throw new UPnPRendererExceptions(string.Format("'{0}' does not implement IFileSourceFilter", sourceFilterName));
}
FilterGraphTools.RenderOutputPins(graphBuilder, sourceFilter);
}
finally
{
FilterGraphTools.TryRelease(ref sourceFilter);
}
}
开发者ID:aspik,项目名称:MediaPortal-2,代码行数:43,代码来源:PlayerHelpers.cs
示例14: TryExtractMetadata
public bool TryExtractMetadata(IResourceAccessor mediaItemAccessor, IDictionary<Guid, MediaItemAspect> extractedAspectData, bool forceQuickMode)
{
try
{
if (!(mediaItemAccessor is IFileSystemResourceAccessor))
return false;
using (LocalFsResourceAccessorHelper rah = new LocalFsResourceAccessorHelper(mediaItemAccessor))
{
ILocalFsResourceAccessor lfsra = rah.LocalFsResourceAccessor;
if (!lfsra.IsFile && lfsra.ResourceExists("BDMV"))
{
IFileSystemResourceAccessor fsraBDMV = lfsra.GetResource("BDMV");
if (fsraBDMV != null && fsraBDMV.ResourceExists("index.bdmv"))
{
// This line is important to keep in, if no VideoAspect is created here, the MediaItems is not detected as Video!
MediaItemAspect.GetOrCreateAspect(extractedAspectData, VideoAspect.Metadata);
MediaItemAspect mediaAspect = MediaItemAspect.GetOrCreateAspect(extractedAspectData, MediaAspect.Metadata);
mediaAspect.SetAttribute(MediaAspect.ATTR_MIME_TYPE, "video/bluray"); // BluRay disc
using (lfsra.EnsureLocalFileSystemAccess())
{
BDInfoExt bdinfo = new BDInfoExt(lfsra.LocalFileSystemPath);
string title = bdinfo.GetTitle();
mediaAspect.SetAttribute(MediaAspect.ATTR_TITLE, title ?? mediaItemAccessor.ResourceName);
// Check for BD disc thumbs
FileInfo thumbnail = bdinfo.GetBiggestThumb();
if (thumbnail != null)
{
try
{
using (FileStream fileStream = new FileStream(thumbnail.FullName, FileMode.Open, FileAccess.Read))
using (MemoryStream resized = (MemoryStream)ImageUtilities.ResizeImage(fileStream, ImageFormat.Jpeg, MAX_COVER_WIDTH, MAX_COVER_HEIGHT))
{
MediaItemAspect.SetAttribute(extractedAspectData, ThumbnailLargeAspect.ATTR_THUMBNAIL, resized.ToArray());
}
}
// Decoding of invalid image data can fail, but main MediaItem is correct.
catch
{
}
}
}
return true;
}
}
}
return false;
}
catch
{
// Only log at the info level here - And simply return false. This makes the importer know that we
// couldn't perform our task here
if (mediaItemAccessor != null)
ServiceRegistration.Get<ILogger>().Info("BluRayMetadataExtractor: Exception reading source '{0}'", mediaItemAccessor.ResourcePathName);
return false;
}
}
开发者ID:pacificIT,项目名称:MediaPortal-2,代码行数:60,代码来源:BluRayMetadataExtractor.cs
示例15: TryExtractMetadata
public bool TryExtractMetadata(IResourceAccessor mediaItemAccessor, IDictionary<Guid, MediaItemAspect> extractedAspectData, bool forceQuickMode)
{
try
{
if (forceQuickMode)
return false;
if (!(mediaItemAccessor is IFileSystemResourceAccessor))
return false;
using (LocalFsResourceAccessorHelper rah = new LocalFsResourceAccessorHelper(mediaItemAccessor))
return ExtractThumbnail(rah.LocalFsResourceAccessor, extractedAspectData);
}
catch (Exception e)
{
// Only log at the info level here - And simply return false. This lets the caller know that we
// couldn't perform our task here.
ServiceRegistration.Get<ILogger>().Error("VideoThumbnailer: Exception reading resource '{0}' (Text: '{1}')", e, mediaItemAccessor.CanonicalLocalResourcePath, e.Message);
}
return false;
}
开发者ID:jgauffin,项目名称:MediaPortal-2,代码行数:20,代码来源:VideoThumbnailer.cs
示例16: TryCreateResourceAccessor
public bool TryCreateResourceAccessor(string path, out IResourceAccessor result)
{
char drive;
byte trackNo;
if (TryExtract(path, out drive, out trackNo))
{
result = new AudioCDResourceAccessor(this, drive, trackNo);
return true;
}
result = null;
return false;
}
开发者ID:davinx,项目名称:MediaPortal-2,代码行数:12,代码来源:AudioCDResourceProvider.cs
示例17: CreateLocalMediaItem
public MediaItem CreateLocalMediaItem(IResourceAccessor mediaItemAccessor, IEnumerable<Guid> metadataExtractorIds)
{
ISystemResolver systemResolver = ServiceRegistration.Get<ISystemResolver>();
const bool forceQuickMode = true;
IDictionary<Guid, MediaItemAspect> aspects = ExtractMetadata(mediaItemAccessor, metadataExtractorIds, forceQuickMode);
if (aspects == null)
return null;
MediaItemAspect providerResourceAspect = MediaItemAspect.GetOrCreateAspect(aspects, ProviderResourceAspect.Metadata);
providerResourceAspect.SetAttribute(ProviderResourceAspect.ATTR_SYSTEM_ID, systemResolver.LocalSystemId);
providerResourceAspect.SetAttribute(ProviderResourceAspect.ATTR_RESOURCE_ACCESSOR_PATH, mediaItemAccessor.CanonicalLocalResourcePath.Serialize());
return new MediaItem(Guid.Empty, aspects);
}
开发者ID:davinx,项目名称:MediaPortal-2,代码行数:12,代码来源:MediaAccessor.cs
示例18: ExtractMetadata
public IDictionary<Guid, MediaItemAspect> ExtractMetadata(IResourceAccessor mediaItemAccessor,
IEnumerable<IMetadataExtractor> metadataExtractors, bool forceQuickMode)
{
IDictionary<Guid, MediaItemAspect> result = new Dictionary<Guid, MediaItemAspect>();
bool success = false;
// Execute all metadata extractors in order of their priority
foreach (IMetadataExtractor extractor in metadataExtractors.OrderBy(m => m.Metadata.Priority))
{
try
{
if (extractor.TryExtractMetadata(mediaItemAccessor, result, forceQuickMode))
success = true;
}
catch (Exception e)
{
MetadataExtractorMetadata mem = extractor.Metadata;
ServiceRegistration.Get<ILogger>().Error("MediaAccessor: Error extracting metadata from metadata extractor '{0}' (Id: '{1}')",
e, mem.Name, mem.MetadataExtractorId);
throw;
}
}
return success ? result : null;
}
开发者ID:davinx,项目名称:MediaPortal-2,代码行数:23,代码来源:MediaAccessor.cs
示例19: TryExtractMetadataAsync
/// <summary>
/// Asynchronously tries to extract metadata for the given <param name="mediaItemAccessor"></param>
/// </summary>
/// <param name="mediaItemAccessor">Points to the resource for which we try to extract metadata</param>
/// <param name="extractedAspectData">Dictionary of <see cref="MediaItemAspect"/>s with the extracted metadata</param>
/// <param name="forceQuickMode">If <c>true</c>, nothing is downloaded from the internet</param>
/// <returns><c>true</c> if metadata was found and stored into <param name="extractedAspectData"></param>, else <c>false</c></returns>
private async Task<bool> TryExtractMetadataAsync(IResourceAccessor mediaItemAccessor, IDictionary<Guid, MediaItemAspect> extractedAspectData, bool forceQuickMode)
{
// Get a unique number for this call to TryExtractMetadataAsync. We use this to make reading the debug log easier.
// This MetadataExtractor is called in parallel for multiple MediaItems so that the respective debug log entries
// for one call are not contained one after another in debug log. We therefore prepend this number before every log entry.
var miNumber = Interlocked.Increment(ref _lastMediaItemNumber);
try
{
_debugLogger.Info("[#{0}]: Start extracting metadata for resource '{1}' (forceQuickMode: {2})", miNumber, mediaItemAccessor, forceQuickMode);
// We only extract metadata with this MetadataExtractor, if another MetadataExtractor that was applied before
// has identified this MediaItem as a video and therefore added a VideoAspect.
if (!extractedAspectData.ContainsKey(VideoAspect.ASPECT_ID))
{
_debugLogger.Info("[#{0}]: Cannot extract metadata; this resource is not a video", miNumber);
return false;
}
// This MetadataExtractor only works for MediaItems accessible by an IFileSystemResourceAccessor.
// Otherwise it is not possible to find a nfo-file in the MediaItem's directory.
if (!(mediaItemAccessor is IFileSystemResourceAccessor))
{
_debugLogger.Info("[#{0}]: Cannot extract metadata; mediaItemAccessor is not an IFileSystemResourceAccessor", miNumber);
return false;
}
// Here we try to find an IFileSystemResourceAccessor pointing to the nfo-file.
// If we don't find one, we cannot extract any metadata.
IFileSystemResourceAccessor nfoFsra;
if (!TryGetNfoSResourceAccessor(miNumber, mediaItemAccessor as IFileSystemResourceAccessor, out nfoFsra))
return false;
// Now we (asynchronously) extract the metadata into a stub object.
// If no metadata was found, nothing can be stored in the MediaItemAspects.
var nfoReader = new NfoMovieReader(_debugLogger, miNumber, forceQuickMode, _httpClient, _settings);
using (nfoFsra)
{
if (!await nfoReader.TryReadMetadataAsync(nfoFsra).ConfigureAwait(false))
{
_debugLogger.Warn("[#{0}]: No valid metadata found", miNumber);
return false;
}
}
// Then we store the found metadata in the MediaItemAspects. If we only found metadata that is
// not (yet) supported by our MediaItemAspects, this MetadataExtractor returns false.
if (!nfoReader.TryWriteMetadata(extractedAspectData))
{
_debugLogger.Warn("[#{0}]: No metadata was written into MediaItemsAspects", miNumber);
return false;
}
_debugLogger.Info("[#{0}]: Successfully finished extracting metadata", miNumber);
return true;
}
catch (Exception e)
{
ServiceRegistration.Get<ILogger>().Warn("NfoMovieMetadataExtractor: Exception while extracting metadata for resource '{0}'; enable debug logging for more details.", mediaItemAccessor);
_debugLogger.Error("[#{0}]: Exception while extracting metadata", e, miNumber);
return false;
}
}
开发者ID:pacificIT,项目名称:MediaPortal-2,代码行数:69,代码来源:NfoMovieMetadataExtractor.cs
示例20: TryExtractMetadata
public bool TryExtractMetadata(IResourceAccessor mediaItemAccessor, IDictionary<Guid, MediaItemAspect> extractedAspectData, bool forceQuickMode)
{
try
{
IFileSystemResourceAccessor fsra = mediaItemAccessor as IFileSystemResourceAccessor;
if (fsra == null || !fsra.IsFile)
return false;
string title;
if (!MediaItemAspect.TryGetAttribute(extractedAspectData, MediaAspect.ATTR_TITLE, out title) || string.IsNullOrEmpty(title))
return false;
string filePath = mediaItemAccessor.CanonicalLocalResourcePath.ToString();
string lowerExtension = StringUtils.TrimToEmpty(ProviderPathHelper.GetExtension(filePath)).ToLowerInvariant();
if (lowerExtension != ".ts")
return false;
string metaFilePath = ProviderPathHelper.ChangeExtension(filePath, ".xml");
IResourceAccessor metaFileAccessor;
if (!ResourcePath.Deserialize(metaFilePath).TryCreateLocalResourceAccessor(out metaFileAccessor))
return false;
Tags tags;
using (metaFileAccessor)
{
using (Stream metaStream = ((IFileSystemResourceAccessor) metaFileAccessor).OpenRead())
tags = (Tags) GetTagsXmlSerializer().Deserialize(metaStream);
}
// Handle series information
SeriesInfo seriesInfo = GetSeriesFromTags(tags);
if (seriesInfo.IsCompleteMatch)
{
if (!forceQuickMode)
SeriesTvDbMatcher.Instance.FindAndUpdateSeries(seriesInfo);
seriesInfo.SetMetadata(extractedAspectData);
}
string value;
if (TryGet(tags, TAG_TITLE, out value) && !string.IsNullOrEmpty(value))
MediaItemAspect.SetAttribute(extractedAspectData, MediaAspect.ATTR_TITLE, value);
if (TryGet(tags, TAG_GENRE, out value))
MediaItemAspect.SetCollectionAttribute(extractedAspectData, VideoAspect.ATTR_GENRES, new List<String> { value });
if (TryGet(tags, TAG_PLOT, out value))
{
MediaItemAspect.SetAttribute(extractedAspectData, VideoAspect.ATTR_STORYPLOT, value);
Match yearMatch = _yearMatcher.Match(value);
int guessedYear;
if (int.TryParse(yearMatch.Value, out guessedYear))
MediaItemAspect.SetAttribute(extractedAspectData, MediaAspect.ATTR_RECORDINGTIME, new DateTime(guessedYear, 1, 1));
}
if (TryGet(tags, TAG_CHANNEL, out value))
MediaItemAspect.SetAttribute(extractedAspectData, RecordingAspect.ATTR_CHANNEL, value);
// Recording date formatted: 2011-11-04 20:55
DateTime recordingStart;
DateTime recordingEnd;
if (TryGet(tags, TAG_STARTTIME, out value) && DateTime.TryParse(value, out recordingStart))
MediaItemAspect.SetAttribute(extractedAspectData, RecordingAspect.ATTR_STARTTIME, recordingStart);
if (TryGet(tags, TAG_ENDTIME, out value) && DateTime.TryParse(value, out recordingEnd))
MediaItemAspect.SetAttribute(extractedAspectData, RecordingAspect.ATTR_ENDTIME, recordingEnd);
return true;
}
catch (Exception e)
{
// Only log at the info level here - And simply return false. This lets the caller know that we
// couldn't perform our task here.
ServiceRegistration.Get<ILogger>().Info("Tve3RecordingMetadataExtractor: Exception reading resource '{0}' (Text: '{1}')", mediaItemAccessor.CanonicalLocalResourcePath, e.Message);
}
return false;
}
开发者ID:HAF-Blade,项目名称:MediaPortal-2,代码行数:76,代码来源:Tve3RecordingMetadataExtractor.cs
注:本文中的IResourceAccessor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论