diff --git a/MediaBrowser.Common/Serialization/ProtobufSerializer.cs b/MediaBrowser.Common/Serialization/ProtobufSerializer.cs
index 9737c9b59d..701ef70298 100644
--- a/MediaBrowser.Common/Serialization/ProtobufSerializer.cs
+++ b/MediaBrowser.Common/Serialization/ProtobufSerializer.cs
@@ -1,12 +1,11 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.IO;
+using System.IO;
namespace MediaBrowser.Common.Serialization
{
+ ///
+ /// Protocol buffers is google's binary serialization format. This is a .NET implementation of it.
+ /// You have to tag your classes with some annoying attributes, but in return you get the fastest serialization around with the smallest possible output.
+ ///
public static class ProtobufSerializer
{
public static void SerializeToStream(T obj, Stream stream)
diff --git a/MediaBrowser.Controller/Kernel.cs b/MediaBrowser.Controller/Kernel.cs
index 356e9e1e2f..fa650e53fe 100644
--- a/MediaBrowser.Controller/Kernel.cs
+++ b/MediaBrowser.Controller/Kernel.cs
@@ -76,7 +76,7 @@ namespace MediaBrowser.Controller
ReloadUsers();
progress.Report(new TaskProgress() { Description = "Loading Media Library", PercentComplete = 25 });
- await ReloadRoot().ConfigureAwait(false);
+ await ReloadRoot(allowInternetProviders: false).ConfigureAwait(false);
progress.Report(new TaskProgress() { Description = "Loading Complete", PercentComplete = 100 });
}
@@ -140,7 +140,7 @@ namespace MediaBrowser.Controller
///
/// Reloads the root media folder
///
- public async Task ReloadRoot()
+ public async Task ReloadRoot(bool allowInternetProviders = true)
{
if (!Directory.Exists(MediaRootFolderPath))
{
@@ -149,7 +149,7 @@ namespace MediaBrowser.Controller
DirectoryWatchers.Stop();
- RootFolder = await ItemController.GetItem(MediaRootFolderPath).ConfigureAwait(false) as Folder;
+ RootFolder = await ItemController.GetItem(MediaRootFolderPath, allowInternetProviders: allowInternetProviders).ConfigureAwait(false) as Folder;
DirectoryWatchers.Start();
}
@@ -226,7 +226,7 @@ namespace MediaBrowser.Controller
///
/// Runs all metadata providers for an entity
///
- internal async Task ExecuteMetadataProviders(BaseEntity item, ItemResolveEventArgs args)
+ internal async Task ExecuteMetadataProviders(BaseEntity item, ItemResolveEventArgs args, bool allowInternetProviders = true)
{
// Get all supported providers
BaseMetadataProvider[] supportedProviders = Kernel.Instance.MetadataProviders.Where(i => i.Supports(item)).ToArray();
@@ -236,7 +236,7 @@ namespace MediaBrowser.Controller
{
var provider = supportedProviders[i];
- if (provider.RequiresInternet && !Configuration.EnableInternetProviders)
+ if (provider.RequiresInternet && (!Configuration.EnableInternetProviders || !allowInternetProviders))
{
continue;
}
diff --git a/MediaBrowser.Controller/Library/ItemController.cs b/MediaBrowser.Controller/Library/ItemController.cs
index 94fcf1f441..df7cf88100 100644
--- a/MediaBrowser.Controller/Library/ItemController.cs
+++ b/MediaBrowser.Controller/Library/ItemController.cs
@@ -67,7 +67,7 @@ namespace MediaBrowser.Controller.Library
///
/// Resolves a path into a BaseItem
///
- public async Task GetItem(string path, Folder parent = null, WIN32_FIND_DATA? fileInfo = null)
+ public async Task GetItem(string path, Folder parent = null, WIN32_FIND_DATA? fileInfo = null, bool allowInternetProviders = true)
{
ItemResolveEventArgs args = new ItemResolveEventArgs()
{
@@ -109,12 +109,12 @@ namespace MediaBrowser.Controller.Library
if (item != null)
{
- await Kernel.Instance.ExecuteMetadataProviders(item, args).ConfigureAwait(false);
+ await Kernel.Instance.ExecuteMetadataProviders(item, args, allowInternetProviders: allowInternetProviders).ConfigureAwait(false);
if (item.IsFolder)
{
// If it's a folder look for child entities
- (item as Folder).Children = (await Task.WhenAll(GetChildren(item as Folder, fileSystemChildren)).ConfigureAwait(false))
+ (item as Folder).Children = (await Task.WhenAll(GetChildren(item as Folder, fileSystemChildren, allowInternetProviders)).ConfigureAwait(false))
.Where(i => i != null).OrderBy(f =>
{
return string.IsNullOrEmpty(f.SortName) ? f.Name : f.SortName;
@@ -129,7 +129,7 @@ namespace MediaBrowser.Controller.Library
///
/// Finds child BaseItems for a given Folder
///
- private Task[] GetChildren(Folder folder, WIN32_FIND_DATA[] fileSystemChildren)
+ private Task[] GetChildren(Folder folder, WIN32_FIND_DATA[] fileSystemChildren, bool allowInternetProviders)
{
Task[] tasks = new Task[fileSystemChildren.Length];
@@ -137,7 +137,7 @@ namespace MediaBrowser.Controller.Library
{
var child = fileSystemChildren[i];
- tasks[i] = GetItem(child.Path, folder, child);
+ tasks[i] = GetItem(child.Path, folder, child, allowInternetProviders: allowInternetProviders);
}
return tasks;
diff --git a/MediaBrowser.Controller/Providers/VideoInfoProvider.cs b/MediaBrowser.Controller/Providers/VideoInfoProvider.cs
index a4059f9da3..2f8175b7e2 100644
--- a/MediaBrowser.Controller/Providers/VideoInfoProvider.cs
+++ b/MediaBrowser.Controller/Providers/VideoInfoProvider.cs
@@ -184,6 +184,7 @@ namespace MediaBrowser.Controller.Providers
AudioInfoProvider.EnsureCacheSubFolders(Kernel.Instance.ApplicationPaths.FFProbeVideoCacheDirectory);
+ // This is an optimzation. Do this now so that it doesn't have to be done upon first serialization.
ProtoBuf.Meta.RuntimeTypeModel.Default.Add(typeof(FFProbeResult), true);
ProtoBuf.Meta.RuntimeTypeModel.Default.Add(typeof(MediaStream), true);
ProtoBuf.Meta.RuntimeTypeModel.Default.Add(typeof(MediaFormat), true);
diff --git a/MediaBrowser.TV/Providers/EpisodeProviderFromXml.cs b/MediaBrowser.TV/Providers/EpisodeProviderFromXml.cs
index bab746e4b7..3506e2a515 100644
--- a/MediaBrowser.TV/Providers/EpisodeProviderFromXml.cs
+++ b/MediaBrowser.TV/Providers/EpisodeProviderFromXml.cs
@@ -36,7 +36,7 @@ namespace MediaBrowser.TV.Providers
return FetchMetadata(item as Episode, args.Parent as Season, metadataFile);
}
- private Task FetchMetadata(Episode item, Season season, string metadataFile)
+ private async Task FetchMetadata(Episode item, Season season, string metadataFile)
{
if (season == null)
{
@@ -44,18 +44,18 @@ namespace MediaBrowser.TV.Providers
// Need to validate it the slow way
if (!File.Exists(metadataFile))
{
- return Task.FromResult