diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-05-08 16:26:20 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-05-08 16:26:20 -0400 |
| commit | bb031f553b940d21fa89f319d294745484c2234e (patch) | |
| tree | 29aac2660ab9186b5d43941fb0c6ef249ce33a71 /MediaBrowser.Server.Implementations | |
| parent | f02c3260273a09f465c4e7a97d8b90f0f6909734 (diff) | |
fix portable and 3.5 project references
Diffstat (limited to 'MediaBrowser.Server.Implementations')
14 files changed, 165 insertions, 308 deletions
diff --git a/MediaBrowser.Server.Implementations/Collections/CollectionsDynamicFolder.cs b/MediaBrowser.Server.Implementations/Collections/CollectionsDynamicFolder.cs index 834fbcd31..915a27c11 100644 --- a/MediaBrowser.Server.Implementations/Collections/CollectionsDynamicFolder.cs +++ b/MediaBrowser.Server.Implementations/Collections/CollectionsDynamicFolder.cs @@ -1,7 +1,6 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Controller.Entities; using System.IO; -using System.Linq; namespace MediaBrowser.Server.Implementations.Collections { @@ -26,30 +25,4 @@ namespace MediaBrowser.Server.Implementations.Collections }; } } - - public class ManualCollectionsFolder : BasePluginFolder - { - public ManualCollectionsFolder() - { - Name = "Collections"; - } - - public override bool IsVisible(User user) - { - if (!GetChildren(user, true).Any()) - { - return false; - } - - return base.IsVisible(user); - } - - public override bool IsHidden - { - get - { - return !ActualChildren.Any() || base.IsHidden; - } - } - } } diff --git a/MediaBrowser.Server.Implementations/Collections/ManualCollectionsFolder.cs b/MediaBrowser.Server.Implementations/Collections/ManualCollectionsFolder.cs new file mode 100644 index 000000000..e36c63b1c --- /dev/null +++ b/MediaBrowser.Server.Implementations/Collections/ManualCollectionsFolder.cs @@ -0,0 +1,31 @@ +using System.Linq; +using MediaBrowser.Controller.Entities; + +namespace MediaBrowser.Server.Implementations.Collections +{ + public class ManualCollectionsFolder : BasePluginFolder + { + public ManualCollectionsFolder() + { + Name = "Collections"; + } + + public override bool IsVisible(User user) + { + if (!GetChildren(user, true).Any()) + { + return false; + } + + return base.IsVisible(user); + } + + public override bool IsHidden + { + get + { + return !ActualChildren.Any() || base.IsHidden; + } + } + } +}
\ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs index 9d2de0f6d..9d2de0f6d 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs diff --git a/MediaBrowser.Server.Implementations/HttpServer/DelReceiveWebRequest.cs b/MediaBrowser.Server.Implementations/HttpServer/DelReceiveWebRequest.cs new file mode 100644 index 000000000..235910fed --- /dev/null +++ b/MediaBrowser.Server.Implementations/HttpServer/DelReceiveWebRequest.cs @@ -0,0 +1,6 @@ +using System.Net; + +namespace MediaBrowser.Server.Implementations.HttpServer +{ + public delegate void DelReceiveWebRequest(HttpListenerContext context); +}
\ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/HttpServer/GetSwaggerResource.cs b/MediaBrowser.Server.Implementations/HttpServer/GetSwaggerResource.cs new file mode 100644 index 000000000..36a257f63 --- /dev/null +++ b/MediaBrowser.Server.Implementations/HttpServer/GetSwaggerResource.cs @@ -0,0 +1,17 @@ +using ServiceStack; + +namespace MediaBrowser.Server.Implementations.HttpServer +{ + /// <summary> + /// Class GetDashboardResource + /// </summary> + [Route("/swagger-ui/{ResourceName*}", "GET")] + public class GetSwaggerResource + { + /// <summary> + /// Gets or sets the name. + /// </summary> + /// <value>The name.</value> + public string ResourceName { get; set; } + } +}
\ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs index cfe5ef4f0..0fc9265f6 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs @@ -25,8 +25,6 @@ using System.Threading.Tasks; namespace MediaBrowser.Server.Implementations.HttpServer { - public delegate void DelReceiveWebRequest(HttpListenerContext context); - public class HttpListenerHost : ServiceStackHost, IHttpServer { private string ServerName { get; set; } diff --git a/MediaBrowser.Server.Implementations/HttpServer/ServerLogFactory.cs b/MediaBrowser.Server.Implementations/HttpServer/ServerLogFactory.cs new file mode 100644 index 000000000..40af3f3b0 --- /dev/null +++ b/MediaBrowser.Server.Implementations/HttpServer/ServerLogFactory.cs @@ -0,0 +1,46 @@ +using System; +using MediaBrowser.Model.Logging; +using ServiceStack.Logging; + +namespace MediaBrowser.Server.Implementations.HttpServer +{ + /// <summary> + /// Class ServerLogFactory + /// </summary> + public class ServerLogFactory : ILogFactory + { + /// <summary> + /// The _log manager + /// </summary> + private readonly ILogManager _logManager; + + /// <summary> + /// Initializes a new instance of the <see cref="ServerLogFactory"/> class. + /// </summary> + /// <param name="logManager">The log manager.</param> + public ServerLogFactory(ILogManager logManager) + { + _logManager = logManager; + } + + /// <summary> + /// Gets the logger. + /// </summary> + /// <param name="typeName">Name of the type.</param> + /// <returns>ILog.</returns> + public ILog GetLogger(string typeName) + { + return new ServerLogger(_logManager.GetLogger(typeName)); + } + + /// <summary> + /// Gets the logger. + /// </summary> + /// <param name="type">The type.</param> + /// <returns>ILog.</returns> + public ILog GetLogger(Type type) + { + return GetLogger(type.Name); + } + } +}
\ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/HttpServer/ServerLogger.cs b/MediaBrowser.Server.Implementations/HttpServer/ServerLogger.cs index 7a4f922ed..bf7924784 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/ServerLogger.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/ServerLogger.cs @@ -5,46 +5,6 @@ using System; namespace MediaBrowser.Server.Implementations.HttpServer { /// <summary> - /// Class ServerLogFactory - /// </summary> - public class ServerLogFactory : ILogFactory - { - /// <summary> - /// The _log manager - /// </summary> - private readonly ILogManager _logManager; - - /// <summary> - /// Initializes a new instance of the <see cref="ServerLogFactory"/> class. - /// </summary> - /// <param name="logManager">The log manager.</param> - public ServerLogFactory(ILogManager logManager) - { - _logManager = logManager; - } - - /// <summary> - /// Gets the logger. - /// </summary> - /// <param name="typeName">Name of the type.</param> - /// <returns>ILog.</returns> - public ILog GetLogger(string typeName) - { - return new ServerLogger(_logManager.GetLogger(typeName)); - } - - /// <summary> - /// Gets the logger. - /// </summary> - /// <param name="type">The type.</param> - /// <returns>ILog.</returns> - public ILog GetLogger(Type type) - { - return GetLogger(type.Name); - } - } - - /// <summary> /// Class ServerLogger /// </summary> public class ServerLogger : ILog diff --git a/MediaBrowser.Server.Implementations/HttpServer/SwaggerService.cs b/MediaBrowser.Server.Implementations/HttpServer/SwaggerService.cs index 8f8505933..3764697f1 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/SwaggerService.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/SwaggerService.cs @@ -1,24 +1,10 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Controller.Net; -using ServiceStack; using ServiceStack.Web; using System.IO; namespace MediaBrowser.Server.Implementations.HttpServer { - /// <summary> - /// Class GetDashboardResource - /// </summary> - [Route("/swagger-ui/{ResourceName*}", "GET")] - public class GetSwaggerResource - { - /// <summary> - /// Gets or sets the name. - /// </summary> - /// <value>The name.</value> - public string ResourceName { get; set; } - } - public class SwaggerService : IHasResultFactory, IRestfulService { private readonly IApplicationPaths _appPaths; diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/BaseItemResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/ItemResolver.cs index a03eda263..a03eda263 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/BaseItemResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/ItemResolver.cs diff --git a/MediaBrowser.Server.Implementations/Library/Validators/CountHelpers.cs b/MediaBrowser.Server.Implementations/Library/Validators/CountHelpers.cs deleted file mode 100644 index edb4e7382..000000000 --- a/MediaBrowser.Server.Implementations/Library/Validators/CountHelpers.cs +++ /dev/null @@ -1,171 +0,0 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Entities.Audio; -using MediaBrowser.Controller.Entities.Movies; -using MediaBrowser.Controller.Entities.TV; -using MediaBrowser.Model.Dto; -using System; -using System.Collections.Generic; - -namespace MediaBrowser.Server.Implementations.Library.Validators -{ - /// <summary> - /// Class CountHelpers - /// </summary> - internal static class CountHelpers - { - private static CountType? GetCountType(BaseItem item) - { - if (item is Movie) - { - return CountType.Movie; - } - if (item is Episode) - { - return CountType.Episode; - } - if (item is Game) - { - return CountType.Game; - } - if (item is Audio) - { - return CountType.Song; - } - if (item is Trailer) - { - return CountType.Trailer; - } - if (item is Series) - { - return CountType.Series; - } - if (item is MusicAlbum) - { - return CountType.MusicAlbum; - } - if (item is MusicVideo) - { - return CountType.MusicVideo; - } - if (item is AdultVideo) - { - return CountType.AdultVideo; - } - - return null; - } - - /// <summary> - /// Increments the count. - /// </summary> - /// <param name="counts">The counts.</param> - /// <param name="key">The key.</param> - internal static void IncrementCount(Dictionary<CountType, int> counts, CountType key) - { - int count; - - if (counts.TryGetValue(key, out count)) - { - count++; - counts[key] = count; - } - else - { - counts.Add(key, 1); - } - } - - /// <summary> - /// Gets the counts. - /// </summary> - /// <param name="counts">The counts.</param> - /// <returns>ItemByNameCounts.</returns> - internal static ItemByNameCounts GetCounts(Dictionary<CountType, int> counts) - { - return new ItemByNameCounts - { - AdultVideoCount = GetCount(counts, CountType.AdultVideo), - AlbumCount = GetCount(counts, CountType.MusicAlbum), - EpisodeCount = GetCount(counts, CountType.Episode), - GameCount = GetCount(counts, CountType.Game), - MovieCount = GetCount(counts, CountType.Movie), - MusicVideoCount = GetCount(counts, CountType.MusicVideo), - SeriesCount = GetCount(counts, CountType.Series), - SongCount = GetCount(counts, CountType.Song), - TrailerCount = GetCount(counts, CountType.Trailer), - TotalCount = GetCount(counts, CountType.Total) - }; - } - - /// <summary> - /// Gets the count. - /// </summary> - /// <param name="counts">The counts.</param> - /// <param name="key">The key.</param> - /// <returns>System.Int32.</returns> - internal static int GetCount(Dictionary<CountType, int> counts, CountType key) - { - int count; - - if (counts.TryGetValue(key, out count)) - { - return count; - } - - return 0; - } - - /// <summary> - /// Sets the item counts. - /// </summary> - /// <param name="userId">The user id.</param> - /// <param name="media">The media.</param> - /// <param name="names">The names.</param> - /// <param name="masterDictionary">The master dictionary.</param> - internal static void SetItemCounts(Guid userId, BaseItem media, IEnumerable<string> names, Dictionary<string, Dictionary<Guid, Dictionary<CountType, int>>> masterDictionary) - { - var countType = GetCountType(media); - - foreach (var name in names) - { - Dictionary<Guid, Dictionary<CountType, int>> libraryCounts; - - if (!masterDictionary.TryGetValue(name, out libraryCounts)) - { - libraryCounts = new Dictionary<Guid, Dictionary<CountType, int>>(); - masterDictionary.Add(name, libraryCounts); - } - - var userLibId = userId/* ?? Guid.Empty*/; - Dictionary<CountType, int> userDictionary; - - if (!libraryCounts.TryGetValue(userLibId, out userDictionary)) - { - userDictionary = new Dictionary<CountType, int>(); - libraryCounts.Add(userLibId, userDictionary); - } - - if (countType.HasValue) - { - IncrementCount(userDictionary, countType.Value); - } - - IncrementCount(userDictionary, CountType.Total); - } - } - } - - internal enum CountType - { - AdultVideo, - MusicAlbum, - Episode, - Game, - Movie, - MusicVideo, - Series, - Song, - Trailer, - Total - } -} diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj index 74b8bf269..21fcd736f 100644 --- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj +++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj @@ -104,6 +104,7 @@ <Compile Include="Channels\RefreshChannelsScheduledTask.cs" /> <Compile Include="Collections\CollectionManager.cs" /> <Compile Include="Collections\CollectionsDynamicFolder.cs" /> + <Compile Include="Collections\ManualCollectionsFolder.cs" /> <Compile Include="Configuration\ServerConfigurationManager.cs" /> <Compile Include="Drawing\ImageHeader.cs" /> <Compile Include="Drawing\PercentPlayedDrawer.cs" /> @@ -114,7 +115,7 @@ <Compile Include="EntryPoints\ExternalPortForwarding.cs" /> <Compile Include="EntryPoints\LibraryChangedNotifier.cs" /> <Compile Include="EntryPoints\LoadRegistrations.cs" /> - <Compile Include="EntryPoints\Notifications\Notifier.cs" /> + <Compile Include="EntryPoints\Notifications\Notifications.cs" /> <Compile Include="EntryPoints\Notifications\RemoteNotifications.cs" /> <Compile Include="EntryPoints\Notifications\WebSocketNotifier.cs" /> <Compile Include="EntryPoints\RefreshUsersMetadata.cs" /> @@ -128,6 +129,8 @@ <Compile Include="EntryPoints\UserDataChangeNotifier.cs" /> <Compile Include="FileOrganization\OrganizerScheduledTask.cs" /> <Compile Include="HttpServer\ContainerAdapter.cs" /> + <Compile Include="HttpServer\DelReceiveWebRequest.cs" /> + <Compile Include="HttpServer\GetSwaggerResource.cs" /> <Compile Include="HttpServer\HttpListenerHost.cs" /> <Compile Include="HttpServer\HttpResultFactory.cs" /> <Compile Include="HttpServer\LoggerUtils.cs" /> @@ -135,6 +138,7 @@ <Compile Include="HttpServer\RangeRequestWriter.cs" /> <Compile Include="HttpServer\ResponseFilter.cs" /> <Compile Include="HttpServer\ServerFactory.cs" /> + <Compile Include="HttpServer\ServerLogFactory.cs" /> <Compile Include="HttpServer\ServerLogger.cs" /> <Compile Include="HttpServer\StreamWriter.cs" /> <Compile Include="HttpServer\SwaggerService.cs" /> @@ -149,7 +153,7 @@ <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\BaseItemResolver.cs" /> + <Compile Include="Library\Resolvers\ItemResolver.cs" /> <Compile Include="Library\Resolvers\FolderResolver.cs" /> <Compile Include="Library\Resolvers\LocalTrailerResolver.cs" /> <Compile Include="Library\Resolvers\Movies\BoxSetResolver.cs" /> @@ -163,7 +167,6 @@ <Compile Include="Library\Validators\ArtistsPostScanTask.cs" /> <Compile Include="Library\Validators\ArtistsValidator.cs" /> <Compile Include="Library\Validators\BoxSetPostScanTask.cs" /> - <Compile Include="Library\Validators\CountHelpers.cs" /> <Compile Include="Library\Validators\GameGenresPostScanTask.cs" /> <Compile Include="Library\Validators\GameGenresValidator.cs" /> <Compile Include="Library\Validators\GenresPostScanTask.cs" /> @@ -225,6 +228,7 @@ <Compile Include="Sorting\DatePlayedComparer.cs" /> <Compile Include="Sorting\GameSystemComparer.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" /> diff --git a/MediaBrowser.Server.Implementations/Sorting/IsPlayedComparer.cs b/MediaBrowser.Server.Implementations/Sorting/IsPlayedComparer.cs new file mode 100644 index 000000000..aebfbdb1c --- /dev/null +++ b/MediaBrowser.Server.Implementations/Sorting/IsPlayedComparer.cs @@ -0,0 +1,58 @@ +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.Sorting; +using MediaBrowser.Model.Querying; + +namespace MediaBrowser.Server.Implementations.Sorting +{ + public class IsPlayedComparer : IUserBaseItemComparer + { + /// <summary> + /// Gets or sets the user. + /// </summary> + /// <value>The user.</value> + public User User { get; set; } + + /// <summary> + /// Compares the specified x. + /// </summary> + /// <param name="x">The x.</param> + /// <param name="y">The y.</param> + /// <returns>System.Int32.</returns> + public int Compare(BaseItem x, BaseItem y) + { + return GetValue(x).CompareTo(GetValue(y)); + } + + /// <summary> + /// Gets the date. + /// </summary> + /// <param name="x">The x.</param> + /// <returns>DateTime.</returns> + private int GetValue(BaseItem x) + { + return x.IsPlayed(User) ? 0 : 1; + } + + /// <summary> + /// Gets the name. + /// </summary> + /// <value>The name.</value> + public string Name + { + get { return ItemSortBy.IsUnplayed; } + } + + /// <summary> + /// Gets or sets the user data repository. + /// </summary> + /// <value>The user data repository.</value> + public IUserDataManager UserDataRepository { get; set; } + + /// <summary> + /// Gets or sets the user manager. + /// </summary> + /// <value>The user manager.</value> + public IUserManager UserManager { get; set; } + } +}
\ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/Sorting/IsUnplayedComparer.cs b/MediaBrowser.Server.Implementations/Sorting/IsUnplayedComparer.cs index e3053155f..f1c6a5a4e 100644 --- a/MediaBrowser.Server.Implementations/Sorting/IsUnplayedComparer.cs +++ b/MediaBrowser.Server.Implementations/Sorting/IsUnplayedComparer.cs @@ -55,55 +55,4 @@ namespace MediaBrowser.Server.Implementations.Sorting /// <value>The user manager.</value> public IUserManager UserManager { get; set; } } - - public class IsPlayedComparer : IUserBaseItemComparer - { - /// <summary> - /// Gets or sets the user. - /// </summary> - /// <value>The user.</value> - public User User { get; set; } - - /// <summary> - /// Compares the specified x. - /// </summary> - /// <param name="x">The x.</param> - /// <param name="y">The y.</param> - /// <returns>System.Int32.</returns> - public int Compare(BaseItem x, BaseItem y) - { - return GetValue(x).CompareTo(GetValue(y)); - } - - /// <summary> - /// Gets the date. - /// </summary> - /// <param name="x">The x.</param> - /// <returns>DateTime.</returns> - private int GetValue(BaseItem x) - { - return x.IsPlayed(User) ? 0 : 1; - } - - /// <summary> - /// Gets the name. - /// </summary> - /// <value>The name.</value> - public string Name - { - get { return ItemSortBy.IsUnplayed; } - } - - /// <summary> - /// Gets or sets the user data repository. - /// </summary> - /// <value>The user data repository.</value> - public IUserDataManager UserDataRepository { get; set; } - - /// <summary> - /// Gets or sets the user manager. - /// </summary> - /// <value>The user manager.</value> - public IUserManager UserManager { get; set; } - } } |
