Switched all i/o to win32 methods and added protobuf serialization for ffprobe caching

This commit is contained in:
LukePulverenti Luke Pulverenti luke pulverenti
2012-08-23 01:45:26 -04:00
parent 882e364326
commit c80c8c1cfd
22 changed files with 315 additions and 206 deletions

View File

@@ -1,4 +1,5 @@
using System.ComponentModel.Composition;
using System.IO;
using System.Threading.Tasks;
using MediaBrowser.Controller.Events;
using MediaBrowser.Controller.Providers;
@@ -23,11 +24,9 @@ namespace MediaBrowser.TV.Providers
public override Task FetchAsync(BaseEntity item, ItemResolveEventArgs args)
{
var metadataFile = args.GetFileSystemEntryByName("series.xml");
if (metadataFile.HasValue)
if (args.ContainsFile("series.xml"))
{
return Task.Run(() => { new SeriesXmlParser().Fetch(item as Series, metadataFile.Value.Path); });
return Task.Run(() => { new SeriesXmlParser().Fetch(item as Series, Path.Combine(args.Path, "series.xml")); });
}
return Task.FromResult<object>(null);

View File

@@ -20,9 +20,7 @@ namespace MediaBrowser.TV.Resolvers
return null;
}
var metadataFile = args.GetFileSystemEntryByName("series.xml");
if (metadataFile.HasValue || Path.GetFileName(args.Path).IndexOf("[tvdbid=", StringComparison.OrdinalIgnoreCase) != -1 || TVUtils.IsSeriesFolder(args.Path, args.FileSystemChildren))
if (args.ContainsFile("series.xml") || Path.GetFileName(args.Path).IndexOf("[tvdbid=", StringComparison.OrdinalIgnoreCase) != -1 || TVUtils.IsSeriesFolder(args.Path, args.FileSystemChildren))
{
return new Series();
}

View File

@@ -51,13 +51,13 @@ namespace MediaBrowser.TV
return seasonPathExpressions.Any(r => r.IsMatch(path));
}
public static bool IsSeriesFolder(string path, LazyFileInfo[] fileSystemChildren)
public static bool IsSeriesFolder(string path, WIN32_FIND_DATA[] fileSystemChildren)
{
for (int i = 0; i < fileSystemChildren.Length; i++)
{
var child = fileSystemChildren[i];
if (child.FileInfo.IsDirectory)
if (child.IsDirectory)
{
if (IsSeasonFolder(child.Path))
{