move additional classes to new server lib

This commit is contained in:
Luke Pulverenti 2016-11-03 02:37:52 -04:00
parent 41bef184d1
commit 3eb4091808
88 changed files with 354 additions and 278 deletions

View File

@ -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
{

View File

@ -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
{

View File

@ -13,7 +13,7 @@
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFrameworkProfile>Profile75</TargetFrameworkProfile>
<TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@ -52,6 +52,7 @@
<Compile Include="..\SharedVersion.cs">
<Link>Properties\SharedVersion.cs</Link>
</Compile>
<Compile Include="Activity\ActivityManager.cs" />
<Compile Include="Branding\BrandingConfigurationFactory.cs" />
<Compile Include="Channels\ChannelConfigurations.cs" />
<Compile Include="Channels\ChannelDynamicMediaSourceProvider.cs" />
@ -60,18 +61,112 @@
<Compile Include="Channels\ChannelPostScanTask.cs" />
<Compile Include="Channels\RefreshChannelsScheduledTask.cs" />
<Compile Include="Collections\CollectionManager.cs" />
<Compile Include="Dto\DtoService.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="Intros\DefaultIntroProvider.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\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="Logging\PatternsLogger.cs" />
<Compile Include="News\NewsService.cs" />
<Compile Include="Persistence\CleanDatabaseScheduledTask.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="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="Updates\InstallationManager.cs" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Reference Include="MediaBrowser.Naming, Version=1.0.6146.28476, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MediaBrowser.Naming.1.0.0.57\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Patterns.Logging, Version=1.0.6149.1756, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Patterns.Logging.1.0.0.4\lib\portable-net45+dnxcore50+sl4+wp71+win8+wpa81\Patterns.Logging.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="IO\" />
</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.

View File

@ -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;
}

View File

@ -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
{

View File

@ -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

View File

@ -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
{

View File

@ -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);
}
}
}

View File

@ -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
{

View File

@ -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) { }

View File

@ -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

View File

