mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
update channels
This commit is contained in:
parent
6120286bfd
commit
f271e358a1
@ -204,6 +204,11 @@ namespace MediaBrowser.Api.Playback
|
|||||||
return Convert.ToInt32(newSize.Width);
|
return Convert.ToInt32(newSize.Width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (VideoRequest == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return VideoRequest.MaxWidth ?? VideoRequest.Width;
|
return VideoRequest.MaxWidth ?? VideoRequest.Width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -229,6 +234,11 @@ namespace MediaBrowser.Api.Playback
|
|||||||
return Convert.ToInt32(newSize.Height);
|
return Convert.ToInt32(newSize.Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (VideoRequest == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return VideoRequest.MaxHeight ?? VideoRequest.Height;
|
return VideoRequest.MaxHeight ?? VideoRequest.Height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,10 @@
|
|||||||
<RunPostBuildEvent>Always</RunPostBuildEvent>
|
<RunPostBuildEvent>Always</RunPostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="NLog, Version=3.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\packages\NLog.3.0.0.0\lib\net45\NLog.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="SimpleInjector, Version=2.5.0.0, Culture=neutral, PublicKeyToken=984cb50dea722e99, processorArchitecture=MSIL">
|
<Reference Include="SimpleInjector, Version=2.5.0.0, Culture=neutral, PublicKeyToken=984cb50dea722e99, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\SimpleInjector.2.5.0\lib\net45\SimpleInjector.dll</HintPath>
|
<HintPath>..\packages\SimpleInjector.2.5.0\lib\net45\SimpleInjector.dll</HintPath>
|
||||||
@ -63,9 +67,6 @@
|
|||||||
<Reference Include="System.Net" />
|
<Reference Include="System.Net" />
|
||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="NLog">
|
|
||||||
<HintPath>..\packages\NLog.2.1.0\lib\net45\NLog.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="SharpCompress">
|
<Reference Include="SharpCompress">
|
||||||
<HintPath>..\packages\sharpcompress.0.10.2\lib\net40\SharpCompress.dll</HintPath>
|
<HintPath>..\packages\sharpcompress.0.10.2\lib\net40\SharpCompress.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="NLog" version="2.1.0" targetFramework="net45" />
|
<package id="NLog" version="3.0.0.0" targetFramework="net45" />
|
||||||
<package id="sharpcompress" version="0.10.2" targetFramework="net45" />
|
<package id="sharpcompress" version="0.10.2" targetFramework="net45" />
|
||||||
<package id="SimpleInjector" version="2.5.0" targetFramework="net45" />
|
<package id="SimpleInjector" version="2.5.0" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Channels
|
namespace MediaBrowser.Controller.Channels
|
||||||
{
|
{
|
||||||
@ -7,8 +6,6 @@ namespace MediaBrowser.Controller.Channels
|
|||||||
{
|
{
|
||||||
public List<ChannelItemInfo> Items { get; set; }
|
public List<ChannelItemInfo> Items { get; set; }
|
||||||
|
|
||||||
public TimeSpan CacheLength { get; set; }
|
|
||||||
|
|
||||||
public int? TotalRecordCount { get; set; }
|
public int? TotalRecordCount { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
15
MediaBrowser.Controller/Channels/ChannelParentalRating.cs
Normal file
15
MediaBrowser.Controller/Channels/ChannelParentalRating.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
namespace MediaBrowser.Controller.Channels
|
||||||
|
{
|
||||||
|
public enum ChannelParentalRating
|
||||||
|
{
|
||||||
|
GeneralAudience = 0,
|
||||||
|
|
||||||
|
UsPG = 1,
|
||||||
|
|
||||||
|
UsPG13 = 2,
|
||||||
|
|
||||||
|
UsR = 3,
|
||||||
|
|
||||||
|
Adult = 4
|
||||||
|
}
|
||||||
|
}
|
@ -3,5 +3,7 @@
|
|||||||
public class ChannelSearchInfo
|
public class ChannelSearchInfo
|
||||||
{
|
{
|
||||||
public string SearchTerm { get; set; }
|
public string SearchTerm { get; set; }
|
||||||
|
|
||||||
|
public string UserId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,4 @@
|
|||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Controller.Providers;
|
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -27,6 +26,12 @@ namespace MediaBrowser.Controller.Channels
|
|||||||
/// <value>The home page URL.</value>
|
/// <value>The home page URL.</value>
|
||||||
string HomePageUrl { get; }
|
string HomePageUrl { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the parental rating.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The parental rating.</value>
|
||||||
|
ChannelParentalRating ParentalRating { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the channel information.
|
/// Gets the channel information.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -36,26 +41,9 @@ namespace MediaBrowser.Controller.Channels
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines whether [is enabled for] [the specified user].
|
/// Determines whether [is enabled for] [the specified user].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="user">The user.</param>
|
/// <param name="userId">The user identifier.</param>
|
||||||
/// <returns><c>true</c> if [is enabled for] [the specified user]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is enabled for] [the specified user]; otherwise, <c>false</c>.</returns>
|
||||||
bool IsEnabledFor(User user);
|
bool IsEnabledFor(string userId);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Searches the specified search term.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="searchInfo">The search information.</param>
|
|
||||||
/// <param name="user">The user.</param>
|
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
|
||||||
/// <returns>Task{IEnumerable{ChannelItemInfo}}.</returns>
|
|
||||||
Task<IEnumerable<ChannelItemInfo>> Search(ChannelSearchInfo searchInfo, User user, CancellationToken cancellationToken);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets all media.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="query">The query.</param>
|
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
|
||||||
/// <returns>Task{ChannelItemResult}.</returns>
|
|
||||||
Task<ChannelItemResult> GetAllMedia(InternalAllChannelMediaQuery query, CancellationToken cancellationToken);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the channel items.
|
/// Gets the channel items.
|
||||||
@ -79,15 +67,4 @@ namespace MediaBrowser.Controller.Channels
|
|||||||
/// <returns>IEnumerable{ImageType}.</returns>
|
/// <returns>IEnumerable{ImageType}.</returns>
|
||||||
IEnumerable<ImageType> GetSupportedChannelImages();
|
IEnumerable<ImageType> GetSupportedChannelImages();
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IRequiresMediaInfoCallback
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the channel item media information.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id">The identifier.</param>
|
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
|
||||||
/// <returns>Task{IEnumerable{ChannelMediaInfo}}.</returns>
|
|
||||||
Task<IEnumerable<ChannelMediaInfo>> GetChannelItemMediaInfo(string id, CancellationToken cancellationToken);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
13
MediaBrowser.Controller/Channels/IHasCacheKey.cs
Normal file
13
MediaBrowser.Controller/Channels/IHasCacheKey.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
namespace MediaBrowser.Controller.Channels
|
||||||
|
{
|
||||||
|
public interface IHasCacheKey
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the cache key.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId">The user identifier.</param>
|
||||||
|
/// <returns>System.String.</returns>
|
||||||
|
string GetCacheKey(string userId);
|
||||||
|
}
|
||||||
|
}
|
16
MediaBrowser.Controller/Channels/IIndexableChannel.cs
Normal file
16
MediaBrowser.Controller/Channels/IIndexableChannel.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Controller.Channels
|
||||||
|
{
|
||||||
|
public interface IIndexableChannel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all media.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="query">The query.</param>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <returns>Task{ChannelItemResult}.</returns>
|
||||||
|
Task<ChannelItemResult> GetAllMedia(InternalAllChannelMediaQuery query, CancellationToken cancellationToken);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Controller.Channels
|
||||||
|
{
|
||||||
|
public interface IRequiresMediaInfoCallback
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the channel item media information.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The identifier.</param>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <returns>Task{IEnumerable{ChannelMediaInfo}}.</returns>
|
||||||
|
Task<IEnumerable<ChannelMediaInfo>> GetChannelItemMediaInfo(string id, CancellationToken cancellationToken);
|
||||||
|
}
|
||||||
|
}
|
17
MediaBrowser.Controller/Channels/ISearchableChannel.cs
Normal file
17
MediaBrowser.Controller/Channels/ISearchableChannel.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Controller.Channels
|
||||||
|
{
|
||||||
|
public interface ISearchableChannel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Searches the specified search term.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="searchInfo">The search information.</param>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <returns>Task{IEnumerable{ChannelItemInfo}}.</returns>
|
||||||
|
Task<IEnumerable<ChannelItemInfo>> Search(ChannelSearchInfo searchInfo, CancellationToken cancellationToken);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
namespace MediaBrowser.Controller.Channels
|
||||||
|
{
|
||||||
|
public class InternalAllChannelMediaQuery
|
||||||
|
{
|
||||||
|
public string UserId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -5,18 +5,6 @@ namespace MediaBrowser.Controller.Channels
|
|||||||
{
|
{
|
||||||
public class InternalChannelFeatures
|
public class InternalChannelFeatures
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets a value indicating whether this instance can search.
|
|
||||||
/// </summary>
|
|
||||||
/// <value><c>true</c> if this instance can search; otherwise, <c>false</c>.</value>
|
|
||||||
public bool CanSearch { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets a value indicating whether this instance can get all media.
|
|
||||||
/// </summary>
|
|
||||||
/// <value><c>true</c> if this instance can get all media; otherwise, <c>false</c>.</value>
|
|
||||||
public bool CanGetAllMedia { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the media types.
|
/// Gets or sets the media types.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Model.Channels;
|
||||||
using MediaBrowser.Model.Channels;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Channels
|
namespace MediaBrowser.Controller.Channels
|
||||||
{
|
{
|
||||||
@ -7,7 +6,7 @@ namespace MediaBrowser.Controller.Channels
|
|||||||
{
|
{
|
||||||
public string FolderId { get; set; }
|
public string FolderId { get; set; }
|
||||||
|
|
||||||
public User User { get; set; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
public int? StartIndex { get; set; }
|
public int? StartIndex { get; set; }
|
||||||
|
|
||||||
@ -17,9 +16,4 @@ namespace MediaBrowser.Controller.Channels
|
|||||||
|
|
||||||
public bool SortDescending { get; set; }
|
public bool SortDescending { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class InternalAllChannelMediaQuery
|
|
||||||
{
|
|
||||||
public User User { get; set; }
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -73,6 +73,7 @@
|
|||||||
<Compile Include="Channels\ChannelItemResult.cs" />
|
<Compile Include="Channels\ChannelItemResult.cs" />
|
||||||
<Compile Include="Channels\ChannelItemType.cs" />
|
<Compile Include="Channels\ChannelItemType.cs" />
|
||||||
<Compile Include="Channels\ChannelMediaInfo.cs" />
|
<Compile Include="Channels\ChannelMediaInfo.cs" />
|
||||||
|
<Compile Include="Channels\ChannelParentalRating.cs" />
|
||||||
<Compile Include="Channels\ChannelSearchInfo.cs" />
|
<Compile Include="Channels\ChannelSearchInfo.cs" />
|
||||||
<Compile Include="Channels\IChannel.cs" />
|
<Compile Include="Channels\IChannel.cs" />
|
||||||
<Compile Include="Channels\IChannelFactory.cs" />
|
<Compile Include="Channels\IChannelFactory.cs" />
|
||||||
@ -82,8 +83,13 @@
|
|||||||
<Compile Include="Channels\ChannelVideoItem.cs" />
|
<Compile Include="Channels\ChannelVideoItem.cs" />
|
||||||
<Compile Include="Channels\Channel.cs" />
|
<Compile Include="Channels\Channel.cs" />
|
||||||
<Compile Include="Channels\IChannelMediaItem.cs" />
|
<Compile Include="Channels\IChannelMediaItem.cs" />
|
||||||
|
<Compile Include="Channels\IHasCacheKey.cs" />
|
||||||
|
<Compile Include="Channels\IIndexableChannel.cs" />
|
||||||
|
<Compile Include="Channels\InternalAllChannelMediaQuery.cs" />
|
||||||
<Compile Include="Channels\InternalChannelFeatures.cs" />
|
<Compile Include="Channels\InternalChannelFeatures.cs" />
|
||||||
<Compile Include="Channels\InternalChannelItemQuery.cs" />
|
<Compile Include="Channels\InternalChannelItemQuery.cs" />
|
||||||
|
<Compile Include="Channels\IRequiresMediaInfoCallback.cs" />
|
||||||
|
<Compile Include="Channels\ISearchableChannel.cs" />
|
||||||
<Compile Include="Chapters\ChapterSearchRequest.cs" />
|
<Compile Include="Chapters\ChapterSearchRequest.cs" />
|
||||||
<Compile Include="Chapters\IChapterProvider.cs" />
|
<Compile Include="Chapters\IChapterProvider.cs" />
|
||||||
<Compile Include="Chapters\ChapterResponse.cs" />
|
<Compile Include="Chapters\ChapterResponse.cs" />
|
||||||
|
@ -22,12 +22,6 @@ namespace MediaBrowser.Model.Channels
|
|||||||
/// <value><c>true</c> if this instance can search; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if this instance can search; otherwise, <c>false</c>.</value>
|
||||||
public bool CanSearch { get; set; }
|
public bool CanSearch { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets a value indicating whether this instance can get all media.
|
|
||||||
/// </summary>
|
|
||||||
/// <value><c>true</c> if this instance can get all media; otherwise, <c>false</c>.</value>
|
|
||||||
public bool CanGetAllMedia { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the media types.
|
/// Gets or sets the media types.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -45,6 +45,6 @@ namespace MediaBrowser.Model.Querying
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The is favorite or likes
|
/// The is favorite or likes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IsFavoriteOrLikes = 10,
|
IsFavoriteOrLikes = 10
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,6 @@ namespace MediaBrowser.Model.Tasks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The wake from sleep
|
/// The wake from sleep
|
||||||
/// </summary>
|
/// </summary>
|
||||||
WakeFromSleep
|
WakeFromSleep = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
|
|
||||||
if (user != null)
|
if (user != null)
|
||||||
{
|
{
|
||||||
channels = channels.Where(i => GetChannelProvider(i).IsEnabledFor(user) && i.IsVisible(user))
|
channels = channels.Where(i => GetChannelProvider(i).IsEnabledFor(user.Id.ToString("N")) && i.IsVisible(user))
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,7 +371,8 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
Id = id,
|
Id = id,
|
||||||
DateCreated = _fileSystem.GetCreationTimeUtc(fileInfo),
|
DateCreated = _fileSystem.GetCreationTimeUtc(fileInfo),
|
||||||
DateModified = _fileSystem.GetLastWriteTimeUtc(fileInfo),
|
DateModified = _fileSystem.GetLastWriteTimeUtc(fileInfo),
|
||||||
Path = path
|
Path = path,
|
||||||
|
OfficialRating = GetOfficialRating(channelInfo.ParentalRating)
|
||||||
};
|
};
|
||||||
|
|
||||||
isNew = true;
|
isNew = true;
|
||||||
@ -394,6 +395,23 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string GetOfficialRating(ChannelParentalRating rating)
|
||||||
|
{
|
||||||
|
switch (rating)
|
||||||
|
{
|
||||||
|
case ChannelParentalRating.Adult:
|
||||||
|
return "XXX";
|
||||||
|
case ChannelParentalRating.UsR:
|
||||||
|
return "R";
|
||||||
|
case ChannelParentalRating.UsPG13:
|
||||||
|
return "PG-13";
|
||||||
|
case ChannelParentalRating.UsPG:
|
||||||
|
return "PG";
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Channel GetChannel(string id)
|
public Channel GetChannel(string id)
|
||||||
{
|
{
|
||||||
return (Channel)_libraryManager.GetItemById(new Guid(id));
|
return (Channel)_libraryManager.GetItemById(new Guid(id));
|
||||||
@ -412,16 +430,19 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
|
|
||||||
var channelProvider = GetChannelProvider(channel);
|
var channelProvider = GetChannelProvider(channel);
|
||||||
|
|
||||||
return GetChannelFeaturesDto(channel, channelProvider.GetChannelFeatures());
|
return GetChannelFeaturesDto(channel, channelProvider, channelProvider.GetChannelFeatures());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChannelFeatures GetChannelFeaturesDto(Channel channel, InternalChannelFeatures features)
|
public ChannelFeatures GetChannelFeaturesDto(Channel channel,
|
||||||
|
IChannel provider,
|
||||||
|
InternalChannelFeatures features)
|
||||||
{
|
{
|
||||||
|
var isIndexable = provider is IIndexableChannel;
|
||||||
|
|
||||||
return new ChannelFeatures
|
return new ChannelFeatures
|
||||||
{
|
{
|
||||||
CanFilter = !features.MaxPageSize.HasValue,
|
CanFilter = !features.MaxPageSize.HasValue,
|
||||||
CanGetAllMedia = features.CanGetAllMedia,
|
CanSearch = provider is ISearchableChannel,
|
||||||
CanSearch = features.CanSearch,
|
|
||||||
ContentTypes = features.ContentTypes,
|
ContentTypes = features.ContentTypes,
|
||||||
DefaultSortFields = features.DefaultSortFields,
|
DefaultSortFields = features.DefaultSortFields,
|
||||||
MaxPageSize = features.MaxPageSize,
|
MaxPageSize = features.MaxPageSize,
|
||||||
@ -429,7 +450,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
SupportsSortOrderToggle = features.SupportsSortOrderToggle,
|
SupportsSortOrderToggle = features.SupportsSortOrderToggle,
|
||||||
Name = channel.Name,
|
Name = channel.Name,
|
||||||
Id = channel.Id.ToString("N"),
|
Id = channel.Id.ToString("N"),
|
||||||
CanDownloadAllMedia = features.CanGetAllMedia
|
CanDownloadAllMedia = isIndexable
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -459,24 +480,28 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
}
|
}
|
||||||
|
|
||||||
var tasks = channels
|
var tasks = channels
|
||||||
.Where(i => i.GetChannelFeatures().CanGetAllMedia)
|
|
||||||
.Select(async i =>
|
.Select(async i =>
|
||||||
{
|
{
|
||||||
try
|
var indexable = i as IIndexableChannel;
|
||||||
|
|
||||||
|
if (indexable != null)
|
||||||
{
|
{
|
||||||
var result = await i.GetAllMedia(new InternalAllChannelMediaQuery
|
try
|
||||||
{
|
{
|
||||||
User = user
|
var result = await indexable.GetAllMedia(new InternalAllChannelMediaQuery
|
||||||
|
{
|
||||||
|
UserId = query.UserId
|
||||||
|
|
||||||
}, cancellationToken).ConfigureAwait(false);
|
}, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
return new Tuple<IChannel, ChannelItemResult>(i, result);
|
return new Tuple<IChannel, ChannelItemResult>(i, result);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error getting all media from {0}", ex, i.Name);
|
_logger.ErrorException("Error getting all media from {0}", ex, i.Name);
|
||||||
return new Tuple<IChannel, ChannelItemResult>(i, new ChannelItemResult { });
|
}
|
||||||
}
|
}
|
||||||
|
return new Tuple<IChannel, ChannelItemResult>(i, new ChannelItemResult { });
|
||||||
});
|
});
|
||||||
|
|
||||||
var results = await Task.WhenAll(tasks).ConfigureAwait(false);
|
var results = await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||||
@ -600,7 +625,10 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
bool sortDescending,
|
bool sortDescending,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var cachePath = GetChannelDataCachePath(channel, user, folderId, sortField, sortDescending);
|
var userId = user.Id.ToString("N");
|
||||||
|
|
||||||
|
var cacheLength = TimeSpan.FromDays(1);
|
||||||
|
var cachePath = GetChannelDataCachePath(channel, userId, folderId, sortField, sortDescending);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -608,7 +636,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
{
|
{
|
||||||
var channelItemResult = _jsonSerializer.DeserializeFromFile<ChannelItemResult>(cachePath);
|
var channelItemResult = _jsonSerializer.DeserializeFromFile<ChannelItemResult>(cachePath);
|
||||||
|
|
||||||
if (_fileSystem.GetLastWriteTimeUtc(cachePath).Add(channelItemResult.CacheLength) > DateTime.UtcNow)
|
if (_fileSystem.GetLastWriteTimeUtc(cachePath).Add(cacheLength) > DateTime.UtcNow)
|
||||||
{
|
{
|
||||||
return channelItemResult;
|
return channelItemResult;
|
||||||
}
|
}
|
||||||
@ -633,7 +661,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
{
|
{
|
||||||
var channelItemResult = _jsonSerializer.DeserializeFromFile<ChannelItemResult>(cachePath);
|
var channelItemResult = _jsonSerializer.DeserializeFromFile<ChannelItemResult>(cachePath);
|
||||||
|
|
||||||
if (_fileSystem.GetLastWriteTimeUtc(cachePath).Add(channelItemResult.CacheLength) > DateTime.UtcNow)
|
if (_fileSystem.GetLastWriteTimeUtc(cachePath).Add(cacheLength) > DateTime.UtcNow)
|
||||||
{
|
{
|
||||||
return channelItemResult;
|
return channelItemResult;
|
||||||
}
|
}
|
||||||
@ -650,7 +678,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
|
|
||||||
var query = new InternalChannelItemQuery
|
var query = new InternalChannelItemQuery
|
||||||
{
|
{
|
||||||
User = user,
|
UserId = userId,
|
||||||
StartIndex = startIndex,
|
StartIndex = startIndex,
|
||||||
Limit = limit,
|
Limit = limit,
|
||||||
SortBy = sortField,
|
SortBy = sortField,
|
||||||
@ -694,18 +722,27 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
}
|
}
|
||||||
|
|
||||||
private string GetChannelDataCachePath(IChannel channel,
|
private string GetChannelDataCachePath(IChannel channel,
|
||||||
User user,
|
string userId,
|
||||||
string folderId,
|
string folderId,
|
||||||
ChannelItemSortField? sortField,
|
ChannelItemSortField? sortField,
|
||||||
bool sortDescending)
|
bool sortDescending)
|
||||||
{
|
{
|
||||||
var channelId = GetInternalChannelId(channel.Name).ToString("N");
|
var channelId = GetInternalChannelId(channel.Name).ToString("N");
|
||||||
|
|
||||||
var folderKey = string.IsNullOrWhiteSpace(folderId) ? "root" : folderId.GetMD5().ToString("N");
|
var userCacheKey = string.Empty;
|
||||||
|
|
||||||
|
var hasCacheKey = channel as IHasCacheKey;
|
||||||
|
if (hasCacheKey != null)
|
||||||
|
{
|
||||||
|
userCacheKey = hasCacheKey.GetCacheKey(userId) ?? string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
var folderKey = string.IsNullOrWhiteSpace(folderId) ? "root" : folderId;
|
||||||
|
folderKey = (folderKey + userCacheKey).GetMD5().ToString("N");
|
||||||
|
|
||||||
var version = string.IsNullOrWhiteSpace(channel.DataVersion) ? "0" : channel.DataVersion;
|
var version = string.IsNullOrWhiteSpace(channel.DataVersion) ? "0" : channel.DataVersion;
|
||||||
|
|
||||||
var filename = user.Id.ToString("N");
|
var filename = userId;
|
||||||
var hashfilename = false;
|
var hashfilename = false;
|
||||||
|
|
||||||
if (sortField.HasValue)
|
if (sortField.HasValue)
|
||||||
@ -724,7 +761,12 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
filename = filename.GetMD5().ToString("N");
|
filename = filename.GetMD5().ToString("N");
|
||||||
}
|
}
|
||||||
|
|
||||||
return Path.Combine(_config.ApplicationPaths.CachePath, "channels", channelId, version, folderKey, filename + ".json");
|
return Path.Combine(_config.ApplicationPaths.CachePath,
|
||||||
|
"channels",
|
||||||
|
channelId,
|
||||||
|
version,
|
||||||
|
folderKey,
|
||||||
|
filename + ".json");
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<QueryResult<BaseItemDto>> GetReturnItems(IEnumerable<BaseItem> items, int? totalCountFromProvider, User user, ChannelItemQuery query, CancellationToken cancellationToken)
|
private async Task<QueryResult<BaseItemDto>> GetReturnItems(IEnumerable<BaseItem> items, int? totalCountFromProvider, User user, ChannelItemQuery query, CancellationToken cancellationToken)
|
||||||
@ -770,7 +812,8 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
{
|
{
|
||||||
// Increment this as needed to force new downloads
|
// Increment this as needed to force new downloads
|
||||||
// Incorporate Name because it's being used to convert channel entity to provider
|
// Incorporate Name because it's being used to convert channel entity to provider
|
||||||
return externalId + (channelProvider.DataVersion ?? string.Empty) + (channelProvider.Name ?? string.Empty) + "14";
|
return externalId + (channelProvider.DataVersion ?? string.Empty) +
|
||||||
|
(channelProvider.Name ?? string.Empty) + "15";
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<BaseItem> GetChannelItemEntity(ChannelItemInfo info, IChannel channelProvider, Channel internalChannel, CancellationToken cancellationToken)
|
private async Task<BaseItem> GetChannelItemEntity(ChannelItemInfo info, IChannel channelProvider, Channel internalChannel, CancellationToken cancellationToken)
|
||||||
|
@ -63,8 +63,9 @@
|
|||||||
<Reference Include="MediaBrowser.IsoMounter">
|
<Reference Include="MediaBrowser.IsoMounter">
|
||||||
<HintPath>..\packages\MediaBrowser.IsoMounting.3.0.65\lib\net45\MediaBrowser.IsoMounter.dll</HintPath>
|
<HintPath>..\packages\MediaBrowser.IsoMounting.3.0.65\lib\net45\MediaBrowser.IsoMounter.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="NLog">
|
<Reference Include="NLog, Version=3.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\NLog.2.1.0\lib\net45\NLog.dll</HintPath>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\packages\NLog.3.0.0.0\lib\net45\NLog.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="pfmclrapi">
|
<Reference Include="pfmclrapi">
|
||||||
<HintPath>..\packages\MediaBrowser.IsoMounting.3.0.65\lib\net45\pfmclrapi.dll</HintPath>
|
<HintPath>..\packages\MediaBrowser.IsoMounting.3.0.65\lib\net45\pfmclrapi.dll</HintPath>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="MediaBrowser.IsoMounting" version="3.0.65" targetFramework="net45" />
|
<package id="MediaBrowser.IsoMounting" version="3.0.65" targetFramework="net45" />
|
||||||
<package id="NLog" version="2.1.0" targetFramework="net45" />
|
<package id="NLog" version="3.0.0.0" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Common.Internal</id>
|
<id>MediaBrowser.Common.Internal</id>
|
||||||
<version>3.0.394</version>
|
<version>3.0.397</version>
|
||||||
<title>MediaBrowser.Common.Internal</title>
|
<title>MediaBrowser.Common.Internal</title>
|
||||||
<authors>Luke</authors>
|
<authors>Luke</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
@ -12,7 +12,7 @@
|
|||||||
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
|
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
|
||||||
<copyright>Copyright © Media Browser 2013</copyright>
|
<copyright>Copyright © Media Browser 2013</copyright>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency id="MediaBrowser.Common" version="3.0.394" />
|
<dependency id="MediaBrowser.Common" version="3.0.397" />
|
||||||
<dependency id="NLog" version="2.1.0" />
|
<dependency id="NLog" version="2.1.0" />
|
||||||
<dependency id="SimpleInjector" version="2.5.0" />
|
<dependency id="SimpleInjector" version="2.5.0" />
|
||||||
<dependency id="sharpcompress" version="0.10.2" />
|
<dependency id="sharpcompress" version="0.10.2" />
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Common</id>
|
<id>MediaBrowser.Common</id>
|
||||||
<version>3.0.394</version>
|
<version>3.0.397</version>
|
||||||
<title>MediaBrowser.Common</title>
|
<title>MediaBrowser.Common</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Server.Core</id>
|
<id>MediaBrowser.Server.Core</id>
|
||||||
<version>3.0.394</version>
|
<version>3.0.397</version>
|
||||||
<title>Media Browser.Server.Core</title>
|
<title>Media Browser.Server.Core</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
@ -12,7 +12,7 @@
|
|||||||
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
||||||
<copyright>Copyright © Media Browser 2013</copyright>
|
<copyright>Copyright © Media Browser 2013</copyright>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency id="MediaBrowser.Common" version="3.0.394" />
|
<dependency id="MediaBrowser.Common" version="3.0.396" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user