mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 17:44:43 +01:00
fix portable and 3.5 project references
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
using System.Net;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.HttpServer
|
||||
{
|
||||
public delegate void DelReceiveWebRequest(HttpListenerContext context);
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,46 +4,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>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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" />
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user