mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-12-27 18:06:43 +00:00
Fixed some project fragmentation that came from efforts to go portable
This commit is contained in:
parent
7d48e20aea
commit
d4c75e3974
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace MediaBrowser.Logging
|
||||
namespace MediaBrowser.Common.Logging
|
||||
{
|
||||
public abstract class BaseLogger : IDisposable
|
||||
{
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace MediaBrowser.Logging
|
||||
namespace MediaBrowser.Common.Logging
|
||||
{
|
||||
public struct LogRow
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace MediaBrowser.Logging
|
||||
namespace MediaBrowser.Common.Logging
|
||||
{
|
||||
[Flags]
|
||||
public enum LogSeverity
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace MediaBrowser.Logging
|
||||
namespace MediaBrowser.Common.Logging
|
||||
{
|
||||
public static class Logger
|
||||
{
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
|
||||
namespace MediaBrowser.Controller.Configuration
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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>
|
|
@ -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")]
|
|
@ -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; }
|
||||
|
|
|
@ -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" />
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue