diff --git a/MediaBrowser.Api/HttpHandlers/GenreHandler.cs b/MediaBrowser.Api/HttpHandlers/GenreHandler.cs index c2b70e106..eeadf1e45 100644 --- a/MediaBrowser.Api/HttpHandlers/GenreHandler.cs +++ b/MediaBrowser.Api/HttpHandlers/GenreHandler.cs @@ -12,7 +12,7 @@ namespace MediaBrowser.Api.HttpHandlers /// /// Gets a single genre /// - public class GenreHandler : BaseJsonHandler + public class GenreHandler : BaseSerializationHandler { protected override Task GetObjectToSerialize() { diff --git a/MediaBrowser.Api/HttpHandlers/GenresHandler.cs b/MediaBrowser.Api/HttpHandlers/GenresHandler.cs index 3280c3e32..8452bae3d 100644 --- a/MediaBrowser.Api/HttpHandlers/GenresHandler.cs +++ b/MediaBrowser.Api/HttpHandlers/GenresHandler.cs @@ -9,7 +9,7 @@ using MediaBrowser.Model.Entities; namespace MediaBrowser.Api.HttpHandlers { - public class GenresHandler : BaseJsonHandler> + public class GenresHandler : BaseSerializationHandler> { protected override Task> GetObjectToSerialize() { diff --git a/MediaBrowser.Api/HttpHandlers/ItemHandler.cs b/MediaBrowser.Api/HttpHandlers/ItemHandler.cs index 4f2a9c68e..35310f042 100644 --- a/MediaBrowser.Api/HttpHandlers/ItemHandler.cs +++ b/MediaBrowser.Api/HttpHandlers/ItemHandler.cs @@ -8,7 +8,7 @@ using MediaBrowser.Model.Entities; namespace MediaBrowser.Api.HttpHandlers { - public class ItemHandler : BaseJsonHandler + public class ItemHandler : BaseSerializationHandler { protected override Task GetObjectToSerialize() { diff --git a/MediaBrowser.Api/HttpHandlers/ItemListHandler.cs b/MediaBrowser.Api/HttpHandlers/ItemListHandler.cs index 9d5e3eb58..09814b191 100644 --- a/MediaBrowser.Api/HttpHandlers/ItemListHandler.cs +++ b/MediaBrowser.Api/HttpHandlers/ItemListHandler.cs @@ -9,7 +9,7 @@ using MediaBrowser.Model.Entities; namespace MediaBrowser.Api.HttpHandlers { - public class ItemListHandler : BaseJsonHandler + public class ItemListHandler : BaseSerializationHandler { protected override Task GetObjectToSerialize() { diff --git a/MediaBrowser.Api/HttpHandlers/PersonHandler.cs b/MediaBrowser.Api/HttpHandlers/PersonHandler.cs index 3c34efae5..0d496c240 100644 --- a/MediaBrowser.Api/HttpHandlers/PersonHandler.cs +++ b/MediaBrowser.Api/HttpHandlers/PersonHandler.cs @@ -12,7 +12,7 @@ namespace MediaBrowser.Api.HttpHandlers /// /// Gets a single Person /// - public class PersonHandler : BaseJsonHandler + public class PersonHandler : BaseSerializationHandler { protected override Task GetObjectToSerialize() { diff --git a/MediaBrowser.Api/HttpHandlers/PluginConfigurationHandler.cs b/MediaBrowser.Api/HttpHandlers/PluginConfigurationHandler.cs index fbc16109d..6abfb9b2d 100644 --- a/MediaBrowser.Api/HttpHandlers/PluginConfigurationHandler.cs +++ b/MediaBrowser.Api/HttpHandlers/PluginConfigurationHandler.cs @@ -7,7 +7,7 @@ using MediaBrowser.Model.Plugins; namespace MediaBrowser.Api.HttpHandlers { - public class PluginConfigurationHandler : BaseJsonHandler + public class PluginConfigurationHandler : BaseSerializationHandler { protected override Task GetObjectToSerialize() { diff --git a/MediaBrowser.Api/HttpHandlers/PluginsHandler.cs b/MediaBrowser.Api/HttpHandlers/PluginsHandler.cs index 1cb4e95f7..67246cbc6 100644 --- a/MediaBrowser.Api/HttpHandlers/PluginsHandler.cs +++ b/MediaBrowser.Api/HttpHandlers/PluginsHandler.cs @@ -10,7 +10,7 @@ namespace MediaBrowser.Api.HttpHandlers /// /// Provides information about installed plugins /// - public class PluginsHandler : BaseJsonHandler> + public class PluginsHandler : BaseSerializationHandler> { protected override Task> GetObjectToSerialize() { diff --git a/MediaBrowser.Api/HttpHandlers/StudioHandler.cs b/MediaBrowser.Api/HttpHandlers/StudioHandler.cs index af7e7fed0..458dd9da1 100644 --- a/MediaBrowser.Api/HttpHandlers/StudioHandler.cs +++ b/MediaBrowser.Api/HttpHandlers/StudioHandler.cs @@ -12,7 +12,7 @@ namespace MediaBrowser.Api.HttpHandlers /// /// Gets a single studio /// - public class StudioHandler : BaseJsonHandler + public class StudioHandler : BaseSerializationHandler { protected override Task GetObjectToSerialize() { diff --git a/MediaBrowser.Api/HttpHandlers/StudiosHandler.cs b/MediaBrowser.Api/HttpHandlers/StudiosHandler.cs index 64348ac89..0f1e087fe 100644 --- a/MediaBrowser.Api/HttpHandlers/StudiosHandler.cs +++ b/MediaBrowser.Api/HttpHandlers/StudiosHandler.cs @@ -9,7 +9,7 @@ using MediaBrowser.Model.Entities; namespace MediaBrowser.Api.HttpHandlers { - public class StudiosHandler : BaseJsonHandler> + public class StudiosHandler : BaseSerializationHandler> { protected override Task> GetObjectToSerialize() { diff --git a/MediaBrowser.Api/HttpHandlers/UsersHandler.cs b/MediaBrowser.Api/HttpHandlers/UsersHandler.cs index ad9ffec98..1c7ea6b27 100644 --- a/MediaBrowser.Api/HttpHandlers/UsersHandler.cs +++ b/MediaBrowser.Api/HttpHandlers/UsersHandler.cs @@ -6,7 +6,7 @@ using MediaBrowser.Model.Entities; namespace MediaBrowser.Api.HttpHandlers { - class UsersHandler : BaseJsonHandler> + class UsersHandler : BaseSerializationHandler> { protected override Task> GetObjectToSerialize() { diff --git a/MediaBrowser.Api/HttpHandlers/YearHandler.cs b/MediaBrowser.Api/HttpHandlers/YearHandler.cs index 0eb674e27..1b0c7f670 100644 --- a/MediaBrowser.Api/HttpHandlers/YearHandler.cs +++ b/MediaBrowser.Api/HttpHandlers/YearHandler.cs @@ -12,7 +12,7 @@ namespace MediaBrowser.Api.HttpHandlers /// /// Gets a single year /// - public class YearHandler : BaseJsonHandler + public class YearHandler : BaseSerializationHandler { protected override Task GetObjectToSerialize() { diff --git a/MediaBrowser.Api/HttpHandlers/YearsHandler.cs b/MediaBrowser.Api/HttpHandlers/YearsHandler.cs index ee07ac8b0..449be7c5e 100644 --- a/MediaBrowser.Api/HttpHandlers/YearsHandler.cs +++ b/MediaBrowser.Api/HttpHandlers/YearsHandler.cs @@ -9,7 +9,7 @@ using MediaBrowser.Model.Entities; namespace MediaBrowser.Api.HttpHandlers { - public class YearsHandler : BaseJsonHandler> + public class YearsHandler : BaseSerializationHandler> { protected override Task> GetObjectToSerialize() { diff --git a/MediaBrowser.Common/Net/Handlers/BaseSerializationHandler.cs b/MediaBrowser.Common/Net/Handlers/BaseSerializationHandler.cs index 4229dce61..a0696d4a6 100644 --- a/MediaBrowser.Common/Net/Handlers/BaseSerializationHandler.cs +++ b/MediaBrowser.Common/Net/Handlers/BaseSerializationHandler.cs @@ -1,11 +1,11 @@ -using System.IO; +using System; +using System.IO; using System.Threading.Tasks; using MediaBrowser.Common.Serialization; -using System; namespace MediaBrowser.Common.Net.Handlers { - public abstract class BaseJsonHandler : BaseHandler + public abstract class BaseSerializationHandler : BaseHandler { public SerializationFormat SerializationFormat { @@ -28,6 +28,8 @@ namespace MediaBrowser.Common.Net.Handlers { case Handlers.SerializationFormat.Jsv: return Task.FromResult("text/plain"); + case Handlers.SerializationFormat.Protobuf: + return Task.FromResult("application/x-protobuf"); default: return Task.FromResult(MimeTypes.JsonMimeType); } @@ -67,6 +69,9 @@ namespace MediaBrowser.Common.Net.Handlers case Handlers.SerializationFormat.Jsv: JsvSerializer.SerializeToStream(_ObjectToSerialize, stream); break; + case Handlers.SerializationFormat.Protobuf: + ProtobufSerializer.SerializeToStream(_ObjectToSerialize, stream); + break; default: JsonSerializer.SerializeToStream(_ObjectToSerialize, stream); break; @@ -77,7 +82,8 @@ namespace MediaBrowser.Common.Net.Handlers public enum SerializationFormat { Json, - Jsv + Jsv, + Protobuf } }