diff options
20 files changed, 47 insertions, 152 deletions
diff --git a/MediaBrowser.Api/HttpHandlers/JsonHandler.cs b/MediaBrowser.Api/HttpHandlers/JsonHandler.cs index a891d7d68..90502a0c5 100644 --- a/MediaBrowser.Api/HttpHandlers/JsonHandler.cs +++ b/MediaBrowser.Api/HttpHandlers/JsonHandler.cs @@ -1,6 +1,7 @@ using System.IO;
-using MediaBrowser.Common.Json;
using MediaBrowser.Common.Net.Handlers;
+using MediaBrowser.Controller;
+using MediaBrowser.Common.Json;
namespace MediaBrowser.Api.HttpHandlers
{
diff --git a/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs b/MediaBrowser.Common/Configuration/BaseApplicationConfiguration.cs index 2511377c1..7ed782bdb 100644 --- a/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs +++ b/MediaBrowser.Common/Configuration/BaseApplicationConfiguration.cs @@ -1,6 +1,6 @@ -using MediaBrowser.Logging;
+using MediaBrowser.Common.Logging;
-namespace MediaBrowser.Model.Configuration
+namespace MediaBrowser.Common.Configuration
{
/// <summary>
/// Serves as a common base class for the Server and UI application Configurations
diff --git a/MediaBrowser.Common/Json/JsonSerializer.cs b/MediaBrowser.Common/Json/JsonSerializer.cs index b7db1d900..8e132c152 100644 --- a/MediaBrowser.Common/Json/JsonSerializer.cs +++ b/MediaBrowser.Common/Json/JsonSerializer.cs @@ -7,15 +7,11 @@ namespace MediaBrowser.Common.Json {
public static void SerializeToStream<T>(T obj, Stream stream)
{
- Configure();
-
ServiceStack.Text.JsonSerializer.SerializeToStream<T>(obj, stream);
}
public static void SerializeToFile<T>(T obj, string file)
{
- Configure();
-
using (StreamWriter streamWriter = new StreamWriter(file))
{
ServiceStack.Text.JsonSerializer.SerializeToWriter<T>(obj, streamWriter);
@@ -24,8 +20,6 @@ namespace MediaBrowser.Common.Json public static object DeserializeFromFile(Type type, string file)
{
- Configure();
-
using (Stream stream = File.OpenRead(file))
{
return ServiceStack.Text.JsonSerializer.DeserializeFromStream(type, stream);
@@ -34,8 +28,6 @@ namespace MediaBrowser.Common.Json public static T DeserializeFromFile<T>(string file)
{
- Configure();
-
using (Stream stream = File.OpenRead(file))
{
return ServiceStack.Text.JsonSerializer.DeserializeFromStream<T>(stream);
@@ -44,19 +36,15 @@ namespace MediaBrowser.Common.Json public static T DeserializeFromStream<T>(Stream stream)
{
- Configure();
-
return ServiceStack.Text.JsonSerializer.DeserializeFromStream<T>(stream);
}
public static T DeserializeFromString<T>(string data)
{
- Configure();
-
return ServiceStack.Text.JsonSerializer.DeserializeFromString<T>(data);
}
- private static void Configure()
+ public static void Configure()
{
ServiceStack.Text.JsConfig.ExcludeTypeInfo = true;
ServiceStack.Text.JsConfig.IncludeNullValues = false;
diff --git a/MediaBrowser.Common/Kernel/BaseKernel.cs b/MediaBrowser.Common/Kernel/BaseKernel.cs index 820d94831..0fdc1f813 100644 --- a/MediaBrowser.Common/Kernel/BaseKernel.cs +++ b/MediaBrowser.Common/Kernel/BaseKernel.cs @@ -6,12 +6,12 @@ using System.Configuration; using System.IO;
using System.Linq;
using System.Reflection;
-using MediaBrowser.Common.Json;
+using MediaBrowser.Common.Configuration;
+using MediaBrowser.Common.Logging;
using MediaBrowser.Common.Net;
using MediaBrowser.Common.Plugins;
-using MediaBrowser.Logging;
-using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Progress;
+using MediaBrowser.Common.Json;
namespace MediaBrowser.Common.Kernel
{
@@ -93,19 +93,21 @@ namespace MediaBrowser.Common.Kernel public virtual void Init(IProgress<TaskProgress> progress)
{
+ JsonSerializer.Configure();
+
ReloadLogger();
ReloadConfiguration();
ReloadHttpServer();
-
+
ReloadComposableParts();
}
private void ReloadLogger()
{
DisposeLogger();
-
+
if (!Directory.Exists(LogDirectoryPath))
{
Directory.CreateDirectory(LogDirectoryPath);
@@ -115,8 +117,8 @@ namespace MediaBrowser.Common.Kernel LogFilePath = Path.Combine(LogDirectoryPath, now.ToString("dMyyyy") + "-" + now.Ticks + ".log");
- FileStream fs = new FileStream(LogFilePath, FileMode.Append, FileAccess.Write, FileShare.Read);
-
+ FileStream fs = new FileStream(LogFilePath, FileMode.Append, FileAccess.Write, FileShare.Read);
+
Logger.LoggerInstance = new StreamLogger(fs);
}
diff --git a/MediaBrowser.Logging/BaseLogger.cs b/MediaBrowser.Common/Logging/BaseLogger.cs index d73b47393..04c3b8097 100644 --- a/MediaBrowser.Logging/BaseLogger.cs +++ b/MediaBrowser.Common/Logging/BaseLogger.cs @@ -2,7 +2,7 @@ using System.Text;
using System.Threading;
-namespace MediaBrowser.Logging
+namespace MediaBrowser.Common.Logging
{
public abstract class BaseLogger : IDisposable
{
diff --git a/MediaBrowser.Logging/LogRow.cs b/MediaBrowser.Common/Logging/LogRow.cs index da699035a..fda714263 100644 --- a/MediaBrowser.Logging/LogRow.cs +++ b/MediaBrowser.Common/Logging/LogRow.cs @@ -1,7 +1,7 @@ using System;
using System.Text;
-namespace MediaBrowser.Logging
+namespace MediaBrowser.Common.Logging
{
public struct LogRow
{
diff --git a/MediaBrowser.Logging/LogSeverity.cs b/MediaBrowser.Common/Logging/LogSeverity.cs index 70c4f6304..2abab1a44 100644 --- a/MediaBrowser.Logging/LogSeverity.cs +++ b/MediaBrowser.Common/Logging/LogSeverity.cs @@ -1,6 +1,6 @@ using System;
-namespace MediaBrowser.Logging
+namespace MediaBrowser.Common.Logging
{
[Flags]
public enum LogSeverity
diff --git a/MediaBrowser.Logging/Logger.cs b/MediaBrowser.Common/Logging/Logger.cs index db46010a4..d1ae9b8f3 100644 --- a/MediaBrowser.Logging/Logger.cs +++ b/MediaBrowser.Common/Logging/Logger.cs @@ -1,6 +1,6 @@ using System;
-namespace MediaBrowser.Logging
+namespace MediaBrowser.Common.Logging
{
public static class Logger
{
diff --git a/MediaBrowser.Logging/StreamLogger.cs b/MediaBrowser.Common/Logging/StreamLogger.cs index c4ad7b80f..058c7e69c 100644 --- a/MediaBrowser.Logging/StreamLogger.cs +++ b/MediaBrowser.Common/Logging/StreamLogger.cs @@ -2,7 +2,7 @@ using System.IO;
using System.Text;
-namespace MediaBrowser.Logging
+namespace MediaBrowser.Common.Logging
{
/// <summary>
/// Provides a Logger that can write to any Stream
@@ -20,7 +20,6 @@ namespace MediaBrowser.Logging protected override void LogEntry(LogRow row)
{
byte[] bytes = new UTF8Encoding().GetBytes(row.ToString() + Environment.NewLine);
-
Stream.Write(bytes, 0, bytes.Length);
Stream.Flush();
}
@@ -28,7 +27,6 @@ namespace MediaBrowser.Logging public override void Dispose()
{
base.Dispose();
-
Stream.Dispose();
}
}
diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj index bf9d17b78..8c8146cdc 100644 --- a/MediaBrowser.Common/MediaBrowser.Common.csproj +++ b/MediaBrowser.Common/MediaBrowser.Common.csproj @@ -48,10 +48,16 @@ <Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Configuration\BaseApplicationConfiguration.cs" />
<Compile Include="Events\GenericItemEventArgs.cs" />
<Compile Include="Json\JsonSerializer.cs" />
<Compile Include="Kernel\BaseKernel.cs" />
<Compile Include="Kernel\KernelContext.cs" />
+ <Compile Include="Logging\BaseLogger.cs" />
+ <Compile Include="Logging\Logger.cs" />
+ <Compile Include="Logging\LogRow.cs" />
+ <Compile Include="Logging\LogSeverity.cs" />
+ <Compile Include="Logging\StreamLogger.cs" />
<Compile Include="Net\CollectionExtensions.cs" />
<Compile Include="Net\Handlers\BaseEmbeddedResourceHandler.cs" />
<Compile Include="Net\Handlers\BaseHandler.cs" />
@@ -67,10 +73,6 @@ <None Include="packages.config" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\MediaBrowser.Logging\MediaBrowser.Logging.csproj">
- <Project>{37032b77-fe2e-4ec5-b7e4-baf634443578}</Project>
- <Name>MediaBrowser.Logging</Name>
- </ProjectReference>
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj">
<Project>{7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b}</Project>
<Name>MediaBrowser.Model</Name>
diff --git a/MediaBrowser.Common/Plugins/BasePlugin.cs b/MediaBrowser.Common/Plugins/BasePlugin.cs index 61ecffc75..98b6120f7 100644 --- a/MediaBrowser.Common/Plugins/BasePlugin.cs +++ b/MediaBrowser.Common/Plugins/BasePlugin.cs @@ -1,8 +1,8 @@ using System;
using System.IO;
-using MediaBrowser.Common.Json;
-using MediaBrowser.Model.Plugins;
using MediaBrowser.Common.Kernel;
+using MediaBrowser.Model.Plugins;
+using MediaBrowser.Common.Json;
namespace MediaBrowser.Common.Plugins
{
@@ -100,19 +100,6 @@ namespace MediaBrowser.Common.Plugins }
}
- public void ReloadConfiguration()
- {
- if (!File.Exists(ConfigurationPath))
- {
- Configuration = Activator.CreateInstance(ConfigurationType) as BasePluginConfiguration;
- }
- else
- {
- Configuration = JsonSerializer.DeserializeFromFile(ConfigurationType, ConfigurationPath) as BasePluginConfiguration;
- Configuration.DateLastModified = File.GetLastWriteTime(ConfigurationPath);
- }
- }
-
/// <summary>
/// Starts the plugin.
/// </summary>
@@ -126,5 +113,18 @@ namespace MediaBrowser.Common.Plugins public virtual void Dispose()
{
}
+
+ public void ReloadConfiguration()
+ {
+ if (!File.Exists(ConfigurationPath))
+ {
+ Configuration = Activator.CreateInstance(ConfigurationType) as BasePluginConfiguration;
+ }
+ else
+ {
+ Configuration = JsonSerializer.DeserializeFromFile(ConfigurationType, ConfigurationPath) as BasePluginConfiguration;
+ Configuration.DateLastModified = File.GetLastWriteTime(ConfigurationPath);
+ }
+ }
}
}
diff --git a/MediaBrowser.Controller/Configuration/ServerConfiguration.cs b/MediaBrowser.Controller/Configuration/ServerConfiguration.cs index e6f794595..56f3a854f 100644 --- a/MediaBrowser.Controller/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Controller/Configuration/ServerConfiguration.cs @@ -1,4 +1,5 @@ using System.Collections.Generic;
+using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.Configuration;
namespace MediaBrowser.Controller.Configuration
diff --git a/MediaBrowser.Controller/UserController.cs b/MediaBrowser.Controller/UserController.cs index 7fac4392e..c53397a31 100644 --- a/MediaBrowser.Controller/UserController.cs +++ b/MediaBrowser.Controller/UserController.cs @@ -1,8 +1,8 @@ using System;
using System.Collections.Generic;
using System.IO;
-using MediaBrowser.Common.Json;
using MediaBrowser.Model.Users;
+using MediaBrowser.Common.Json;
namespace MediaBrowser.Controller
{
diff --git a/MediaBrowser.Controller/Xml/BaseItemXmlParser.cs b/MediaBrowser.Controller/Xml/BaseItemXmlParser.cs index ed8afd5a7..d3a7c3bd7 100644 --- a/MediaBrowser.Controller/Xml/BaseItemXmlParser.cs +++ b/MediaBrowser.Controller/Xml/BaseItemXmlParser.cs @@ -384,14 +384,14 @@ namespace MediaBrowser.Controller.Xml break;
case "Duration":
- item.RunTimeInSeconds = reader.ReadIntSafe() * 60;
+ item.RunTimeInMilliseconds = reader.ReadIntSafe() * 60000;
break;
case "DurationSeconds":
int seconds = reader.ReadIntSafe();
if (seconds > 0)
{
- item.RunTimeInSeconds = seconds;
+ item.RunTimeInMilliseconds = seconds * 1000;
}
break;
diff --git a/MediaBrowser.Logging/MediaBrowser.Logging.csproj b/MediaBrowser.Logging/MediaBrowser.Logging.csproj deleted file mode 100644 index 39840f71f..000000000 --- a/MediaBrowser.Logging/MediaBrowser.Logging.csproj +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{37032B77-FE2E-4EC5-B7E4-BAF634443578}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>MediaBrowser.Logging</RootNamespace>
- <AssemblyName>MediaBrowser.Logging</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <TargetFrameworkProfile>Profile95</TargetFrameworkProfile>
- <FileAlignment>512</FileAlignment>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <!-- A reference to the entire .NET Framework is automatically included -->
- </ItemGroup>
- <ItemGroup>
- <Compile Include="BaseLogger.cs" />
- <Compile Include="Logger.cs" />
- <Compile Include="LogRow.cs" />
- <Compile Include="LogSeverity.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="StreamLogger.cs" />
- </ItemGroup>
- <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
\ No newline at end of file diff --git a/MediaBrowser.Logging/Properties/AssemblyInfo.cs b/MediaBrowser.Logging/Properties/AssemblyInfo.cs deleted file mode 100644 index fa0d3817d..000000000 --- a/MediaBrowser.Logging/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Resources;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("MediaBrowser.Logging")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("MediaBrowser.Logging")]
-[assembly: AssemblyCopyright("Copyright © 2012")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-[assembly: NeutralResourcesLanguage("en")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/MediaBrowser.Model/Entities/BaseItem.cs b/MediaBrowser.Model/Entities/BaseItem.cs index 8a1ded03b..6f346a1dd 100644 --- a/MediaBrowser.Model/Entities/BaseItem.cs +++ b/MediaBrowser.Model/Entities/BaseItem.cs @@ -51,7 +51,7 @@ namespace MediaBrowser.Model.Entities public string DisplayMediaType { get; set; }
public float? UserRating { get; set; }
- public int? RunTimeInSeconds { get; set; }
+ public int? RunTimeInMilliseconds { get; set; }
public string AspectRatio { get; set; }
public int? ProductionYear { get; set; }
diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index 0157fcbf8..9485692d4 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -10,7 +10,7 @@ <RootNamespace>MediaBrowser.Model</RootNamespace>
<AssemblyName>MediaBrowser.Model</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <TargetFrameworkProfile>Profile95</TargetFrameworkProfile>
+ <TargetFrameworkProfile>Profile4</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
@@ -32,14 +32,6 @@ <WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
- <!-- A reference to the entire .NET Framework is automatically included -->
- <ProjectReference Include="..\MediaBrowser.Logging\MediaBrowser.Logging.csproj">
- <Project>{37032b77-fe2e-4ec5-b7e4-baf634443578}</Project>
- <Name>MediaBrowser.Logging</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Configuration\BaseApplicationConfiguration.cs" />
<Compile Include="Configuration\UserConfiguration.cs" />
<Compile Include="Entities\ApiBaseItem.cs" />
<Compile Include="Entities\Audio.cs" />
diff --git a/MediaBrowser.TV/Metadata/SeriesXmlParser.cs b/MediaBrowser.TV/Metadata/SeriesXmlParser.cs index d36e7ff4b..ecee288cc 100644 --- a/MediaBrowser.TV/Metadata/SeriesXmlParser.cs +++ b/MediaBrowser.TV/Metadata/SeriesXmlParser.cs @@ -66,7 +66,7 @@ namespace MediaBrowser.TV.Metadata int runtime;
if (int.TryParse(text.Split(' ')[0], out runtime))
{
- item.RunTimeInSeconds = runtime * 60;
+ item.RunTimeInMilliseconds = runtime * 60000;
}
}
break;
diff --git a/MediaBrowser.sln b/MediaBrowser.sln index bebbc61af..6f94baf31 100644 --- a/MediaBrowser.sln +++ b/MediaBrowser.sln @@ -21,8 +21,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Common", "Medi EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Model", "MediaBrowser.Model\MediaBrowser.Model.csproj", "{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Logging", "MediaBrowser.Logging\MediaBrowser.Logging.csproj", "{37032B77-FE2E-4EC5-B7E4-BAF634443578}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -37,10 +35,6 @@ Global {32DFC600-CD2F-4B2D-B39A-3B4C6C32F9B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{32DFC600-CD2F-4B2D-B39A-3B4C6C32F9B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{32DFC600-CD2F-4B2D-B39A-3B4C6C32F9B4}.Release|Any CPU.Build.0 = Release|Any CPU
- {37032B77-FE2E-4EC5-B7E4-BAF634443578}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {37032B77-FE2E-4EC5-B7E4-BAF634443578}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {37032B77-FE2E-4EC5-B7E4-BAF634443578}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {37032B77-FE2E-4EC5-B7E4-BAF634443578}.Release|Any CPU.Build.0 = Release|Any CPU
{4FD51AC5-2C16-4308-A993-C3A84F3B4582}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4FD51AC5-2C16-4308-A993-C3A84F3B4582}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4FD51AC5-2C16-4308-A993-C3A84F3B4582}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