@ -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))
{

View File

@ -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
{

View File

@ -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()

View File

@ -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
{

View File

@ -1,7 +1,7 @@
using System;
using System.Text.RegularExpressions;
namespace MediaBrowser.Server.Implementations.Library
namespace Emby.Server.Implementations.Library
{
public static class PathExtensions
{

View File

@ -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)
{

View File

@ -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();
}
}
}

View File

@ -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

View File

@ -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

View File

@ -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)
{

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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>
{

View File

@ -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>
{

View File

@ -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>
{

View File

@ -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>
{

View File

@ -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

View File

@ -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

View File

@ -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)
{

View File

@ -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

View File

@ -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
{

View File

@ -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
{

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
{

View File

@ -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
{

View File

@ -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
{

View File

@ -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

View File

@ -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
{

View File

@ -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

View File

@ -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

View File

@ -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
{

View File

@ -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
{

View File

@ -0,0 +1,63 @@
using Patterns.Logging;
using System;
namespace Emby.Server.Implementations.Logging
{
public class PatternsLogger : ILogger
{
private readonly MediaBrowser.Model.Logging.ILogger _logger;
public PatternsLogger()
: this(new MediaBrowser.Model.Logging.NullLogger())
{
}
public PatternsLogger(MediaBrowser.Model.Logging.ILogger logger)
{
_logger = logger;
}
public void Debug(string message, params object[] paramList)
{
_logger.Debug(message, paramList);
}
public void Error(string message, params object[] paramList)
{
_logger.Error(message, paramList);
}
public void ErrorException(string message, Exception exception, params object[] paramList)
{
_logger.ErrorException(message, exception, paramList);
}
public void Fatal(string message, params object[] paramList)
{
_logger.Fatal(message, paramList);
}
public void FatalException(string message, Exception exception, params object[] paramList)
{
_logger.FatalException(message, exception, paramList);
}
public void Info(string message, params object[] paramList)
{
_logger.Info(message, paramList);
}
public void Warn(string message, params object[] paramList)
{
_logger.Warn(message, paramList);
}
public void Log(LogSeverity severity, string message, params object[] paramList)
{
}
public void LogMultiline(string message, LogSeverity severity, System.Text.StringBuilder additionalContent)
{
}
}
}

View File

@ -20,9 +20,9 @@ using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Server.Implementations.ScheduledTasks;
using Emby.Server.Implementations.ScheduledTasks;
namespace MediaBrowser.Server.Implementations.Persistence
namespace Emby.Server.Implementations.Persistence
{
public class CleanDatabaseScheduledTask : IScheduledTask
{
@ -37,6 +37,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
public const int MigrationVersion = 23;
public static bool EnableUnavailableMessage = false;
const int LatestSchemaVersion = 109;
public CleanDatabaseScheduledTask(ILibraryManager libraryManager, IItemRepository itemRepo, ILogger logger, IServerConfigurationManager config, IFileSystem fileSystem, IHttpServer httpServer, ILocalizationManager localization, ITaskManager taskManager)
{
@ -113,9 +114,9 @@ namespace MediaBrowser.Server.Implementations.Persistence
_config.SaveConfiguration();
}
if (_config.Configuration.SchemaVersion < SqliteItemRepository.LatestSchemaVersion)
if (_config.Configuration.SchemaVersion < LatestSchemaVersion)
{
_config.Configuration.SchemaVersion = SqliteItemRepository.LatestSchemaVersion;
_config.Configuration.SchemaVersion = LatestSchemaVersion;
_config.SaveConfiguration();
}

View File

@ -1,13 +1,13 @@
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Library;
using MediaBrowser.Server.Implementations.Library;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Emby.Server.Implementations.Library;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Server.Implementations.ScheduledTasks
namespace Emby.Server.Implementations.ScheduledTasks
{
/// <summary>
/// Class RefreshMediaLibraryTask

View File

@ -4,7 +4,7 @@ using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
using System;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
public class AirTimeComparer : IBaseItemComparer
{

View File

@ -4,7 +4,7 @@ using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
using System;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
class AiredEpisodeOrderComparer : IBaseItemComparer
{

View File

@ -5,7 +5,7 @@ using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
using System;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
/// <summary>
/// Class AlbumArtistComparer

View File

@ -4,7 +4,7 @@ using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
using System;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
/// <summary>
/// Class AlbumComparer

View File

@ -2,7 +2,7 @@
using System.Text;
using MediaBrowser.Controller.Sorting;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
public class AlphanumComparator : IComparer<string>
{

View File

@ -4,7 +4,7 @@ using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
using System;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
/// <summary>
/// Class ArtistComparer

View File

@ -2,7 +2,7 @@
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
public class BudgetComparer : IBaseItemComparer
{

View File

@ -2,7 +2,7 @@
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
public class CommunityRatingComparer : IBaseItemComparer
{

View File

@ -2,7 +2,7 @@
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
/// <summary>
/// Class CriticRatingComparer

View File

@ -3,7 +3,7 @@ using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
using System;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
/// <summary>
/// Class DateCreatedComparer

View File

@ -4,7 +4,7 @@ using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
using System;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
public class DateLastMediaAddedComparer : IUserBaseItemComparer
{

View File

@ -4,7 +4,7 @@ using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
using System;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
/// <summary>
/// Class DatePlayedComparer

View File

@ -3,7 +3,7 @@ using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
using System;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
public class GameSystemComparer : IBaseItemComparer
{

View File

@ -3,7 +3,7 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
public class IsFavoriteOrLikeComparer : IUserBaseItemComparer
{

View File

@ -2,7 +2,7 @@
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
public class IsFolderComparer : IBaseItemComparer
{

View File

@ -3,7 +3,7 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
public class IsPlayedComparer : IUserBaseItemComparer
{

View File

@ -3,7 +3,7 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
public class IsUnplayedComparer : IUserBaseItemComparer
{

View File

@ -2,7 +2,7 @@
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
public class MetascoreComparer : IBaseItemComparer
{

View File

@ -3,7 +3,7 @@ using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
using System;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
/// <summary>
/// Class NameComparer

View File

@ -3,7 +3,7 @@ using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
public class OfficialRatingComparer : IBaseItemComparer
{

View File

@ -3,7 +3,7 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
/// <summary>
/// Class PlayCountComparer

View File

@ -2,7 +2,7 @@
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
public class PlayersComparer : IBaseItemComparer
{

View File

@ -3,7 +3,7 @@ using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
using System;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
/// <summary>
/// Class PremiereDateComparer

View File

@ -2,7 +2,7 @@
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
/// <summary>
/// Class ProductionYearComparer

View File

@ -3,7 +3,7 @@ using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
using System;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
/// <summary>
/// Class RandomComparer

View File

@ -2,7 +2,7 @@
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
public class RevenueComparer : IBaseItemComparer
{

View File

@ -2,7 +2,7 @@
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
/// <summary>
/// Class RuntimeComparer

View File

@ -3,7 +3,7 @@ using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
using System;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
class SeriesSortNameComparer : IBaseItemComparer
{

View File

@ -3,7 +3,7 @@ using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
using System;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
/// <summary>
/// Class SortNameComparer

View File

@ -4,7 +4,7 @@ using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
using System;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
public class StartDateComparer : IBaseItemComparer
{

View File

@ -3,7 +3,7 @@ using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
using System.Linq;
namespace MediaBrowser.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting
{
public class StudioComparer : IBaseItemComparer
{

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MediaBrowser.Naming" version="1.0.0.57" targetFramework="portable45-net45+win8" />
<package id="Patterns.Logging" version="1.0.0.4" targetFramework="portable45-net45+win8" />
</packages>

View File

@ -14,7 +14,7 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Server.Implementations.ScheduledTasks;
using MediaBrowser.Model.Threading;
namespace MediaBrowser.Server.Implementations.IO
{
@ -26,13 +26,14 @@ namespace MediaBrowser.Server.Implementations.IO
private IServerConfigurationManager ConfigurationManager { get; set; }
private readonly IFileSystem _fileSystem;
private readonly List<string> _affectedPaths = new List<string>();
private Timer _timer;
private ITimer _timer;
private readonly ITimerFactory _timerFactory;
private readonly object _timerLock = new object();
public string Path { get; private set; }
public event EventHandler<EventArgs> Completed;
public FileRefresher(string path, IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, ITaskManager taskManager, ILogger logger)
public FileRefresher(string path, IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, ITaskManager taskManager, ILogger logger, ITimerFactory timerFactory)
{
logger.Debug("New file refresher created for {0}", path);
Path = path;
@ -42,6 +43,7 @@ namespace MediaBrowser.Server.Implementations.IO
LibraryManager = libraryManager;
TaskManager = taskManager;
Logger = logger;
_timerFactory = timerFactory;
AddPath(path);
}
@ -88,7 +90,7 @@ namespace MediaBrowser.Server.Implementations.IO
if (_timer == null)
{
_timer = new Timer(OnTimerCallback, null, TimeSpan.FromSeconds(ConfigurationManager.Configuration.LibraryMonitorDelay), TimeSpan.FromMilliseconds(-1));
_timer = _timerFactory.Create(OnTimerCallback, null, TimeSpan.FromSeconds(ConfigurationManager.Configuration.LibraryMonitorDelay), TimeSpan.FromMilliseconds(-1));
}
else
{
@ -163,7 +165,7 @@ namespace MediaBrowser.Server.Implementations.IO
// If the root folder changed, run the library task so the user can see it
if (itemsToRefresh.Any(i => i is AggregateFolder))
{
TaskManager.CancelIfRunningAndQueue<RefreshMediaLibraryTask>();
LibraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);
return;
}
@ -268,11 +270,11 @@ namespace MediaBrowser.Server.Implementations.IO
return false;
}
}
catch (DirectoryNotFoundException)
{
// File may have been deleted
return false;
}
//catch (DirectoryNotFoundException)
//{
// // File may have been deleted
// return false;
//}
catch (FileNotFoundException)
{
// File may have been deleted

View File

@ -16,6 +16,7 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Controller;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Model.Threading;
namespace MediaBrowser.Server.Implementations.IO
{
@ -136,12 +137,12 @@ namespace MediaBrowser.Server.Implementations.IO
private IServerConfigurationManager ConfigurationManager { get; set; }
private readonly IFileSystem _fileSystem;
private readonly IServerApplicationHost _appHost;
private readonly ITimerFactory _timerFactory;
/// <summary>
/// Initializes a new instance of the <see cref="LibraryMonitor" /> class.
/// </summary>
public LibraryMonitor(ILogManager logManager, ITaskManager taskManager, ILibraryManager libraryManager, IServerConfigurationManager configurationManager, IFileSystem fileSystem, IServerApplicationHost appHost)
public LibraryMonitor(ILogManager logManager, ITaskManager taskManager, ILibraryManager libraryManager, IServerConfigurationManager configurationManager, IFileSystem fileSystem, ITimerFactory timerFactory)
{
if (taskManager == null)
{
@ -153,7 +154,7 @@ namespace MediaBrowser.Server.Implementations.IO
Logger = logManager.GetLogger(GetType().Name);
ConfigurationManager = configurationManager;
_fileSystem = fileSystem;
_appHost = appHost;
_timerFactory = timerFactory;
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
}
@ -528,7 +529,7 @@ namespace MediaBrowser.Server.Implementations.IO
}
}
var newRefresher = new FileRefresher(path, _fileSystem, ConfigurationManager, LibraryManager, TaskManager, Logger);
var newRefresher = new FileRefresher(path, _fileSystem, ConfigurationManager, LibraryManager, TaskManager, Logger, _timerFactory);
newRefresher.Completed += NewRefresher_Completed;
_activeRefreshers.Add(newRefresher);
}

View File

@ -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;
@ -1528,28 +1527,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)

View File

@ -108,7 +108,6 @@
<Compile Include="..\SharedVersion.cs">
<Link>Properties\SharedVersion.cs</Link>
</Compile>
<Compile Include="Activity\ActivityManager.cs" />
<Compile Include="Activity\ActivityRepository.cs" />
<Compile Include="Archiving\ZipClient.cs" />
<Compile Include="Collections\CollectionsDynamicFolder.cs" />
@ -122,7 +121,6 @@
<Compile Include="Devices\DeviceManager.cs" />
<Compile Include="Devices\DeviceRepository.cs" />
<Compile Include="Devices\CameraUploadsFolder.cs" />
<Compile Include="Dto\DtoService.cs" />
<Compile Include="EntryPoints\ActivityLogEntryPoint.cs" />
<Compile Include="EntryPoints\AutomaticRestartEntryPoint.cs" />
<Compile Include="EntryPoints\ExternalPortForwarding.cs" />
@ -134,16 +132,9 @@
<Compile Include="EntryPoints\RefreshUsersMetadata.cs" />
<Compile Include="EntryPoints\UsageEntryPoint.cs" />
<Compile Include="EntryPoints\UsageReporter.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\TvFolderOrganizer.cs" />
<Compile Include="EntryPoints\UdpServerEntryPoint.cs" />
<Compile Include="EntryPoints\ServerEventNotifier.cs" />
<Compile Include="EntryPoints\UserDataChangeNotifier.cs" />
<Compile Include="FileOrganization\OrganizerScheduledTask.cs" />
<Compile Include="HttpServer\IHttpListener.cs" />
<Compile Include="HttpServer\Security\AuthorizationContext.cs" />
<Compile Include="HttpServer\ContainerAdapter.cs" />
@ -171,45 +162,8 @@
<Compile Include="IO\LibraryMonitor.cs" />
<Compile Include="IO\MemoryStreamProvider.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\Resolvers\SpecialFolderResolver.cs" />
<Compile Include="Library\Resolvers\BaseVideoResolver.cs" />
<Compile Include="Library\Resolvers\PhotoAlbumResolver.cs" />
<Compile Include="Library\Resolvers\PhotoResolver.cs" />
<Compile Include="Library\Resolvers\PlaylistResolver.cs" />
<Compile Include="Library\SearchEngine.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\ItemResolver.cs" />
<Compile Include="Library\Resolvers\FolderResolver.cs" />
<Compile Include="Library\Resolvers\Movies\BoxSetResolver.cs" />
<Compile Include="Library\Resolvers\Movies\MovieResolver.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\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" />
@ -267,19 +221,16 @@
<Compile Include="News\NewsEntryPoint.cs" />
<Compile Include="Notifications\IConfigurableNotificationService.cs" />
<Compile Include="Persistence\BaseSqliteRepository.cs" />
<Compile Include="Persistence\CleanDatabaseScheduledTask.cs" />
<Compile Include="Persistence\DataExtensions.cs" />
<Compile Include="Persistence\IDbConnector.cs" />
<Compile Include="Persistence\MediaStreamColumns.cs" />
<Compile Include="Reflection\AssemblyInfo.cs" />
<Compile Include="ScheduledTasks\RefreshMediaLibraryTask.cs" />
<Compile Include="Security\MBLicenseFile.cs" />
<Compile Include="Security\PluginSecurityManager.cs" />
<Compile Include="Security\RegRecord.cs" />
<Compile Include="Serialization\JsonSerializer.cs" />
<Compile Include="Social\SharingManager.cs" />
<Compile Include="Social\SharingRepository.cs" />
<Compile Include="Sorting\StartDateComparer.cs" />
<Compile Include="Sync\SyncHelper.cs" />
<Compile Include="Sync\SyncJobOptions.cs" />
<Compile Include="Sync\SyncNotificationEntryPoint.cs" />
@ -311,40 +262,10 @@
</Compile>
<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="Persistence\SqliteDisplayPreferencesRepository.cs" />
<Compile Include="Persistence\SqliteItemRepository.cs" />
<Compile Include="Persistence\SqliteUserDataRepository.cs" />
<Compile Include="Persistence\SqliteUserRepository.cs" />
<Compile Include="Sorting\StudioComparer.cs" />
<Compile Include="Sync\AppSyncProvider.cs" />
<Compile Include="Sync\CloudSyncProfile.cs" />
<Compile Include="Sync\IHasSyncQuality.cs" />

View File

@ -54,9 +54,7 @@ using MediaBrowser.Server.Implementations.Collections;
using MediaBrowser.Server.Implementations.Configuration;
using MediaBrowser.Server.Implementations.Connect;
using MediaBrowser.Server.Implementations.Devices;
using MediaBrowser.Server.Implementations.Dto;
using MediaBrowser.Server.Implementations.EntryPoints;
using MediaBrowser.Server.Implementations.FileOrganization;
using MediaBrowser.Server.Implementations.HttpServer;
using MediaBrowser.Server.Implementations.HttpServer.Security;
using MediaBrowser.Server.Implementations.IO;
@ -107,8 +105,13 @@ using Emby.Dlna.ContentDirectory;
using Emby.Dlna.Main;
using Emby.Dlna.MediaReceiverRegistrar;
using Emby.Dlna.Ssdp;
using Emby.Server.Implementations.Activity;
using Emby.Server.Implementations.Channels;
using Emby.Server.Implementations.Collections;
using Emby.Server.Implementations.Dto;
using Emby.Server.Implementations.FileOrganization;
using Emby.Server.Implementations.Library;
using Emby.Server.Implementations.Persistence;
using Emby.Server.Implementations.Playlists;
using Emby.Server.Implementations.Updates;
using MediaBrowser.Model.Activity;
@ -588,7 +591,7 @@ namespace MediaBrowser.Server.Startup.Common
var musicManager = new MusicManager(LibraryManager);
RegisterSingleInstance<IMusicManager>(new MusicManager(LibraryManager));
LibraryMonitor = new LibraryMonitor(LogManager, TaskManager, LibraryManager, ServerConfigurationManager, FileSystemManager, this);
LibraryMonitor = new LibraryMonitor(LogManager, TaskManager, LibraryManager, ServerConfigurationManager, FileSystemManager, TimerFactory);
RegisterSingleInstance(LibraryMonitor);
ProviderManager = new ProviderManager(HttpClient, ServerConfigurationManager, LibraryMonitor, LogManager, FileSystemManager, ApplicationPaths, () => LibraryManager, JsonSerializer, MemoryStreamProvider);
@ -639,7 +642,7 @@ namespace MediaBrowser.Server.Startup.Common
ChannelManager = new ChannelManager(UserManager, DtoService, LibraryManager, LogManager.GetLogger("ChannelManager"), ServerConfigurationManager, FileSystemManager, UserDataManager, JsonSerializer, LocalizationManager, HttpClient, ProviderManager);
RegisterSingleInstance(ChannelManager);
MediaSourceManager = new MediaSourceManager(ItemRepository, UserManager, LibraryManager, LogManager.GetLogger("MediaSourceManager"), JsonSerializer, FileSystemManager, UserDataManager);
MediaSourceManager = new MediaSourceManager(ItemRepository, UserManager, LibraryManager, LogManager.GetLogger("MediaSourceManager"), JsonSerializer, FileSystemManager, UserDataManager, TimerFactory);
RegisterSingleInstance(MediaSourceManager);
SessionManager = new SessionManager(UserDataManager, LogManager.GetLogger("SessionManager"), LibraryManager, UserManager, musicManager, DtoService, ImageProcessor, JsonSerializer, this, HttpClient, AuthenticationRepository, DeviceManager, MediaSourceManager);

View File

@ -1,4 +1,5 @@
using System.Threading.Tasks;
using Emby.Server.Implementations.Persistence;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Server.Implementations.Persistence;