commit
c53745548a
|
@ -549,6 +549,8 @@ return null;
|
|||
TimerFactory = new TimerFactory();
|
||||
RegisterSingleInstance(TimerFactory);
|
||||
|
||||
RegisterSingleInstance(CryptographyProvider);
|
||||
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,15 @@ namespace Emby.Common.Implementations.Cryptography
|
|||
return provider.ComputeHash(Encoding.Unicode.GetBytes(str));
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] GetSHA1Bytes(byte[] bytes)
|
||||
{
|
||||
using (var provider = SHA1.Create())
|
||||
{
|
||||
return provider.ComputeHash(bytes);
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] GetMD5Bytes(Stream str)
|
||||
{
|
||||
using (var provider = MD5.Create())
|
||||
|
@ -26,5 +35,13 @@ namespace Emby.Common.Implementations.Cryptography
|
|||
return provider.ComputeHash(str);
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] GetMD5Bytes(byte[] bytes)
|
||||
{
|
||||
using (var provider = MD5.Create())
|
||||
{
|
||||
return provider.ComputeHash(bytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -169,9 +169,23 @@ namespace Emby.Common.Implementations.HttpClientManager
|
|||
AddRequestHeaders(httpWebRequest, options);
|
||||
|
||||
#if NET46
|
||||
httpWebRequest.AutomaticDecompression = options.EnableHttpCompression ?
|
||||
(options.DecompressionMethod ?? DecompressionMethods.Deflate) :
|
||||
DecompressionMethods.None;
|
||||
if (options.EnableHttpCompression)
|
||||
{
|
||||
if (options.DecompressionMethod.HasValue)
|
||||
{
|
||||
httpWebRequest.AutomaticDecompression = options.DecompressionMethod.Value == CompressionMethod.Gzip
|
||||
? DecompressionMethods.GZip
|
||||
: DecompressionMethods.Deflate;
|
||||
}
|
||||
else
|
||||
{
|
||||
httpWebRequest.AutomaticDecompression = DecompressionMethods.Deflate;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
httpWebRequest.AutomaticDecompression = DecompressionMethods.None;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using MediaBrowser.Model.Reflection;
|
||||
using System.Reflection;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Reflection
|
||||
namespace Emby.Common.Implementations.Reflection
|
||||
{
|
||||
public class AssemblyInfo : IAssemblyInfo
|
||||
{
|
||||
public Stream GetManifestResourceStream(Type type, string resource)
|
||||
{
|
||||
#if NET46
|
||||
return type.Assembly.GetManifestResourceStream(resource);
|
||||
#endif
|
||||
return type.GetTypeInfo().Assembly.GetManifestResourceStream(resource);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.TextEncoding;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.TextEncoding
|
||||
namespace Emby.Common.Implementations.TextEncoding
|
||||
{
|
||||
public class TextEncoding : IEncoding
|
||||
{
|
||||
|
@ -42,8 +42,7 @@ namespace MediaBrowser.Server.Implementations.TextEncoding
|
|||
if (buffer[0] == 0x2b && buffer[1] == 0x2f && buffer[2] == 0x76)
|
||||
return Encoding.UTF7;
|
||||
|
||||
// It's ok - anything aside from utf is ok since that's what we're looking for
|
||||
return Encoding.Default;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
using System.Xml;
|
||||
using MediaBrowser.Model.Xml;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Xml
|
||||
namespace Emby.Common.Implementations.Xml
|
||||
{
|
||||
public class XmlReaderSettingsFactory : IXmlReaderSettingsFactory
|
||||
{
|
||||
|
@ -11,7 +11,9 @@ namespace MediaBrowser.Server.Implementations.Xml
|
|||
|
||||
if (!enableValidation)
|
||||
{
|
||||
#if NET46
|
||||
settings.ValidationType = ValidationType.None;
|
||||
#endif
|
||||
}
|
||||
|
||||
return settings;
|
|
@ -23,27 +23,20 @@
|
|||
"System.Xml.Serialization": "4.0.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"MediaBrowser.Common": {
|
||||
"target": "project"
|
||||
},
|
||||
"SimpleInjector": "3.2.4",
|
||||
"NLog": "4.4.0-betaV15",
|
||||
"MediaBrowser.Model": {
|
||||
"target": "project"
|
||||
},
|
||||
"SimpleInjector": "3.2.4",
|
||||
"NLog": "4.4.0-betaV15"
|
||||
}
|
||||
"MediaBrowser.Common": {
|
||||
"target": "project"
|
||||
} }
|
||||
},
|
||||
"netstandard1.6": {
|
||||
"imports": "dnxcore50",
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.6.0",
|
||||
"MediaBrowser.Common": {
|
||||
"target": "project"
|
||||
},
|
||||
"MediaBrowser.Model": {
|
||||
"target": "project"
|
||||
},
|
||||
"System.IO.FileSystem.DriveInfo": "4.0.0",
|
||||
"System.IO.FileSystem.DriveInfo": "4.0.0",
|
||||
"System.Diagnostics.Process": "4.1.0",
|
||||
"System.Threading.Timer": "4.0.1",
|
||||
"System.Net.Requests": "4.0.11",
|
||||
|
@ -58,8 +51,13 @@
|
|||
"System.Reflection.Primitives": "4.0.1",
|
||||
"System.Runtime.Loader": "4.0.0",
|
||||
"SimpleInjector": "3.2.4",
|
||||
"NLog": "4.4.0-betaV15"
|
||||
}
|
||||
"NLog": "4.4.0-betaV15",
|
||||
"MediaBrowser.Model": {
|
||||
"target": "project"
|
||||
},
|
||||
"MediaBrowser.Common": {
|
||||
"target": "project"
|
||||
} }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -560,17 +560,19 @@ namespace Emby.Dlna
|
|||
? ImageFormat.Png
|
||||
: ImageFormat.Jpg;
|
||||
|
||||
var resource = GetType().Namespace + ".Images." + filename.ToLower();
|
||||
|
||||
#if NET46
|
||||
return new ImageStream
|
||||
{
|
||||
Format = format,
|
||||
Stream = GetType().Assembly.GetManifestResourceStream("MediaBrowser.Dlna.Images." + filename.ToLower())
|
||||
Stream = GetType().Assembly.GetManifestResourceStream(resource)
|
||||
};
|
||||
#elif NETSTANDARD1_6
|
||||
return new ImageStream
|
||||
{
|
||||
Format = format,
|
||||
Stream = GetType().GetTypeInfo().Assembly.GetManifestResourceStream("MediaBrowser.Dlna.Images." + filename.ToLower())
|
||||
Stream = GetType().GetTypeInfo().Assembly.GetManifestResourceStream(resource)
|
||||
};
|
||||
#endif
|
||||
throw new NotImplementedException();
|
||||
|
|
|
@ -37,6 +37,9 @@
|
|||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\SharedVersion.cs">
|
||||
<Link>Properties\SharedVersion.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="PhotoProvider.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -31,6 +31,4 @@ using System.Runtime.InteropServices;
|
|||
//
|
||||
// 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")]
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
@ -19,7 +19,7 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using MediaBrowser.Model.Globalization;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.EntryPoints
|
||||
namespace Emby.Server.Implementations.Activity
|
||||
{
|
||||
public class ActivityLogEntryPoint : IServerEntryPoint
|
||||
{
|
|
@ -8,7 +8,7 @@ using System;
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Activity
|
||||
namespace Emby.Server.Implementations.Activity
|
||||
{
|
||||
public class ActivityManager : IActivityManager
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
using MediaBrowser.Model.Branding;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Branding
|
||||
namespace Emby.Server.Implementations.Branding
|
||||
{
|
||||
public class BrandingConfigurationFactory : IConfigurationFactory
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
using MediaBrowser.Model.Configuration;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Channels
|
||||
namespace Emby.Server.Implementations.Channels
|
||||
{
|
||||
public static class ChannelConfigurationExtension
|
||||
{
|
|
@ -7,7 +7,7 @@ using System.Collections.Generic;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Channels
|
||||
namespace Emby.Server.Implementations.Channels
|
||||
{
|
||||
public class ChannelDynamicMediaSourceProvider : IMediaSourceProvider
|
||||
{
|
|
@ -7,7 +7,7 @@ using System.Linq;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Channels
|
||||
namespace Emby.Server.Implementations.Channels
|
||||
{
|
||||
public class ChannelImageProvider : IDynamicImageProvider, IHasItemChangeMonitor
|
||||
{
|
|
@ -31,7 +31,7 @@ using MediaBrowser.Controller.Entities.TV;
|
|||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.Globalization;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Channels
|
||||
namespace Emby.Server.Implementations.Channels
|
||||
{
|
||||
public class ChannelManager : IChannelManager
|
||||
{
|
||||
|
@ -410,7 +410,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
catch (IOException)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -781,7 +781,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
{
|
||||
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
catch (IOException)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -801,7 +801,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
{
|
||||
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
catch (IOException)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -943,7 +943,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
{
|
||||
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
catch (IOException)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -963,7 +963,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
{
|
||||
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
catch (IOException)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -1104,7 +1104,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
{
|
||||
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
catch (IOException)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -1127,7 +1127,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
{
|
||||
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
catch (IOException)
|
||||
{
|
||||
|
||||
}
|
|
@ -11,7 +11,7 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Channels
|
||||
namespace Emby.Server.Implementations.Channels
|
||||
{
|
||||
public class ChannelPostScanTask
|
||||
{
|
|
@ -6,7 +6,7 @@ using System.Collections.Generic;
|
|||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Channels
|
||||
namespace Emby.Server.Implementations.Channels
|
||||
{
|
||||
class RefreshChannelsScheduledTask : IScheduledTask
|
||||
{
|
|
@ -6,16 +6,14 @@ using MediaBrowser.Controller.Entities.Movies;
|
|||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Server.Implementations.Photos;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using Emby.Server.Implementations.Images;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Collections
|
||||
namespace Emby.Server.Implementations.Collections
|
||||
{
|
||||
public class CollectionImageProvider : BaseDynamicImageProvider<BoxSet>
|
||||
{
|
|
@ -11,11 +11,9 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Collections
|
||||
namespace Emby.Server.Implementations.Collections
|
||||
{
|
||||
public class CollectionManager : ICollectionManager
|
||||
{
|
|
@ -21,7 +21,7 @@ using MediaBrowser.Model.IO;
|
|||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Devices
|
||||
namespace Emby.Server.Implementations.Devices
|
||||
{
|
||||
public class DeviceManager : IDeviceManager
|
||||
{
|
|
@ -29,7 +29,7 @@ using MediaBrowser.Controller.IO;
|
|||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Dto
|
||||
namespace Emby.Server.Implementations.Dto
|
||||
{
|
||||
public class DtoService : IDtoService
|
||||
{
|
249
Emby.Server.Implementations/Emby.Server.Implementations.csproj
Normal file
249
Emby.Server.Implementations/Emby.Server.Implementations.csproj
Normal file
|
@ -0,0 +1,249 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.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>
|
||||
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{E383961B-9356-4D5D-8233-9A1079D03055}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Emby.Server.Implementations</RootNamespace>
|
||||
<AssemblyName>Emby.Server.Implementations</AssemblyName>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
</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 -->
|
||||
<None Include="project.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Activity\ActivityLogEntryPoint.cs" />
|
||||
<Compile Include="Activity\ActivityManager.cs" />
|
||||
<Compile Include="Branding\BrandingConfigurationFactory.cs" />
|
||||
<Compile Include="Channels\ChannelConfigurations.cs" />
|
||||
<Compile Include="Channels\ChannelDynamicMediaSourceProvider.cs" />
|
||||
<Compile Include="Channels\ChannelImageProvider.cs" />
|
||||
<Compile Include="Channels\ChannelManager.cs" />
|
||||
<Compile Include="Channels\ChannelPostScanTask.cs" />
|
||||
<Compile Include="Channels\RefreshChannelsScheduledTask.cs" />
|
||||
<Compile Include="Collections\CollectionImageProvider.cs" />
|
||||
<Compile Include="Collections\CollectionManager.cs" />
|
||||
<Compile Include="Devices\DeviceManager.cs" />
|
||||
<Compile Include="Dto\DtoService.cs" />
|
||||
<Compile Include="EntryPoints\AutomaticRestartEntryPoint.cs" />
|
||||
<Compile Include="EntryPoints\LibraryChangedNotifier.cs" />
|
||||
<Compile Include="EntryPoints\LoadRegistrations.cs" />
|
||||
<Compile Include="EntryPoints\RecordingNotifier.cs" />
|
||||
<Compile Include="EntryPoints\RefreshUsersMetadata.cs" />
|
||||
<Compile Include="EntryPoints\ServerEventNotifier.cs" />
|
||||
<Compile Include="EntryPoints\UsageEntryPoint.cs" />
|
||||
<Compile Include="EntryPoints\UsageReporter.cs" />
|
||||
<Compile Include="EntryPoints\UserDataChangeNotifier.cs" />
|
||||
<Compile Include="FileOrganization\EpisodeFileOrganizer.cs" />
|
||||
<Compile Include="FileOrganization\Extensions.cs" />
|
||||
<Compile Include="FileOrganization\FileOrganizationNotifier.cs" />
|
||||
<Compile Include="FileOrganization\FileOrganizationService.cs" />
|
||||
<Compile Include="FileOrganization\NameUtils.cs" />
|
||||
<Compile Include="FileOrganization\OrganizerScheduledTask.cs" />
|
||||
<Compile Include="FileOrganization\TvFolderOrganizer.cs" />
|
||||
<Compile Include="Images\BaseDynamicImageProvider.cs" />
|
||||
<Compile Include="Intros\DefaultIntroProvider.cs" />
|
||||
<Compile Include="IO\ThrottledStream.cs" />
|
||||
<Compile Include="Library\CoreResolutionIgnoreRule.cs" />
|
||||
<Compile Include="Library\LibraryManager.cs" />
|
||||
<Compile Include="Library\LocalTrailerPostScanTask.cs" />
|
||||
<Compile Include="Library\MediaSourceManager.cs" />
|
||||
<Compile Include="Library\MusicManager.cs" />
|
||||
<Compile Include="Library\PathExtensions.cs" />
|
||||
<Compile Include="Library\ResolverHelper.cs" />
|
||||
<Compile Include="Library\Resolvers\Audio\AudioResolver.cs" />
|
||||
<Compile Include="Library\Resolvers\Audio\MusicAlbumResolver.cs" />
|
||||
<Compile Include="Library\Resolvers\Audio\MusicArtistResolver.cs" />
|
||||
<Compile Include="Library\Resolvers\BaseVideoResolver.cs" />
|
||||
<Compile Include="Library\Resolvers\FolderResolver.cs" />
|
||||
<Compile Include="Library\Resolvers\ItemResolver.cs" />
|
||||
<Compile Include="Library\Resolvers\Movies\BoxSetResolver.cs" />
|
||||
<Compile Include="Library\Resolvers\Movies\MovieResolver.cs" />
|
||||
<Compile Include="Library\Resolvers\PhotoAlbumResolver.cs" />
|
||||
<Compile Include="Library\Resolvers\PhotoResolver.cs" />
|
||||
<Compile Include="Library\Resolvers\PlaylistResolver.cs" />
|
||||
<Compile Include="Library\Resolvers\SpecialFolderResolver.cs" />
|
||||
<Compile Include="Library\Resolvers\TV\EpisodeResolver.cs" />
|
||||
<Compile Include="Library\Resolvers\TV\SeasonResolver.cs" />
|
||||
<Compile Include="Library\Resolvers\TV\SeriesResolver.cs" />
|
||||
<Compile Include="Library\Resolvers\VideoResolver.cs" />
|
||||
<Compile Include="Library\SearchEngine.cs" />
|
||||
<Compile Include="Library\UserDataManager.cs" />
|
||||
<Compile Include="Library\UserManager.cs" />
|
||||
<Compile Include="Library\UserViewManager.cs" />
|
||||
<Compile Include="Library\Validators\ArtistsPostScanTask.cs" />
|
||||
<Compile Include="Library\Validators\ArtistsValidator.cs" />
|
||||
<Compile Include="Library\Validators\GameGenresPostScanTask.cs" />
|
||||
<Compile Include="Library\Validators\GameGenresValidator.cs" />
|
||||
<Compile Include="Library\Validators\GenresPostScanTask.cs" />
|
||||
<Compile Include="Library\Validators\GenresValidator.cs" />
|
||||
<Compile Include="Library\Validators\MusicGenresPostScanTask.cs" />
|
||||
<Compile Include="Library\Validators\MusicGenresValidator.cs" />
|
||||
<Compile Include="Library\Validators\PeopleValidator.cs" />
|
||||
<Compile Include="Library\Validators\StudiosPostScanTask.cs" />
|
||||
<Compile Include="Library\Validators\StudiosValidator.cs" />
|
||||
<Compile Include="Library\Validators\YearsPostScanTask.cs" />
|
||||
<Compile Include="LiveTv\ChannelImageProvider.cs" />
|
||||
<Compile Include="LiveTv\EmbyTV\DirectRecorder.cs" />
|
||||
<Compile Include="LiveTv\EmbyTV\EmbyTV.cs" />
|
||||
<Compile Include="LiveTv\EmbyTV\EmbyTVRegistration.cs" />
|
||||
<Compile Include="LiveTv\EmbyTV\EncodedRecorder.cs" />
|
||||
<Compile Include="LiveTv\EmbyTV\EntryPoint.cs" />
|
||||
<Compile Include="LiveTv\EmbyTV\IRecorder.cs" />
|
||||
<Compile Include="LiveTv\EmbyTV\ItemDataProvider.cs" />
|
||||
<Compile Include="LiveTv\EmbyTV\RecordingHelper.cs" />
|
||||
<Compile Include="LiveTv\EmbyTV\SeriesTimerManager.cs" />
|
||||
<Compile Include="LiveTv\EmbyTV\TimerManager.cs" />
|
||||
<Compile Include="LiveTv\Listings\SchedulesDirect.cs" />
|
||||
<Compile Include="LiveTv\Listings\XmlTvListingsProvider.cs" />
|
||||
<Compile Include="LiveTv\LiveStreamHelper.cs" />
|
||||
<Compile Include="LiveTv\LiveTvConfigurationFactory.cs" />
|
||||
<Compile Include="LiveTv\LiveTvDtoService.cs" />
|
||||
<Compile Include="LiveTv\LiveTvManager.cs" />
|
||||
<Compile Include="LiveTv\LiveTvMediaSourceProvider.cs" />
|
||||
<Compile Include="LiveTv\ProgramImageProvider.cs" />
|
||||
<Compile Include="LiveTv\RecordingImageProvider.cs" />
|
||||
<Compile Include="LiveTv\RefreshChannelsScheduledTask.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\BaseTunerHost.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\HdHomerun\HdHomerunDiscovery.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\HdHomerun\HdHomerunHost.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\HdHomerun\HdHomerunLiveStream.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\M3uParser.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\M3UTunerHost.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\MulticastStream.cs" />
|
||||
<Compile Include="LiveTv\TunerHosts\QueueStream.cs" />
|
||||
<Compile Include="Logging\PatternsLogger.cs" />
|
||||
<Compile Include="MediaEncoder\EncodingManager.cs" />
|
||||
<Compile Include="News\NewsEntryPoint.cs" />
|
||||
<Compile Include="News\NewsService.cs" />
|
||||
<Compile Include="Notifications\CoreNotificationTypes.cs" />
|
||||
<Compile Include="Notifications\IConfigurableNotificationService.cs" />
|
||||
<Compile Include="Notifications\InternalNotificationService.cs" />
|
||||
<Compile Include="Notifications\NotificationConfigurationFactory.cs" />
|
||||
<Compile Include="Notifications\NotificationManager.cs" />
|
||||
<Compile Include="Notifications\Notifications.cs" />
|
||||
<Compile Include="Notifications\WebSocketNotifier.cs" />
|
||||
<Compile Include="Persistence\CleanDatabaseScheduledTask.cs" />
|
||||
<Compile Include="Photos\PhotoAlbumImageProvider.cs" />
|
||||
<Compile Include="Playlists\PlaylistImageProvider.cs" />
|
||||
<Compile Include="Playlists\PlaylistManager.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ScheduledTasks\ChapterImagesTask.cs" />
|
||||
<Compile Include="ScheduledTasks\PeopleValidationTask.cs" />
|
||||
<Compile Include="ScheduledTasks\PluginUpdateTask.cs" />
|
||||
<Compile Include="ScheduledTasks\RefreshIntrosTask.cs" />
|
||||
<Compile Include="ScheduledTasks\RefreshMediaLibraryTask.cs" />
|
||||
<Compile Include="ScheduledTasks\SystemUpdateTask.cs" />
|
||||
<Compile Include="ServerManager\ServerManager.cs" />
|
||||
<Compile Include="ServerManager\WebSocketConnection.cs" />
|
||||
<Compile Include="Session\HttpSessionController.cs" />
|
||||
<Compile Include="Session\SessionManager.cs" />
|
||||
<Compile Include="Session\SessionWebSocketListener.cs" />
|
||||
<Compile Include="Session\WebSocketController.cs" />
|
||||
<Compile Include="Sorting\AiredEpisodeOrderComparer.cs" />
|
||||
<Compile Include="Sorting\AirTimeComparer.cs" />
|
||||
<Compile Include="Sorting\AlbumArtistComparer.cs" />
|
||||
<Compile Include="Sorting\AlbumComparer.cs" />
|
||||
<Compile Include="Sorting\AlphanumComparator.cs" />
|
||||
<Compile Include="Sorting\ArtistComparer.cs" />
|
||||
<Compile Include="Sorting\BudgetComparer.cs" />
|
||||
<Compile Include="Sorting\CommunityRatingComparer.cs" />
|
||||
<Compile Include="Sorting\CriticRatingComparer.cs" />
|
||||
<Compile Include="Sorting\DateCreatedComparer.cs" />
|
||||
<Compile Include="Sorting\DateLastMediaAddedComparer.cs" />
|
||||
<Compile Include="Sorting\DatePlayedComparer.cs" />
|
||||
<Compile Include="Sorting\GameSystemComparer.cs" />
|
||||
<Compile Include="Sorting\IsFavoriteOrLikeComparer.cs" />
|
||||
<Compile Include="Sorting\IsFolderComparer.cs" />
|
||||
<Compile Include="Sorting\IsPlayedComparer.cs" />
|
||||
<Compile Include="Sorting\IsUnplayedComparer.cs" />
|
||||
<Compile Include="Sorting\MetascoreComparer.cs" />
|
||||
<Compile Include="Sorting\NameComparer.cs" />
|
||||
<Compile Include="Sorting\OfficialRatingComparer.cs" />
|
||||
<Compile Include="Sorting\PlayCountComparer.cs" />
|
||||
<Compile Include="Sorting\PlayersComparer.cs" />
|
||||
<Compile Include="Sorting\PremiereDateComparer.cs" />
|
||||
<Compile Include="Sorting\ProductionYearComparer.cs" />
|
||||
<Compile Include="Sorting\RandomComparer.cs" />
|
||||
<Compile Include="Sorting\RevenueComparer.cs" />
|
||||
<Compile Include="Sorting\RuntimeComparer.cs" />
|
||||
<Compile Include="Sorting\SeriesSortNameComparer.cs" />
|
||||
<Compile Include="Sorting\SortNameComparer.cs" />
|
||||
<Compile Include="Sorting\StartDateComparer.cs" />
|
||||
<Compile Include="Sorting\StudioComparer.cs" />
|
||||
<Compile Include="Sync\AppSyncProvider.cs" />
|
||||
<Compile Include="Sync\CloudSyncProfile.cs" />
|
||||
<Compile Include="Sync\IHasSyncQuality.cs" />
|
||||
<Compile Include="Sync\MediaSync.cs" />
|
||||
<Compile Include="Sync\MultiProviderSync.cs" />
|
||||
<Compile Include="Sync\ServerSyncScheduledTask.cs" />
|
||||
<Compile Include="Sync\SyncConfig.cs" />
|
||||
<Compile Include="Sync\SyncConvertScheduledTask.cs" />
|
||||
<Compile Include="Sync\SyncedMediaSourceProvider.cs" />
|
||||
<Compile Include="Sync\SyncHelper.cs" />
|
||||
<Compile Include="Sync\SyncJobOptions.cs" />
|
||||
<Compile Include="Sync\SyncJobProcessor.cs" />
|
||||
<Compile Include="Sync\SyncManager.cs" />
|
||||
<Compile Include="Sync\SyncNotificationEntryPoint.cs" />
|
||||
<Compile Include="Sync\SyncRegistrationInfo.cs" />
|
||||
<Compile Include="Sync\TargetDataProvider.cs" />
|
||||
<Compile Include="TV\SeriesPostScanTask.cs" />
|
||||
<Compile Include="TV\TVSeriesManager.cs" />
|
||||
<Compile Include="Updates\InstallationManager.cs" />
|
||||
<Compile Include="UserViews\CollectionFolderImageProvider.cs" />
|
||||
<Compile Include="UserViews\DynamicImageProvider.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj">
|
||||
<Project>{9142eefa-7570-41e1-bfcc-468bb571af2f}</Project>
|
||||
<Name>MediaBrowser.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj">
|
||||
<Project>{17e1f4e6-8abd-4fe5-9ecf-43d4b6087ba2}</Project>
|
||||
<Name>MediaBrowser.Controller</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj">
|
||||
<Project>{7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b}</Project>
|
||||
<Name>MediaBrowser.Model</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\MediaBrowser.Providers\MediaBrowser.Providers.csproj">
|
||||
<Project>{442b5058-dcaf-4263-bb6a-f21e31120a1b}</Project>
|
||||
<Name>MediaBrowser.Providers</Name>
|
||||
</ProjectReference>
|
||||
</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>
|
|
@ -10,8 +10,9 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.LiveTv;
|
||||
using MediaBrowser.Model.LiveTv;
|
||||
using MediaBrowser.Model.Threading;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.EntryPoints
|
||||
namespace Emby.Server.Implementations.EntryPoints
|
||||
{
|
||||
public class AutomaticRestartEntryPoint : IServerEntryPoint
|
||||
{
|
||||
|
@ -21,10 +22,11 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||
private readonly ISessionManager _sessionManager;
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly ILiveTvManager _liveTvManager;
|
||||
private readonly ITimerFactory _timerFactory;
|
||||
|
||||
private Timer _timer;
|
||||
private ITimer _timer;
|
||||
|
||||
public AutomaticRestartEntryPoint(IServerApplicationHost appHost, ILogger logger, ITaskManager iTaskManager, ISessionManager sessionManager, IServerConfigurationManager config, ILiveTvManager liveTvManager)
|
||||
public AutomaticRestartEntryPoint(IServerApplicationHost appHost, ILogger logger, ITaskManager iTaskManager, ISessionManager sessionManager, IServerConfigurationManager config, ILiveTvManager liveTvManager, ITimerFactory timerFactory)
|
||||
{
|
||||
_appHost = appHost;
|
||||
_logger = logger;
|
||||
|
@ -32,6 +34,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||
_sessionManager = sessionManager;
|
||||
_config = config;
|
||||
_liveTvManager = liveTvManager;
|
||||
_timerFactory = timerFactory;
|
||||
}
|
||||
|
||||
public void Run()
|
||||
|
@ -48,7 +51,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||
|
||||
if (_appHost.HasPendingRestart)
|
||||
{
|
||||
_timer = new Timer(TimerCallback, null, TimeSpan.FromMinutes(10), TimeSpan.FromMinutes(10));
|
||||
_timer = _timerFactory.Create(TimerCallback, null, TimeSpan.FromMinutes(10), TimeSpan.FromMinutes(10));
|
||||
}
|
||||
}
|
||||
|
|
@ -10,8 +10,9 @@ using System.Linq;
|
|||
using System.Threading;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
using MediaBrowser.Model.Threading;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.EntryPoints
|
||||
namespace Emby.Server.Implementations.EntryPoints
|
||||
{
|
||||
public class LibraryChangedNotifier : IServerEntryPoint
|
||||
{
|
||||
|
@ -23,6 +24,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||
private readonly ISessionManager _sessionManager;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ITimerFactory _timerFactory;
|
||||
|
||||
/// <summary>
|
||||
/// The _library changed sync lock
|
||||
|
@ -40,19 +42,20 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||
/// Gets or sets the library update timer.
|
||||
/// </summary>
|
||||
/// <value>The library update timer.</value>
|
||||
private Timer LibraryUpdateTimer { get; set; }
|
||||
private ITimer LibraryUpdateTimer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The library update duration
|
||||
/// </summary>
|
||||
private const int LibraryUpdateDuration = 5000;
|
||||
|
||||
public LibraryChangedNotifier(ILibraryManager libraryManager, ISessionManager sessionManager, IUserManager userManager, ILogger logger)
|
||||
public LibraryChangedNotifier(ILibraryManager libraryManager, ISessionManager sessionManager, IUserManager userManager, ILogger logger, ITimerFactory timerFactory)
|
||||
{
|
||||
_libraryManager = libraryManager;
|
||||
_sessionManager = sessionManager;
|
||||
_userManager = userManager;
|
||||
_logger = logger;
|
||||
_timerFactory = timerFactory;
|
||||
}
|
||||
|
||||
public void Run()
|
||||
|
@ -79,7 +82,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||
{
|
||||
if (LibraryUpdateTimer == null)
|
||||
{
|
||||
LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration,
|
||||
LibraryUpdateTimer = _timerFactory.Create(LibraryUpdateTimerCallback, null, LibraryUpdateDuration,
|
||||
Timeout.Infinite);
|
||||
}
|
||||
else
|
||||
|
@ -112,7 +115,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||
{
|
||||
if (LibraryUpdateTimer == null)
|
||||
{
|
||||
LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration,
|
||||
LibraryUpdateTimer = _timerFactory.Create(LibraryUpdateTimerCallback, null, LibraryUpdateDuration,
|
||||
Timeout.Infinite);
|
||||
}
|
||||
else
|
||||
|
@ -140,7 +143,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||
{
|
||||
if (LibraryUpdateTimer == null)
|
||||
{
|
||||
LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration,
|
||||
LibraryUpdateTimer = _timerFactory.Create(LibraryUpdateTimerCallback, null, LibraryUpdateDuration,
|
||||
Timeout.Infinite);
|
||||
}
|
||||
else
|
|
@ -3,9 +3,9 @@ using MediaBrowser.Controller.Plugins;
|
|||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Server.Implementations.Threading;
|
||||
using MediaBrowser.Model.Threading;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.EntryPoints
|
||||
namespace Emby.Server.Implementations.EntryPoints
|
||||
{
|
||||
/// <summary>
|
||||
/// Class LoadRegistrations
|
||||
|
@ -22,16 +22,18 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private PeriodicTimer _timer;
|
||||
private ITimer _timer;
|
||||
private readonly ITimerFactory _timerFactory;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LoadRegistrations" /> class.
|
||||
/// </summary>
|
||||
/// <param name="securityManager">The security manager.</param>
|
||||
/// <param name="logManager">The log manager.</param>
|
||||
public LoadRegistrations(ISecurityManager securityManager, ILogManager logManager)
|
||||
public LoadRegistrations(ISecurityManager securityManager, ILogManager logManager, ITimerFactory timerFactory)
|
||||
{
|
||||
_securityManager = securityManager;
|
||||
_timerFactory = timerFactory;
|
||||
|
||||
_logger = logManager.GetLogger("Registration Loader");
|
||||
}
|
||||
|
@ -41,7 +43,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||
/// </summary>
|
||||
public void Run()
|
||||
{
|
||||
_timer = new PeriodicTimer(s => LoadAllRegistrations(), null, TimeSpan.FromMilliseconds(100), TimeSpan.FromHours(12));
|
||||
_timer = _timerFactory.Create(s => LoadAllRegistrations(), null, TimeSpan.FromMilliseconds(100), TimeSpan.FromHours(12));
|
||||
}
|
||||
|
||||
private async Task LoadAllRegistrations()
|
|
@ -7,7 +7,7 @@ using MediaBrowser.Controller.Plugins;
|
|||
using MediaBrowser.Controller.Session;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.EntryPoints
|
||||
namespace Emby.Server.Implementations.EntryPoints
|
||||
{
|
||||
public class RecordingNotifier : IServerEntryPoint
|
||||
{
|
||||
|
@ -32,22 +32,22 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||
_liveTvManager.SeriesTimerCreated += _liveTvManager_SeriesTimerCreated;
|
||||
}
|
||||
|
||||
private void _liveTvManager_SeriesTimerCreated(object sender, Model.Events.GenericEventArgs<TimerEventInfo> e)
|
||||
private void _liveTvManager_SeriesTimerCreated(object sender, MediaBrowser.Model.Events.GenericEventArgs<TimerEventInfo> e)
|
||||
{
|
||||
SendMessage("SeriesTimerCreated", e.Argument);
|
||||
}
|
||||
|
||||
private void _liveTvManager_TimerCreated(object sender, Model.Events.GenericEventArgs<TimerEventInfo> e)
|
||||
private void _liveTvManager_TimerCreated(object sender, MediaBrowser.Model.Events.GenericEventArgs<TimerEventInfo> e)
|
||||
{
|
||||
SendMessage("TimerCreated", e.Argument);
|
||||
}
|
||||
|
||||
private void _liveTvManager_SeriesTimerCancelled(object sender, Model.Events.GenericEventArgs<TimerEventInfo> e)
|
||||
private void _liveTvManager_SeriesTimerCancelled(object sender, MediaBrowser.Model.Events.GenericEventArgs<TimerEventInfo> e)
|
||||
{
|
||||
SendMessage("SeriesTimerCancelled", e.Argument);
|
||||
}
|
||||
|
||||
private void _liveTvManager_TimerCancelled(object sender, Model.Events.GenericEventArgs<TimerEventInfo> e)
|
||||
private void _liveTvManager_TimerCancelled(object sender, MediaBrowser.Model.Events.GenericEventArgs<TimerEventInfo> e)
|
||||
{
|
||||
SendMessage("TimerCancelled", e.Argument);
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
using MediaBrowser.Controller.Plugins;
|
||||
using System.Threading;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.EntryPoints
|
||||
namespace Emby.Server.Implementations.EntryPoints
|
||||
{
|
||||
/// <summary>
|
||||
/// Class RefreshUsersMetadata
|
|
@ -14,7 +14,7 @@ using System.Collections.Generic;
|
|||
using System.Threading;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.EntryPoints
|
||||
namespace Emby.Server.Implementations.EntryPoints
|
||||
{
|
||||
/// <summary>
|
||||
/// Class WebSocketEvents
|
|
@ -12,7 +12,7 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.EntryPoints
|
||||
namespace Emby.Server.Implementations.EntryPoints
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UsageEntryPoint
|
|
@ -10,7 +10,7 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.EntryPoints
|
||||
namespace Emby.Server.Implementations.EntryPoints
|
||||
{
|
||||
public class UsageReporter
|
||||
{
|
|
@ -11,8 +11,9 @@ using System.Linq;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
using MediaBrowser.Model.Threading;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.EntryPoints
|
||||
namespace Emby.Server.Implementations.EntryPoints
|
||||
{
|
||||
class UserDataChangeNotifier : IServerEntryPoint
|
||||
{
|
||||
|
@ -22,17 +23,19 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||
private readonly IUserManager _userManager;
|
||||
|
||||
private readonly object _syncLock = new object();
|
||||
private Timer UpdateTimer { get; set; }
|
||||
private ITimer UpdateTimer { get; set; }
|
||||
private readonly ITimerFactory _timerFactory;
|
||||
private const int UpdateDuration = 500;
|
||||
|
||||
private readonly Dictionary<Guid, List<IHasUserData>> _changedItems = new Dictionary<Guid, List<IHasUserData>>();
|
||||
|
||||
public UserDataChangeNotifier(IUserDataManager userDataManager, ISessionManager sessionManager, ILogger logger, IUserManager userManager)
|
||||
public UserDataChangeNotifier(IUserDataManager userDataManager, ISessionManager sessionManager, ILogger logger, IUserManager userManager, ITimerFactory timerFactory)
|
||||
{
|
||||
_userDataManager = userDataManager;
|
||||
_sessionManager = sessionManager;
|
||||
_logger = logger;
|
||||
_userManager = userManager;
|
||||
_timerFactory = timerFactory;
|
||||
}
|
||||
|
||||
public void Run()
|
||||
|
@ -51,7 +54,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||
{
|
||||
if (UpdateTimer == null)
|
||||
{
|
||||
UpdateTimer = new Timer(UpdateTimerCallback, null, UpdateDuration,
|
||||
UpdateTimer = _timerFactory.Create(UpdateTimerCallback, null, UpdateDuration,
|
||||
Timeout.Infinite);
|
||||
}
|
||||
else
|
|
@ -7,8 +7,6 @@ using MediaBrowser.Model.Entities;
|
|||
using MediaBrowser.Model.Extensions;
|
||||
using MediaBrowser.Model.FileOrganization;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Server.Implementations.Library;
|
||||
using MediaBrowser.Server.Implementations.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
@ -16,11 +14,16 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Emby.Server.Implementations.Library;
|
||||
using Emby.Server.Implementations.Logging;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Naming.TV;
|
||||
using EpisodeInfo = MediaBrowser.Controller.Providers.EpisodeInfo;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.FileOrganization
|
||||
namespace Emby.Server.Implementations.FileOrganization
|
||||
{
|
||||
public class EpisodeFileOrganizer
|
||||
{
|
||||
|
@ -55,7 +58,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
|||
OriginalPath = path,
|
||||
OriginalFileName = Path.GetFileName(path),
|
||||
Type = FileOrganizerType.Episode,
|
||||
FileSize = new FileInfo(path).Length
|
||||
FileSize = _fileSystem.GetFileInfo(path).Length
|
||||
};
|
||||
|
||||
try
|
||||
|
@ -68,10 +71,10 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
|||
}
|
||||
|
||||
var namingOptions = ((LibraryManager)_libraryManager).GetNamingOptions();
|
||||
var resolver = new Naming.TV.EpisodeResolver(namingOptions, new PatternsLogger());
|
||||
var resolver = new EpisodeResolver(namingOptions, new PatternsLogger());
|
||||
|
||||
var episodeInfo = resolver.Resolve(path, false) ??
|
||||
new Naming.TV.EpisodeInfo();
|
||||
new MediaBrowser.Naming.TV.EpisodeInfo();
|
||||
|
||||
var seriesName = episodeInfo.SeriesName;
|
||||
|
||||
|
@ -505,7 +508,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
|||
|
||||
episodePaths.AddRange(filesOfOtherExtensions);
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
catch (IOException)
|
||||
{
|
||||
// No big deal. Maybe the season folder doesn't already exist.
|
||||
}
|
||||
|
@ -575,7 +578,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
|||
result.ExtractedName = nameWithoutYear;
|
||||
result.ExtractedYear = yearInName;
|
||||
|
||||
var series = _libraryManager.GetItemList(new Controller.Entities.InternalItemsQuery
|
||||
var series = _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { typeof(Series).Name },
|
||||
Recursive = true
|
||||
|
@ -593,7 +596,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
|||
|
||||
if (info != null)
|
||||
{
|
||||
series = _libraryManager.GetItemList(new Controller.Entities.InternalItemsQuery
|
||||
series = _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { typeof(Series).Name },
|
||||
Recursive = true,
|
||||
|
@ -808,8 +811,8 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
|||
{
|
||||
try
|
||||
{
|
||||
var sourceFileInfo = new FileInfo(sourcePath);
|
||||
var destinationFileInfo = new FileInfo(newPath);
|
||||
var sourceFileInfo = _fileSystem.GetFileInfo(sourcePath);
|
||||
var destinationFileInfo = _fileSystem.GetFileInfo(newPath);
|
||||
|
||||
if (sourceFileInfo.Length == destinationFileInfo.Length)
|
||||
{
|
||||
|
@ -820,7 +823,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
|||
{
|
||||
return false;
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
catch (IOException)
|
||||
{
|
||||
return false;
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
using MediaBrowser.Model.FileOrganization;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.FileOrganization
|
||||
namespace Emby.Server.Implementations.FileOrganization
|
||||
{
|
||||
public static class ConfigurationExtension
|
||||
{
|
|
@ -8,7 +8,7 @@ using System;
|
|||
using System.Threading;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.FileOrganization
|
||||
namespace Emby.Server.Implementations.FileOrganization
|
||||
{
|
||||
/// <summary>
|
||||
/// Class SessionInfoWebSocketListener
|
|
@ -21,7 +21,7 @@ using MediaBrowser.Common.IO;
|
|||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.FileOrganization
|
||||
namespace Emby.Server.Implementations.FileOrganization
|
||||
{
|
||||
public class FileOrganizationService : IFileOrganizationService
|
||||
{
|
|
@ -2,10 +2,9 @@
|
|||
using MediaBrowser.Controller.Entities;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using MediaBrowser.Controller.Extensions;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.FileOrganization
|
||||
namespace Emby.Server.Implementations.FileOrganization
|
||||
{
|
||||
public static class NameUtils
|
||||
{
|
||||
|
@ -54,7 +53,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
|||
|
||||
private static string GetComparableName(string name)
|
||||
{
|
||||
name = RemoveDiacritics(name);
|
||||
name = name.RemoveDiacritics();
|
||||
|
||||
name = " " + name + " ";
|
||||
|
||||
|
@ -78,19 +77,5 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
|||
|
||||
return name.Trim();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the diacritics.
|
||||
/// </summary>
|
||||
/// <param name="text">The text.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
private static string RemoveDiacritics(string text)
|
||||
{
|
||||
return String.Concat(
|
||||
text.Normalize(NormalizationForm.FormD)
|
||||
.Where(ch => CharUnicodeInfo.GetUnicodeCategory(ch) !=
|
||||
UnicodeCategory.NonSpacingMark)
|
||||
).Normalize(NormalizationForm.FormC);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,7 +13,7 @@ using MediaBrowser.Controller.IO;
|
|||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.FileOrganization
|
||||
namespace Emby.Server.Implementations.FileOrganization
|
||||
{
|
||||
public class OrganizerScheduledTask : IScheduledTask, IConfigurableScheduledTask
|
||||
{
|
|
@ -14,7 +14,7 @@ using MediaBrowser.Common.IO;
|
|||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.FileOrganization
|
||||
namespace Emby.Server.Implementations.FileOrganization
|
||||
{
|
||||
public class TvFolderOrganizer
|
||||
{
|
||||
|
@ -191,7 +191,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
|||
_fileSystem.DeleteDirectory(path, false);
|
||||
}
|
||||
catch (UnauthorizedAccessException) { }
|
||||
catch (DirectoryNotFoundException) { }
|
||||
catch (IOException) { }
|
||||
}
|
||||
}
|
||||
catch (UnauthorizedAccessException) { }
|
|
@ -3,7 +3,7 @@ using System.IO;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.IO
|
||||
namespace Emby.Server.Implementations.IO
|
||||
{
|
||||
/// <summary>
|
||||
/// Class for streaming data with throttling support.
|
||||
|
@ -326,9 +326,10 @@ namespace MediaBrowser.Server.Implementations.IO
|
|||
try
|
||||
{
|
||||
// The time to sleep is more then a millisecond, so sleep.
|
||||
Thread.Sleep(toSleep);
|
||||
var task = Task.Delay(toSleep);
|
||||
Task.WaitAll(task);
|
||||
}
|
||||
catch (ThreadAbortException)
|
||||
catch
|
||||
{
|
||||
// Eatup ThreadAbortException.
|
||||
}
|
|
@ -18,7 +18,7 @@ using MediaBrowser.Controller.Entities.Audio;
|
|||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Photos
|
||||
namespace Emby.Server.Implementations.Images
|
||||
{
|
||||
public abstract class BaseDynamicImageProvider<T> : IHasItemChangeMonitor, IForcedProvider, ICustomMetadataProvider<T>, IHasOrder
|
||||
where T : IHasMetadata
|
||||
|
@ -353,7 +353,7 @@ namespace MediaBrowser.Server.Implementations.Photos
|
|||
var ext = Path.GetExtension(image);
|
||||
|
||||
var outputPath = Path.ChangeExtension(outputPathWithoutExtension, ext);
|
||||
File.Copy(image, outputPath);
|
||||
FileSystem.CopyFile(image, outputPath, true);
|
||||
|
||||
return outputPath;
|
||||
}
|
|
@ -11,13 +11,11 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
using MediaBrowser.Model.Globalization;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Intros
|
||||
namespace Emby.Server.Implementations.Intros
|
||||
{
|
||||
public class DefaultIntroProvider : IIntroProvider
|
||||
{
|
|
@ -10,7 +10,7 @@ using MediaBrowser.Common.IO;
|
|||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library
|
||||
namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides the core resolver ignore rules
|
|
@ -18,9 +18,6 @@ using MediaBrowser.Naming.Audio;
|
|||
using MediaBrowser.Naming.Common;
|
||||
using MediaBrowser.Naming.TV;
|
||||
using MediaBrowser.Naming.Video;
|
||||
using MediaBrowser.Server.Implementations.Library.Validators;
|
||||
using MediaBrowser.Server.Implementations.Logging;
|
||||
using MediaBrowser.Server.Implementations.ScheduledTasks;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
|
@ -30,6 +27,10 @@ using System.Linq;
|
|||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Emby.Server.Implementations.Library.Resolvers;
|
||||
using Emby.Server.Implementations.Library.Validators;
|
||||
using Emby.Server.Implementations.Logging;
|
||||
using Emby.Server.Implementations.ScheduledTasks;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Controller.Channels;
|
||||
using MediaBrowser.Model.Channels;
|
||||
|
@ -37,14 +38,13 @@ using MediaBrowser.Model.Dto;
|
|||
using MediaBrowser.Model.Extensions;
|
||||
using MediaBrowser.Model.Library;
|
||||
using MediaBrowser.Model.Net;
|
||||
using MediaBrowser.Server.Implementations.Library.Resolvers;
|
||||
using SortOrder = MediaBrowser.Model.Entities.SortOrder;
|
||||
using VideoResolver = MediaBrowser.Naming.Video.VideoResolver;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library
|
||||
namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
/// <summary>
|
||||
/// Class LibraryManager
|
||||
|
@ -403,7 +403,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
{
|
||||
_fileSystem.DeleteDirectory(metadataPath, true);
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
catch (IOException)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -1189,7 +1189,8 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
{
|
||||
Name = Path.GetFileName(dir),
|
||||
|
||||
Locations = Directory.EnumerateFiles(dir, "*.mblink", SearchOption.TopDirectoryOnly)
|
||||
Locations = _fileSystem.GetFilePaths(dir, false)
|
||||
.Where(i => string.Equals(ShortcutFileExtension, Path.GetExtension(i), StringComparison.OrdinalIgnoreCase))
|
||||
.Select(_fileSystem.ResolveShortcut)
|
||||
.OrderBy(i => i)
|
||||
.ToList(),
|
||||
|
@ -2302,11 +2303,11 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
|
||||
var episodeInfo = locationType == LocationType.FileSystem || locationType == LocationType.Offline ?
|
||||
resolver.Resolve(episode.Path, isFolder) :
|
||||
new Naming.TV.EpisodeInfo();
|
||||
new MediaBrowser.Naming.TV.EpisodeInfo();
|
||||
|
||||
if (episodeInfo == null)
|
||||
{
|
||||
episodeInfo = new Naming.TV.EpisodeInfo();
|
||||
episodeInfo = new MediaBrowser.Naming.TV.EpisodeInfo();
|
||||
}
|
||||
|
||||
var changed = false;
|
||||
|
@ -2787,10 +2788,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
{
|
||||
var path = Path.Combine(virtualFolderPath, collectionType + ".collection");
|
||||
|
||||
using (File.Create(path))
|
||||
{
|
||||
|
||||
}
|
||||
_fileSystem.WriteAllBytes(path, new byte[] {});
|
||||
}
|
||||
|
||||
CollectionFolder.SaveLibraryOptions(virtualFolderPath, options);
|
||||
|
@ -2827,21 +2825,20 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
|
||||
private bool ValidateNetworkPath(string path)
|
||||
{
|
||||
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
||||
{
|
||||
// We can't validate protocol-based paths, so just allow them
|
||||
if (path.IndexOf("://", StringComparison.OrdinalIgnoreCase) == -1)
|
||||
{
|
||||
return Directory.Exists(path);
|
||||
}
|
||||
}
|
||||
//if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
||||
//{
|
||||
// // We can't validate protocol-based paths, so just allow them
|
||||
// if (path.IndexOf("://", StringComparison.OrdinalIgnoreCase) == -1)
|
||||
// {
|
||||
// return _fileSystem.DirectoryExists(path);
|
||||
// }
|
||||
//}
|
||||
|
||||
// Without native support for unc, we cannot validate this when running under mono
|
||||
return true;
|
||||
}
|
||||
|
||||
private const string ShortcutFileExtension = ".mblink";
|
||||
private const string ShortcutFileSearch = "*" + ShortcutFileExtension;
|
||||
public void AddMediaPath(string virtualFolderName, MediaPathInfo pathInfo)
|
||||
{
|
||||
AddMediaPathInternal(virtualFolderName, pathInfo, true);
|
||||
|
@ -2863,12 +2860,12 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
|
||||
if (!_fileSystem.DirectoryExists(path))
|
||||
{
|
||||
throw new DirectoryNotFoundException("The path does not exist.");
|
||||
throw new FileNotFoundException("The path does not exist.");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(pathInfo.NetworkPath) && !ValidateNetworkPath(pathInfo.NetworkPath))
|
||||
{
|
||||
throw new DirectoryNotFoundException("The network path does not exist.");
|
||||
throw new FileNotFoundException("The network path does not exist.");
|
||||
}
|
||||
|
||||
var rootFolderPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath;
|
||||
|
@ -2911,7 +2908,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
|
||||
if (!string.IsNullOrWhiteSpace(pathInfo.NetworkPath) && !ValidateNetworkPath(pathInfo.NetworkPath))
|
||||
{
|
||||
throw new DirectoryNotFoundException("The network path does not exist.");
|
||||
throw new FileNotFoundException("The network path does not exist.");
|
||||
}
|
||||
|
||||
var rootFolderPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath;
|
||||
|
@ -2973,7 +2970,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
|
||||
if (!_fileSystem.DirectoryExists(path))
|
||||
{
|
||||
throw new DirectoryNotFoundException("The media folder does not exist");
|
||||
throw new FileNotFoundException("The media folder does not exist");
|
||||
}
|
||||
|
||||
_libraryMonitorFactory().Stop();
|
||||
|
@ -3044,10 +3041,12 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
|
||||
if (!_fileSystem.DirectoryExists(virtualFolderPath))
|
||||
{
|
||||
throw new DirectoryNotFoundException(string.Format("The media collection {0} does not exist", virtualFolderName));
|
||||
throw new FileNotFoundException(string.Format("The media collection {0} does not exist", virtualFolderName));
|
||||
}
|
||||
|
||||
var shortcut = Directory.EnumerateFiles(virtualFolderPath, ShortcutFileSearch, SearchOption.AllDirectories).FirstOrDefault(f => _fileSystem.ResolveShortcut(f).Equals(mediaPath, StringComparison.OrdinalIgnoreCase));
|
||||
var shortcut = _fileSystem.GetFilePaths(virtualFolderPath, true)
|
||||
.Where(i => string.Equals(ShortcutFileExtension, Path.GetExtension(i), StringComparison.OrdinalIgnoreCase))
|
||||
.FirstOrDefault(f => _fileSystem.ResolveShortcut(f).Equals(mediaPath, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (!string.IsNullOrEmpty(shortcut))
|
||||
{
|
|
@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
|||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library
|
||||
namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
public class LocalTrailerPostScanTask : ILibraryPostScanTask
|
||||
{
|
|
@ -18,8 +18,9 @@ using MediaBrowser.Common.IO;
|
|||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Threading;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library
|
||||
namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
public class MediaSourceManager : IMediaSourceManager, IDisposable
|
||||
{
|
||||
|
@ -32,8 +33,9 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
private IMediaSourceProvider[] _providers;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IUserDataManager _userDataManager;
|
||||
private readonly ITimerFactory _timerFactory;
|
||||
|
||||
public MediaSourceManager(IItemRepository itemRepo, IUserManager userManager, ILibraryManager libraryManager, ILogger logger, IJsonSerializer jsonSerializer, IFileSystem fileSystem, IUserDataManager userDataManager)
|
||||
public MediaSourceManager(IItemRepository itemRepo, IUserManager userManager, ILibraryManager libraryManager, ILogger logger, IJsonSerializer jsonSerializer, IFileSystem fileSystem, IUserDataManager userDataManager, ITimerFactory timerFactory)
|
||||
{
|
||||
_itemRepo = itemRepo;
|
||||
_userManager = userManager;
|
||||
|
@ -42,6 +44,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
_jsonSerializer = jsonSerializer;
|
||||
_fileSystem = fileSystem;
|
||||
_userDataManager = userDataManager;
|
||||
_timerFactory = timerFactory;
|
||||
}
|
||||
|
||||
public void AddParts(IEnumerable<IMediaSourceProvider> providers)
|
||||
|
@ -551,14 +554,14 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
return new Tuple<IMediaSourceProvider, string>(provider, keyId);
|
||||
}
|
||||
|
||||
private Timer _closeTimer;
|
||||
private ITimer _closeTimer;
|
||||
private readonly TimeSpan _openStreamMaxAge = TimeSpan.FromSeconds(180);
|
||||
|
||||
private void StartCloseTimer()
|
||||
{
|
||||
StopCloseTimer();
|
||||
|
||||
_closeTimer = new Timer(CloseTimerCallback, null, _openStreamMaxAge, _openStreamMaxAge);
|
||||
_closeTimer = _timerFactory.Create(CloseTimerCallback, null, _openStreamMaxAge, _openStreamMaxAge);
|
||||
}
|
||||
|
||||
private void StopCloseTimer()
|
|
@ -6,7 +6,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library
|
||||
namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
public class MusicManager : IMusicManager
|
||||
{
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library
|
||||
namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
public static class PathExtensions
|
||||
{
|
|
@ -9,7 +9,7 @@ using MediaBrowser.Common.IO;
|
|||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library
|
||||
namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
/// <summary>
|
||||
/// Class ResolverHelper
|
||||
|
@ -112,7 +112,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
/// <summary>
|
||||
/// The MB name regex
|
||||
/// </summary>
|
||||
private static readonly Regex MbNameRegex = new Regex(@"(\[.*?\])", RegexOptions.Compiled);
|
||||
private static readonly Regex MbNameRegex = new Regex(@"(\[.*?\])");
|
||||
|
||||
internal static string StripBrackets(string inputString)
|
||||
{
|
|
@ -3,12 +3,12 @@ using MediaBrowser.Controller.Resolvers;
|
|||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
|
||||
namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||
{
|
||||
/// <summary>
|
||||
/// Class AudioResolver
|
||||
/// </summary>
|
||||
public class AudioResolver : ItemResolver<Controller.Entities.Audio.Audio>
|
||||
public class AudioResolver : ItemResolver<MediaBrowser.Controller.Entities.Audio.Audio>
|
||||
{
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
|
@ -31,7 +31,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
|
|||
/// </summary>
|
||||
/// <param name="args">The args.</param>
|
||||
/// <returns>Entities.Audio.Audio.</returns>
|
||||
protected override Controller.Entities.Audio.Audio Resolve(ItemResolveArgs args)
|
||||
protected override MediaBrowser.Controller.Entities.Audio.Audio Resolve(ItemResolveArgs args)
|
||||
{
|
||||
// Return audio if the path is a file and has a matching extension
|
||||
|
||||
|
@ -57,7 +57,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
|
|||
string.Equals(collectionType, CollectionType.Music, StringComparison.OrdinalIgnoreCase) ||
|
||||
isMixed)
|
||||
{
|
||||
return new Controller.Entities.Audio.Audio();
|
||||
return new MediaBrowser.Controller.Entities.Audio.Audio();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,17 +5,17 @@ using MediaBrowser.Controller.Resolvers;
|
|||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Naming.Audio;
|
||||
using MediaBrowser.Server.Implementations.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Emby.Server.Implementations.Logging;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
|
||||
namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||
{
|
||||
/// <summary>
|
||||
/// Class MusicAlbumResolver
|
|
@ -11,7 +11,7 @@ using MediaBrowser.Model.IO;
|
|||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
|
||||
namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||
{
|
||||
/// <summary>
|
||||
/// Class MusicArtistResolver
|
|
@ -2,17 +2,17 @@
|
|||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Naming.Video;
|
||||
using MediaBrowser.Server.Implementations.Logging;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Emby.Server.Implementations.Logging;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Resolvers
|
||||
namespace Emby.Server.Implementations.Library.Resolvers
|
||||
{
|
||||
/// <summary>
|
||||
/// Resolves a Path into a Video or Video subclass
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public abstract class BaseVideoResolver<T> : Controller.Resolvers.ItemResolver<T>
|
||||
public abstract class BaseVideoResolver<T> : MediaBrowser.Controller.Resolvers.ItemResolver<T>
|
||||
where T : Video, new()
|
||||
{
|
||||
protected readonly ILibraryManager LibraryManager;
|
||||
|
@ -45,7 +45,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers
|
|||
var namingOptions = ((LibraryManager)LibraryManager).GetNamingOptions();
|
||||
|
||||
// If the path is a file check for a matching extensions
|
||||
var parser = new Naming.Video.VideoResolver(namingOptions, new PatternsLogger());
|
||||
var parser = new MediaBrowser.Naming.Video.VideoResolver(namingOptions, new PatternsLogger());
|
||||
|
||||
if (args.IsDirectory)
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Resolvers;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Resolvers
|
||||
namespace Emby.Server.Implementations.Library.Resolvers
|
||||
{
|
||||
/// <summary>
|
||||
/// Class FolderResolver
|
|
@ -2,7 +2,7 @@
|
|||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Resolvers;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Resolvers
|
||||
namespace Emby.Server.Implementations.Library.Resolvers
|
||||
{
|
||||
/// <summary>
|
||||
/// Class ItemResolver
|
|
@ -5,7 +5,7 @@ using MediaBrowser.Model.Entities;
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
||||
namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||
{
|
||||
/// <summary>
|
||||
/// Class BoxSetResolver
|
|
@ -7,16 +7,16 @@ using MediaBrowser.Controller.Resolvers;
|
|||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
using MediaBrowser.Naming.Video;
|
||||
using MediaBrowser.Server.Implementations.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Emby.Server.Implementations.Logging;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
||||
namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||
{
|
||||
/// <summary>
|
||||
/// Class MovieResolver
|
|
@ -7,7 +7,7 @@ using System;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Resolvers
|
||||
namespace Emby.Server.Implementations.Library.Resolvers
|
||||
{
|
||||
public class PhotoAlbumResolver : FolderResolver<PhotoAlbum>
|
||||
{
|
|
@ -11,7 +11,7 @@ using MediaBrowser.Controller.Configuration;
|
|||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Resolvers
|
||||
namespace Emby.Server.Implementations.Library.Resolvers
|
||||
{
|
||||
public class PhotoResolver : ItemResolver<Photo>
|
||||
{
|
|
@ -3,7 +3,7 @@ using MediaBrowser.Controller.Playlists;
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Resolvers
|
||||
namespace Emby.Server.Implementations.Library.Resolvers
|
||||
{
|
||||
public class PlaylistResolver : FolderResolver<Playlist>
|
||||
{
|
|
@ -9,7 +9,7 @@ using MediaBrowser.Common.IO;
|
|||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Resolvers
|
||||
namespace Emby.Server.Implementations.Library.Resolvers
|
||||
{
|
||||
class SpecialFolderResolver : FolderResolver<Folder>
|
||||
{
|
|
@ -4,7 +4,7 @@ using MediaBrowser.Controller.Library;
|
|||
using System.Linq;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
|
||||
namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||
{
|
||||
/// <summary>
|
||||
/// Class EpisodeResolver
|
|
@ -4,7 +4,7 @@ using MediaBrowser.Controller.Library;
|
|||
using MediaBrowser.Naming.Common;
|
||||
using MediaBrowser.Naming.TV;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
|
||||
namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||
{
|
||||
/// <summary>
|
||||
/// Class SeasonResolver
|
|
@ -6,18 +6,18 @@ using MediaBrowser.Model.Entities;
|
|||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Naming.Common;
|
||||
using MediaBrowser.Naming.TV;
|
||||
using MediaBrowser.Server.Implementations.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Emby.Server.Implementations.Logging;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
|
||||
namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||
{
|
||||
/// <summary>
|
||||
/// Class SeriesResolver
|
||||
|
@ -171,7 +171,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
|
|||
.ToList();
|
||||
}
|
||||
|
||||
var episodeResolver = new Naming.TV.EpisodeResolver(namingOptions, new PatternsLogger());
|
||||
var episodeResolver = new MediaBrowser.Naming.TV.EpisodeResolver(namingOptions, new PatternsLogger());
|
||||
var episodeInfo = episodeResolver.Resolve(fullName, false, false);
|
||||
if (episodeInfo != null && episodeInfo.EpisodeNumber.HasValue)
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Resolvers;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Resolvers
|
||||
namespace Emby.Server.Implementations.Library.Resolvers
|
||||
{
|
||||
/// <summary>
|
||||
/// Resolves a Path into a Video
|
|
@ -1,7 +1,5 @@
|
|||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Querying;
|
||||
|
@ -11,13 +9,10 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Extensions;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library
|
||||
namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
/// <summary>
|
||||
/// Class LuceneSearchEngine
|
||||
/// http://www.codeproject.com/Articles/320219/Lucene-Net-ultra-fast-search-for-MVC-or-WebForms
|
||||
/// </summary>
|
||||
public class SearchEngine : ISearchEngine
|
||||
{
|
|
@ -13,7 +13,7 @@ using System.Collections.Generic;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library
|
||||
namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UserDataManager
|
|
@ -23,15 +23,13 @@ using System.Collections.Generic;
|
|||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.Cryptography;
|
||||
using MediaBrowser.Model.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library
|
||||
namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UserManager
|
||||
|
@ -72,8 +70,10 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
private readonly Func<IConnectManager> _connectFactory;
|
||||
private readonly IServerApplicationHost _appHost;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly ICryptographyProvider _cryptographyProvider;
|
||||
private readonly string _defaultUserName;
|
||||
|
||||
public UserManager(ILogger logger, IServerConfigurationManager configurationManager, IUserRepository userRepository, IXmlSerializer xmlSerializer, INetworkManager networkManager, Func<IImageProcessor> imageProcessorFactory, Func<IDtoService> dtoServiceFactory, Func<IConnectManager> connectFactory, IServerApplicationHost appHost, IJsonSerializer jsonSerializer, IFileSystem fileSystem)
|
||||
public UserManager(ILogger logger, IServerConfigurationManager configurationManager, IUserRepository userRepository, IXmlSerializer xmlSerializer, INetworkManager networkManager, Func<IImageProcessor> imageProcessorFactory, Func<IDtoService> dtoServiceFactory, Func<IConnectManager> connectFactory, IServerApplicationHost appHost, IJsonSerializer jsonSerializer, IFileSystem fileSystem, ICryptographyProvider cryptographyProvider, string defaultUserName)
|
||||
{
|
||||
_logger = logger;
|
||||
UserRepository = userRepository;
|
||||
|
@ -85,6 +85,8 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
_appHost = appHost;
|
||||
_jsonSerializer = jsonSerializer;
|
||||
_fileSystem = fileSystem;
|
||||
_cryptographyProvider = cryptographyProvider;
|
||||
_defaultUserName = defaultUserName;
|
||||
ConfigurationManager = configurationManager;
|
||||
Users = new List<User>();
|
||||
|
||||
|
@ -188,7 +190,14 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
public bool IsValidUsername(string username)
|
||||
{
|
||||
// Usernames can contain letters (a-z), numbers (0-9), dashes (-), underscores (_), apostrophes ('), and periods (.)
|
||||
return username.All(IsValidUsernameCharacter);
|
||||
foreach (var currentChar in username)
|
||||
{
|
||||
if (!IsValidUsernameCharacter(currentChar))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool IsValidUsernameCharacter(char i)
|
||||
|
@ -273,8 +282,8 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
{
|
||||
user.Policy.InvalidLoginAttemptCount = newValue;
|
||||
|
||||
var maxCount = user.Policy.IsAdministrator ?
|
||||
3 :
|
||||
var maxCount = user.Policy.IsAdministrator ?
|
||||
3 :
|
||||
5;
|
||||
|
||||
var fireLockout = false;
|
||||
|
@ -323,13 +332,9 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
/// </summary>
|
||||
/// <param name="str">The STR.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
private static string GetSha1String(string str)
|
||||
private string GetSha1String(string str)
|
||||
{
|
||||
using (var provider = SHA1.Create())
|
||||
{
|
||||
var hash = provider.ComputeHash(Encoding.UTF8.GetBytes(str));
|
||||
return BitConverter.ToString(hash).Replace("-", string.Empty);
|
||||
}
|
||||
return BitConverter.ToString(_cryptographyProvider.GetSHA1Bytes(Encoding.UTF8.GetBytes(str))).Replace("-", string.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -343,7 +348,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
// There always has to be at least one user.
|
||||
if (users.Count == 0)
|
||||
{
|
||||
var name = MakeValidUsername(Environment.UserName);
|
||||
var name = MakeValidUsername(_defaultUserName);
|
||||
|
||||
var user = InstantiateNewUser(name);
|
||||
|
||||
|
@ -741,9 +746,12 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
text.AppendLine(string.Empty);
|
||||
text.AppendLine(pin);
|
||||
text.AppendLine(string.Empty);
|
||||
text.AppendLine("The pin code will expire at " + expiration.ToLocalTime().ToShortDateString() + " " + expiration.ToLocalTime().ToShortTimeString());
|
||||
|
||||
_fileSystem.WriteAllText(path, text.ToString(), Encoding.UTF8);
|
||||
var localExpirationTime = expiration.ToLocalTime();
|
||||
// Tuesday, 22 August 2006 06:30 AM
|
||||
text.AppendLine("The pin code will expire at " + localExpirationTime.ToString("f1", CultureInfo.CurrentCulture));
|
||||
|
||||
_fileSystem.WriteAllText(path, text.ToString(), Encoding.UTF8);
|
||||
|
||||
var result = new PasswordPinCreationResult
|
||||
{
|
||||
|
@ -875,11 +883,11 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
return (UserPolicy)_xmlSerializer.DeserializeFromFile(typeof(UserPolicy), path);
|
||||
}
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
return GetDefaultPolicy(user);
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
catch (IOException)
|
||||
{
|
||||
return GetDefaultPolicy(user);
|
||||
}
|
||||
|
@ -917,7 +925,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
|
||||
var path = GetPolifyFilePath(user);
|
||||
|
||||
_fileSystem.CreateDirectory(Path.GetDirectoryName(path));
|
||||
_fileSystem.CreateDirectory(Path.GetDirectoryName(path));
|
||||
|
||||
lock (_policySyncLock)
|
||||
{
|
||||
|
@ -970,11 +978,11 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
return (UserConfiguration)_xmlSerializer.DeserializeFromFile(typeof(UserConfiguration), path);
|
||||
}
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
return new UserConfiguration();
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
catch (IOException)
|
||||
{
|
||||
return new UserConfiguration();
|
||||
}
|
||||
|
@ -1004,7 +1012,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
config = _jsonSerializer.DeserializeFromString<UserConfiguration>(json);
|
||||
}
|
||||
|
||||
_fileSystem.CreateDirectory(Path.GetDirectoryName(path));
|
||||
_fileSystem.CreateDirectory(Path.GetDirectoryName(path));
|
||||
|
||||
lock (_configSyncLock)
|
||||
{
|
|
@ -15,7 +15,7 @@ using System.Threading.Tasks;
|
|||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Model.Globalization;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library
|
||||
namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
public class UserViewManager : IUserViewManager
|
||||
{
|
|
@ -5,7 +5,7 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||
namespace Emby.Server.Implementations.Library.Validators
|
||||
{
|
||||
/// <summary>
|
||||
/// Class ArtistsPostScanTask
|
|
@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
|||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||
namespace Emby.Server.Implementations.Library.Validators
|
||||
{
|
||||
/// <summary>
|
||||
/// Class ArtistsValidator
|
|
@ -5,7 +5,7 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||
namespace Emby.Server.Implementations.Library.Validators
|
||||
{
|
||||
/// <summary>
|
||||
/// Class GameGenresPostScanTask
|
|
@ -7,7 +7,7 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||
namespace Emby.Server.Implementations.Library.Validators
|
||||
{
|
||||
class GameGenresValidator
|
||||
{
|
|
@ -5,7 +5,7 @@ using System.Threading.Tasks;
|
|||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||
namespace Emby.Server.Implementations.Library.Validators
|
||||
{
|
||||
public class GenresPostScanTask : ILibraryPostScanTask
|
||||
{
|
|
@ -8,7 +8,7 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||
namespace Emby.Server.Implementations.Library.Validators
|
||||
{
|
||||
class GenresValidator
|
||||
{
|
|
@ -5,7 +5,7 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||
namespace Emby.Server.Implementations.Library.Validators
|
||||
{
|
||||
/// <summary>
|
||||
/// Class MusicGenresPostScanTask
|
|
@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
|||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||
namespace Emby.Server.Implementations.Library.Validators
|
||||
{
|
||||
class MusicGenresValidator
|
||||
{
|
|
@ -15,7 +15,7 @@ using MediaBrowser.Common.IO;
|
|||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||
namespace Emby.Server.Implementations.Library.Validators
|
||||
{
|
||||
/// <summary>
|
||||
/// Class PeopleValidator
|
|
@ -5,7 +5,7 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||
namespace Emby.Server.Implementations.Library.Validators
|
||||
{
|
||||
/// <summary>
|
||||
/// Class MusicGenresPostScanTask
|
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
|||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||
namespace Emby.Server.Implementations.Library.Validators
|
||||
{
|
||||
class StudiosValidator
|
||||
{
|
|
@ -4,7 +4,7 @@ using System;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||
namespace Emby.Server.Implementations.Library.Validators
|
||||
{
|
||||
public class YearsPostScanTask : ILibraryPostScanTask
|
||||
{
|
|
@ -11,7 +11,7 @@ using System.Linq;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
public class ChannelImageProvider : IDynamicImageProvider, IHasItemChangeMonitor
|
||||
{
|
|
@ -9,7 +9,7 @@ using MediaBrowser.Controller.IO;
|
|||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
public class DirectRecorder : IRecorder
|
||||
{
|
|
@ -15,7 +15,6 @@ using MediaBrowser.Model.Events;
|
|||
using MediaBrowser.Model.LiveTv;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Server.Implementations.FileOrganization;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
|
@ -35,10 +34,12 @@ using MediaBrowser.Controller.Entities;
|
|||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Diagnostics;
|
||||
using MediaBrowser.Model.FileOrganization;
|
||||
using Microsoft.Win32;
|
||||
using MediaBrowser.Model.System;
|
||||
using MediaBrowser.Model.Threading;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
public class EmbyTV : ILiveTvService, ISupportsDirectStreamProvider, ISupportsNewTimerIds, IDisposable
|
||||
{
|
||||
|
@ -59,6 +60,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
private readonly IProviderManager _providerManager;
|
||||
private readonly IFileOrganizationService _organizationService;
|
||||
private readonly IMediaEncoder _mediaEncoder;
|
||||
private readonly IProcessFactory _processFactory;
|
||||
private readonly ISystemEvents _systemEvents;
|
||||
|
||||
public static EmbyTV Current;
|
||||
|
||||
|
@ -68,7 +71,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
private readonly ConcurrentDictionary<string, ActiveRecordingInfo> _activeRecordings =
|
||||
new ConcurrentDictionary<string, ActiveRecordingInfo>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
public EmbyTV(IServerApplicationHost appHost, ILogger logger, IJsonSerializer jsonSerializer, IHttpClient httpClient, IServerConfigurationManager config, ILiveTvManager liveTvManager, IFileSystem fileSystem, ILibraryManager libraryManager, ILibraryMonitor libraryMonitor, IProviderManager providerManager, IFileOrganizationService organizationService, IMediaEncoder mediaEncoder)
|
||||
public EmbyTV(IServerApplicationHost appHost, ILogger logger, IJsonSerializer jsonSerializer, IHttpClient httpClient, IServerConfigurationManager config, ILiveTvManager liveTvManager, IFileSystem fileSystem, ILibraryManager libraryManager, ILibraryMonitor libraryMonitor, IProviderManager providerManager, IFileOrganizationService organizationService, IMediaEncoder mediaEncoder, ITimerFactory timerFactory, IProcessFactory processFactory, ISystemEvents systemEvents)
|
||||
{
|
||||
Current = this;
|
||||
|
||||
|
@ -82,11 +85,13 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
_providerManager = providerManager;
|
||||
_organizationService = organizationService;
|
||||
_mediaEncoder = mediaEncoder;
|
||||
_processFactory = processFactory;
|
||||
_systemEvents = systemEvents;
|
||||
_liveTvManager = (LiveTvManager)liveTvManager;
|
||||
_jsonSerializer = jsonSerializer;
|
||||
|
||||
_seriesTimerProvider = new SeriesTimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "seriestimers"));
|
||||
_timerProvider = new TimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "timers"), _logger);
|
||||
_timerProvider = new TimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "timers"), _logger, timerFactory);
|
||||
_timerProvider.TimerFired += _timerProvider_TimerFired;
|
||||
|
||||
_config.NamedConfigurationUpdated += _config_NamedConfigurationUpdated;
|
||||
|
@ -104,10 +109,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
{
|
||||
_timerProvider.RestartTimers();
|
||||
|
||||
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
|
||||
_systemEvents.Resume += _systemEvents_Resume;
|
||||
CreateRecordingFolders();
|
||||
}
|
||||
|
||||
private void _systemEvents_Resume(object sender, EventArgs e)
|
||||
{
|
||||
_timerProvider.RestartTimers();
|
||||
}
|
||||
|
||||
private void OnRecordingFoldersChanged()
|
||||
{
|
||||
CreateRecordingFolders();
|
||||
|
@ -231,16 +241,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
}
|
||||
}
|
||||
|
||||
void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
|
||||
{
|
||||
_logger.Info("Power mode changed to {0}", e.Mode);
|
||||
|
||||
if (e.Mode == PowerModes.Resume)
|
||||
{
|
||||
_timerProvider.RestartTimers();
|
||||
}
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "Emby"; }
|
||||
|
@ -988,7 +988,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
_liveStreamsSemaphore.Release();
|
||||
}
|
||||
|
||||
throw new ApplicationException("Tuner not found.");
|
||||
throw new Exception("Tuner not found.");
|
||||
}
|
||||
|
||||
public async Task<List<MediaSourceInfo>> GetChannelStreamMediaSources(string channelId, CancellationToken cancellationToken)
|
||||
|
@ -1031,7 +1031,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
IsInfiniteStream = true,
|
||||
RequiresOpening = false,
|
||||
RequiresClosing = false,
|
||||
Protocol = Model.MediaInfo.MediaProtocol.Http,
|
||||
Protocol = MediaBrowser.Model.MediaInfo.MediaProtocol.Http,
|
||||
BufferMs = 0
|
||||
};
|
||||
|
||||
|
@ -1353,7 +1353,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
timer.StartDate = DateTime.UtcNow.AddSeconds(retryIntervalSeconds);
|
||||
_timerProvider.AddOrUpdate(timer);
|
||||
}
|
||||
else if (File.Exists(recordPath))
|
||||
else if (_fileSystem.FileExists(recordPath))
|
||||
{
|
||||
timer.RecordingPath = recordPath;
|
||||
timer.Status = RecordingStatus.Completed;
|
||||
|
@ -1409,7 +1409,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
.Where(i => i.Status == RecordingStatus.Completed && !string.IsNullOrWhiteSpace(i.RecordingPath))
|
||||
.Where(i => string.Equals(i.SeriesTimerId, seriesTimerId, StringComparison.OrdinalIgnoreCase))
|
||||
.OrderByDescending(i => i.EndDate)
|
||||
.Where(i => File.Exists(i.RecordingPath))
|
||||
.Where(i => _fileSystem.FileExists(i.RecordingPath))
|
||||
.Skip(seriesTimer.KeepUpTo - 1)
|
||||
.ToList();
|
||||
|
||||
|
@ -1457,13 +1457,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
{
|
||||
try
|
||||
{
|
||||
File.Delete(timer.RecordingPath);
|
||||
_fileSystem.DeleteFile(timer.RecordingPath);
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
{
|
||||
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
catch (IOException)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -1519,7 +1515,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
|
||||
if (regInfo.IsValid)
|
||||
{
|
||||
return new EncodedRecorder(_logger, _fileSystem, _mediaEncoder, _config.ApplicationPaths, _jsonSerializer, config, _httpClient);
|
||||
return new EncodedRecorder(_logger, _fileSystem, _mediaEncoder, _config.ApplicationPaths, _jsonSerializer, config, _httpClient, _processFactory);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1528,28 +1524,28 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
|
||||
private async void OnSuccessfulRecording(TimerInfo timer, string path)
|
||||
{
|
||||
if (timer.IsProgramSeries && GetConfiguration().EnableAutoOrganize)
|
||||
{
|
||||
try
|
||||
{
|
||||
// this is to account for the library monitor holding a lock for additional time after the change is complete.
|
||||
// ideally this shouldn't be hard-coded
|
||||
await Task.Delay(30000).ConfigureAwait(false);
|
||||
//if (timer.IsProgramSeries && GetConfiguration().EnableAutoOrganize)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// // this is to account for the library monitor holding a lock for additional time after the change is complete.
|
||||
// // ideally this shouldn't be hard-coded
|
||||
// await Task.Delay(30000).ConfigureAwait(false);
|
||||
|
||||
var organize = new EpisodeFileOrganizer(_organizationService, _config, _fileSystem, _logger, _libraryManager, _libraryMonitor, _providerManager);
|
||||
// var organize = new EpisodeFileOrganizer(_organizationService, _config, _fileSystem, _logger, _libraryManager, _libraryMonitor, _providerManager);
|
||||
|
||||
var result = await organize.OrganizeEpisodeFile(path, _config.GetAutoOrganizeOptions(), false, CancellationToken.None).ConfigureAwait(false);
|
||||
// var result = await organize.OrganizeEpisodeFile(path, _config.GetAutoOrganizeOptions(), false, CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
if (result.Status == FileSortingStatus.Success)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error processing new recording", ex);
|
||||
}
|
||||
}
|
||||
// if (result.Status == FileSortingStatus.Success)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// _logger.ErrorException("Error processing new recording", ex);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
private void SaveNfo(TimerInfo timer, string recordingPath, string seriesPath)
|
||||
|
@ -1575,7 +1571,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
{
|
||||
var nfoPath = Path.Combine(seriesPath, "tvshow.nfo");
|
||||
|
||||
if (File.Exists(nfoPath))
|
||||
if (_fileSystem.FileExists(nfoPath))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1610,7 +1606,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
{
|
||||
var nfoPath = Path.ChangeExtension(recordingPath, ".nfo");
|
||||
|
||||
if (File.Exists(nfoPath))
|
||||
if (_fileSystem.FileExists(nfoPath))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1931,7 +1927,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
var defaultFolder = RecordingPath;
|
||||
var defaultName = "Recordings";
|
||||
|
||||
if (Directory.Exists(defaultFolder))
|
||||
if (_fileSystem.DirectoryExists(defaultFolder))
|
||||
{
|
||||
list.Add(new VirtualFolderInfo
|
||||
{
|
||||
|
@ -1941,7 +1937,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
}
|
||||
|
||||
var customPath = GetConfiguration().MovieRecordingPath;
|
||||
if ((!string.IsNullOrWhiteSpace(customPath) && !string.Equals(customPath, defaultFolder, StringComparison.OrdinalIgnoreCase)) && Directory.Exists(customPath))
|
||||
if ((!string.IsNullOrWhiteSpace(customPath) && !string.Equals(customPath, defaultFolder, StringComparison.OrdinalIgnoreCase)) && _fileSystem.DirectoryExists(customPath))
|
||||
{
|
||||
list.Add(new VirtualFolderInfo
|
||||
{
|
||||
|
@ -1952,7 +1948,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
}
|
||||
|
||||
customPath = GetConfiguration().SeriesRecordingPath;
|
||||
if ((!string.IsNullOrWhiteSpace(customPath) && !string.Equals(customPath, defaultFolder, StringComparison.OrdinalIgnoreCase)) && Directory.Exists(customPath))
|
||||
if ((!string.IsNullOrWhiteSpace(customPath) && !string.Equals(customPath, defaultFolder, StringComparison.OrdinalIgnoreCase)) && _fileSystem.DirectoryExists(customPath))
|
||||
{
|
||||
list.Add(new VirtualFolderInfo
|
||||
{
|
|
@ -1,7 +1,7 @@
|
|||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Security;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
public class EmbyTVRegistration : IRequiresRegistration
|
||||
{
|
|
@ -13,13 +13,14 @@ using MediaBrowser.Common.Net;
|
|||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Controller.MediaEncoding;
|
||||
using MediaBrowser.Model.Diagnostics;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.LiveTv;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
public class EncodedRecorder : IRecorder
|
||||
{
|
||||
|
@ -32,11 +33,12 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
private bool _hasExited;
|
||||
private Stream _logFileStream;
|
||||
private string _targetPath;
|
||||
private Process _process;
|
||||
private IProcess _process;
|
||||
private readonly IProcessFactory _processFactory;
|
||||
private readonly IJsonSerializer _json;
|
||||
private readonly TaskCompletionSource<bool> _taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
public EncodedRecorder(ILogger logger, IFileSystem fileSystem, IMediaEncoder mediaEncoder, IServerApplicationPaths appPaths, IJsonSerializer json, LiveTvOptions liveTvOptions, IHttpClient httpClient)
|
||||
public EncodedRecorder(ILogger logger, IFileSystem fileSystem, IMediaEncoder mediaEncoder, IServerApplicationPaths appPaths, IJsonSerializer json, LiveTvOptions liveTvOptions, IHttpClient httpClient, IProcessFactory processFactory)
|
||||
{
|
||||
_logger = logger;
|
||||
_fileSystem = fileSystem;
|
||||
|
@ -45,6 +47,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
_json = json;
|
||||
_liveTvOptions = liveTvOptions;
|
||||
_httpClient = httpClient;
|
||||
_processFactory = processFactory;
|
||||
}
|
||||
|
||||
private string OutputFormat
|
||||
|
@ -82,27 +85,23 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
_targetPath = targetFile;
|
||||
_fileSystem.CreateDirectory(Path.GetDirectoryName(targetFile));
|
||||
|
||||
var process = new Process
|
||||
var process = _processFactory.Create(new ProcessOptions
|
||||
{
|
||||
StartInfo = new ProcessStartInfo
|
||||
{
|
||||
CreateNoWindow = true,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true,
|
||||
UseShellExecute = false,
|
||||
|
||||
// Must consume both stdout and stderr or deadlocks may occur
|
||||
//RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
RedirectStandardInput = true,
|
||||
// Must consume both stdout and stderr or deadlocks may occur
|
||||
//RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
RedirectStandardInput = true,
|
||||
|
||||
FileName = _mediaEncoder.EncoderPath,
|
||||
Arguments = GetCommandLineArgs(mediaSource, inputFile, targetFile, duration),
|
||||
|
||||
WindowStyle = ProcessWindowStyle.Hidden,
|
||||
ErrorDialog = false
|
||||
},
|
||||
FileName = _mediaEncoder.EncoderPath,
|
||||
Arguments = GetCommandLineArgs(mediaSource, inputFile, targetFile, duration),
|
||||
|
||||
IsHidden = true,
|
||||
ErrorDialog = false,
|
||||
EnableRaisingEvents = true
|
||||
};
|
||||
});
|
||||
|
||||
_process = process;
|
||||
|
||||
|
@ -251,7 +250,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
/// <summary>
|
||||
/// Processes the exited.
|
||||
/// </summary>
|
||||
private void OnFfMpegProcessExited(Process process, string inputFile)
|
||||
private void OnFfMpegProcessExited(IProcess process, string inputFile)
|
||||
{
|
||||
_hasExited = true;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using MediaBrowser.Controller.Plugins;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
public class EntryPoint : IServerEntryPoint
|
||||
{
|
|
@ -3,7 +3,7 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Dto;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
public interface IRecorder
|
||||
{
|
|
@ -8,7 +8,7 @@ using MediaBrowser.Common.IO;
|
|||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
public class ItemDataProvider<T>
|
||||
where T : class
|
||||
|
@ -54,9 +54,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
catch (FileNotFoundException)
|
||||
{
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
{
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.ErrorException("Error deserializing {0}", ex, jsonFile);
|
|
@ -4,7 +4,7 @@ using System;
|
|||
using System.Globalization;
|
||||
using MediaBrowser.Model.LiveTv;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
internal class RecordingHelper
|
||||
{
|
|
@ -6,7 +6,7 @@ using MediaBrowser.Common.IO;
|
|||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
public class SeriesTimerManager : ItemDataProvider<SeriesTimerInfo>
|
||||
{
|
|
@ -12,20 +12,23 @@ using MediaBrowser.Common.IO;
|
|||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.LiveTv;
|
||||
using MediaBrowser.Model.Threading;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
public class TimerManager : ItemDataProvider<TimerInfo>
|
||||
{
|
||||
private readonly ConcurrentDictionary<string, Timer> _timers = new ConcurrentDictionary<string, Timer>(StringComparer.OrdinalIgnoreCase);
|
||||
private readonly ConcurrentDictionary<string, ITimer> _timers = new ConcurrentDictionary<string, ITimer>(StringComparer.OrdinalIgnoreCase);
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public event EventHandler<GenericEventArgs<TimerInfo>> TimerFired;
|
||||
private readonly ITimerFactory _timerFactory;
|
||||
|
||||
public TimerManager(IFileSystem fileSystem, IJsonSerializer jsonSerializer, ILogger logger, string dataPath, ILogger logger1)
|
||||
public TimerManager(IFileSystem fileSystem, IJsonSerializer jsonSerializer, ILogger logger, string dataPath, ILogger logger1, ITimerFactory timerFactory)
|
||||
: base(fileSystem, jsonSerializer, logger, dataPath, (r1, r2) => string.Equals(r1.Id, r2.Id, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
_logger = logger1;
|
||||
_timerFactory = timerFactory;
|
||||
}
|
||||
|
||||
public void RestartTimers()
|
||||
|
@ -126,7 +129,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
|
||||
private void StartTimer(TimerInfo item, TimeSpan dueTime)
|
||||
{
|
||||
var timer = new Timer(TimerCallback, item.Id, dueTime, TimeSpan.Zero);
|
||||
var timer = _timerFactory.Create(TimerCallback, item.Id, dueTime, TimeSpan.Zero);
|
||||
|
||||
if (_timers.TryAdd(item.Id, timer))
|
||||
{
|
||||
|
@ -141,7 +144,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
|
||||
private void StopTimer(TimerInfo item)
|
||||
{
|
||||
Timer timer;
|
||||
ITimer timer;
|
||||
if (_timers.TryRemove(item.Id, out timer))
|
||||
{
|
||||
timer.Dispose();
|
|
@ -16,7 +16,7 @@ using System.Linq;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
||||
namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
{
|
||||
public class SchedulesDirect : IListingsProvider
|
||||
{
|
||||
|
@ -589,13 +589,14 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||
{
|
||||
var imageIdString = "[";
|
||||
|
||||
programIds.ForEach(i =>
|
||||
foreach (var i in programIds)
|
||||
{
|
||||
if (!imageIdString.Contains(i.Substring(0, 10)))
|
||||
{
|
||||
imageIdString += "\"" + i.Substring(0, 10) + "\",";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
imageIdString = imageIdString.TrimEnd(',') + "]";
|
||||
|
||||
var httpOptions = new HttpRequestOptions()
|
||||
|
@ -822,7 +823,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||
return root.token;
|
||||
}
|
||||
|
||||
throw new ApplicationException("Could not authenticate with Schedules Direct Error: " + root.message);
|
||||
throw new Exception("Could not authenticate with Schedules Direct Error: " + root.message);
|
||||
}
|
||||
}
|
||||
|
|
@ -15,21 +15,24 @@ using Emby.XmlTv.Entities;
|
|||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
||||
namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
{
|
||||
public class XmlTvListingsProvider : IListingsProvider
|
||||
{
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
public XmlTvListingsProvider(IServerConfigurationManager config, IHttpClient httpClient, ILogger logger)
|
||||
public XmlTvListingsProvider(IServerConfigurationManager config, IHttpClient httpClient, ILogger logger, IFileSystem fileSystem)
|
||||
{
|
||||
_config = config;
|
||||
_httpClient = httpClient;
|
||||
_logger = logger;
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
||||
public string Name
|
||||
|
@ -58,7 +61,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||
|
||||
var cacheFilename = DateTime.UtcNow.DayOfYear.ToString(CultureInfo.InvariantCulture) + "-" + DateTime.UtcNow.Hour.ToString(CultureInfo.InvariantCulture) + ".xml";
|
||||
var cacheFile = Path.Combine(_config.ApplicationPaths.CachePath, "xmltv", cacheFilename);
|
||||
if (File.Exists(cacheFile))
|
||||
if (_fileSystem.FileExists(cacheFile))
|
||||
{
|
||||
return cacheFile;
|
||||
}
|
||||
|
@ -70,7 +73,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||
CancellationToken = cancellationToken,
|
||||
Url = path,
|
||||
Progress = new Progress<Double>(),
|
||||
DecompressionMethod = DecompressionMethods.GZip,
|
||||
DecompressionMethod = CompressionMethod.Gzip,
|
||||
|
||||
// It's going to come back gzipped regardless of this value
|
||||
// So we need to make sure the decompression method is set to gzip
|
||||
|
@ -78,13 +81,13 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(cacheFile));
|
||||
_fileSystem.CreateDirectory(Path.GetDirectoryName(cacheFile));
|
||||
|
||||
using (var stream = File.OpenRead(tempFile))
|
||||
using (var stream = _fileSystem.OpenRead(tempFile))
|
||||
{
|
||||
using (var reader = new StreamReader(stream, Encoding.UTF8))
|
||||
{
|
||||
using (var fileStream = File.OpenWrite(cacheFile))
|
||||
using (var fileStream = _fileSystem.GetFileStream(cacheFile, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
|
||||
{
|
||||
using (var writer = new StreamWriter(fileStream))
|
||||
{
|
||||
|
@ -138,10 +141,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||
IsSeries = p.Episode != null,
|
||||
IsRepeat = p.IsRepeat,
|
||||
IsPremiere = p.Premiere != null,
|
||||
IsKids = p.Categories.Any(c => info.KidsCategories.Contains(c, StringComparer.InvariantCultureIgnoreCase)),
|
||||
IsMovie = p.Categories.Any(c => info.MovieCategories.Contains(c, StringComparer.InvariantCultureIgnoreCase)),
|
||||
IsNews = p.Categories.Any(c => info.NewsCategories.Contains(c, StringComparer.InvariantCultureIgnoreCase)),
|
||||
IsSports = p.Categories.Any(c => info.SportsCategories.Contains(c, StringComparer.InvariantCultureIgnoreCase)),
|
||||
IsKids = p.Categories.Any(c => info.KidsCategories.Contains(c, StringComparer.OrdinalIgnoreCase)),
|
||||
IsMovie = p.Categories.Any(c => info.MovieCategories.Contains(c, StringComparer.OrdinalIgnoreCase)),
|
||||
IsNews = p.Categories.Any(c => info.NewsCategories.Contains(c, StringComparer.OrdinalIgnoreCase)),
|
||||
IsSports = p.Categories.Any(c => info.SportsCategories.Contains(c, StringComparer.OrdinalIgnoreCase)),
|
||||
ImageUrl = p.Icon != null && !String.IsNullOrEmpty(p.Icon.Source) ? p.Icon.Source : null,
|
||||
HasImage = p.Icon != null && !String.IsNullOrEmpty(p.Icon.Source),
|
||||
OfficialRating = p.Rating != null && !String.IsNullOrEmpty(p.Rating.Value) ? p.Rating.Value : null,
|
||||
|
@ -177,7 +180,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||
|
||||
if (channels != null)
|
||||
{
|
||||
channels.ForEach(c =>
|
||||
foreach (var c in channels)
|
||||
{
|
||||
var channelNumber = info.GetMappedChannel(c.Number);
|
||||
var match = results.FirstOrDefault(r => string.Equals(r.Id, channelNumber, StringComparison.OrdinalIgnoreCase));
|
||||
|
@ -186,14 +189,14 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||
{
|
||||
c.ImageUrl = match.Icon.Source;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Task Validate(ListingsProviderInfo info, bool validateLogin, bool validateListings)
|
||||
{
|
||||
// Assume all urls are valid. check files for existence
|
||||
if (!info.Path.StartsWith("http", StringComparison.OrdinalIgnoreCase) && !File.Exists(info.Path))
|
||||
if (!info.Path.StartsWith("http", StringComparison.OrdinalIgnoreCase) && !_fileSystem.FileExists(info.Path))
|
||||
{
|
||||
throw new FileNotFoundException("Could not find the XmlTv file specified:", info.Path);
|
||||
}
|
|
@ -8,7 +8,7 @@ using MediaBrowser.Model.Dlna;
|
|||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
public class LiveStreamHelper
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
mediaSource.RunTimeTicks = null;
|
||||
}
|
||||
|
||||
var audioStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == Model.Entities.MediaStreamType.Audio);
|
||||
var audioStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == MediaBrowser.Model.Entities.MediaStreamType.Audio);
|
||||
|
||||
if (audioStream == null || audioStream.Index == -1)
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
mediaSource.DefaultAudioStreamIndex = audioStream.Index;
|
||||
}
|
||||
|
||||
var videoStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == Model.Entities.MediaStreamType.Video);
|
||||
var videoStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == MediaBrowser.Model.Entities.MediaStreamType.Video);
|
||||
if (videoStream != null)
|
||||
{
|
||||
if (!videoStream.BitRate.HasValue)
|
|
@ -2,7 +2,7 @@
|
|||
using MediaBrowser.Model.LiveTv;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
public class LiveTvConfigurationFactory : IConfigurationFactory
|
||||
{
|
|
@ -14,7 +14,7 @@ using System.Linq;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
public class LiveTvDtoService
|
||||
{
|
|
@ -25,8 +25,6 @@ using System.Linq;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.IO;
|
||||
using IniParser;
|
||||
using IniParser.Model;
|
||||
using MediaBrowser.Common.Events;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Security;
|
||||
|
@ -37,9 +35,9 @@ using MediaBrowser.Model.Events;
|
|||
using MediaBrowser.Model.Extensions;
|
||||
using MediaBrowser.Model.Globalization;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using MediaBrowser.Server.Implementations.LiveTv.Listings;
|
||||
using Emby.Server.Implementations.LiveTv.Listings;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
/// <summary>
|
||||
/// Class LiveTvManager
|
||||
|
@ -2967,43 +2965,46 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
public List<NameValuePair> GetSatIniMappings()
|
||||
{
|
||||
var names = GetType().Assembly.GetManifestResourceNames().Where(i => i.IndexOf("SatIp.ini", StringComparison.OrdinalIgnoreCase) != -1).ToList();
|
||||
return new List<NameValuePair>();
|
||||
//var names = GetType().Assembly.GetManifestResourceNames().Where(i => i.IndexOf("SatIp.ini", StringComparison.OrdinalIgnoreCase) != -1).ToList();
|
||||
|
||||
return names.Select(GetSatIniMappings).Where(i => i != null).DistinctBy(i => i.Value.Split('|')[0]).ToList();
|
||||
//return names.Select(GetSatIniMappings).Where(i => i != null).DistinctBy(i => i.Value.Split('|')[0]).ToList();
|
||||
}
|
||||
|
||||
public NameValuePair GetSatIniMappings(string resource)
|
||||
{
|
||||
using (var stream = GetType().Assembly.GetManifestResourceStream(resource))
|
||||
{
|
||||
using (var reader = new StreamReader(stream))
|
||||
{
|
||||
var parser = new StreamIniDataParser();
|
||||
IniData data = parser.ReadData(reader);
|
||||
return new NameValuePair();
|
||||
//using (var stream = GetType().Assembly.GetManifestResourceStream(resource))
|
||||
//{
|
||||
// using (var reader = new StreamReader(stream))
|
||||
// {
|
||||
// var parser = new StreamIniDataParser();
|
||||
// IniData data = parser.ReadData(reader);
|
||||
|
||||
var satType1 = data["SATTYPE"]["1"];
|
||||
var satType2 = data["SATTYPE"]["2"];
|
||||
// var satType1 = data["SATTYPE"]["1"];
|
||||
// var satType2 = data["SATTYPE"]["2"];
|
||||
|
||||
if (string.IsNullOrWhiteSpace(satType2))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
// if (string.IsNullOrWhiteSpace(satType2))
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
var srch = "SatIp.ini.";
|
||||
var filename = Path.GetFileName(resource);
|
||||
// var srch = "SatIp.ini.";
|
||||
// var filename = Path.GetFileName(resource);
|
||||
|
||||
return new NameValuePair
|
||||
{
|
||||
Name = satType1 + " " + satType2,
|
||||
Value = satType2 + "|" + filename.Substring(filename.IndexOf(srch) + srch.Length)
|
||||
};
|
||||
}
|
||||
}
|
||||
// return new NameValuePair
|
||||
// {
|
||||
// Name = satType1 + " " + satType2,
|
||||
// Value = satType2 + "|" + filename.Substring(filename.IndexOf(srch) + srch.Length)
|
||||
// };
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
public Task<List<ChannelInfo>> GetSatChannelScanResult(TunerHostInfo info, CancellationToken cancellationToken)
|
||||
{
|
||||
return new TunerHosts.SatIp.ChannelScan(_logger).Scan(info, cancellationToken);
|
||||
return Task.FromResult(new List<ChannelInfo>());
|
||||
//return new TunerHosts.SatIp.ChannelScan(_logger).Scan(info, cancellationToken);
|
||||
}
|
||||
|
||||
public Task<List<ChannelInfo>> GetChannelsForListingsProvider(string id, CancellationToken cancellationToken)
|
|
@ -15,7 +15,7 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
public class LiveTvMediaSourceProvider : IMediaSourceProvider
|
||||
{
|
||||
|
@ -164,7 +164,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
// Null this out so that it will be treated like a live stream
|
||||
mediaSource.RunTimeTicks = null;
|
||||
|
||||
var audioStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == Model.Entities.MediaStreamType.Audio);
|
||||
var audioStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == MediaBrowser.Model.Entities.MediaStreamType.Audio);
|
||||
|
||||
if (audioStream == null || audioStream.Index == -1)
|
||||
{
|
||||
|
@ -175,7 +175,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
mediaSource.DefaultAudioStreamIndex = audioStream.Index;
|
||||
}
|
||||
|
||||
var videoStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == Model.Entities.MediaStreamType.Video);
|
||||
var videoStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == MediaBrowser.Model.Entities.MediaStreamType.Video);
|
||||
if (videoStream != null)
|
||||
{
|
||||
if (!videoStream.BitRate.HasValue)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user