Add more channel features
This commit is contained in:
parent
cd934c5d3d
commit
4d1d2bbaa1
|
@ -18,6 +18,21 @@ namespace MediaBrowser.Api
|
||||||
public int? Limit { get; set; }
|
public int? Limit { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Route("/Channels/{Id}/Items", "GET")]
|
||||||
|
[Api(("Gets channel items"))]
|
||||||
|
public class GetChannelItems : IReturn<QueryResult<BaseItemDto>>
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
public string CategoryId { get; set; }
|
||||||
|
|
||||||
|
public string UserId { get; set; }
|
||||||
|
|
||||||
|
public int? StartIndex { get; set; }
|
||||||
|
|
||||||
|
public int? Limit { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
public class ChannelService : BaseApiService
|
public class ChannelService : BaseApiService
|
||||||
{
|
{
|
||||||
private readonly IChannelManager _channelManager;
|
private readonly IChannelManager _channelManager;
|
||||||
|
@ -39,5 +54,20 @@ namespace MediaBrowser.Api
|
||||||
|
|
||||||
return ToOptimizedResult(result);
|
return ToOptimizedResult(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public object Get(GetChannelItems request)
|
||||||
|
{
|
||||||
|
var result = _channelManager.GetChannelItems(new ChannelItemQuery
|
||||||
|
{
|
||||||
|
Limit = request.Limit,
|
||||||
|
StartIndex = request.StartIndex,
|
||||||
|
UserId = request.UserId,
|
||||||
|
ChannelId = request.Id,
|
||||||
|
CategoryId = request.CategoryId
|
||||||
|
|
||||||
|
}, CancellationToken.None).Result;
|
||||||
|
|
||||||
|
return ToOptimizedResult(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
|
using MediaBrowser.Controller.Channels;
|
||||||
using MediaBrowser.Controller.Dto;
|
using MediaBrowser.Controller.Dto;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
|
@ -6,6 +7,7 @@ using MediaBrowser.Controller.Entities.Movies;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Persistence;
|
using MediaBrowser.Controller.Persistence;
|
||||||
|
using MediaBrowser.Model.Channels;
|
||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
|
@ -242,18 +244,20 @@ namespace MediaBrowser.Api.Library
|
||||||
private readonly IUserDataManager _userDataManager;
|
private readonly IUserDataManager _userDataManager;
|
||||||
|
|
||||||
private readonly IDtoService _dtoService;
|
private readonly IDtoService _dtoService;
|
||||||
|
private readonly IChannelManager _channelManager;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="LibraryService" /> class.
|
/// Initializes a new instance of the <see cref="LibraryService" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public LibraryService(IItemRepository itemRepo, ILibraryManager libraryManager, IUserManager userManager,
|
public LibraryService(IItemRepository itemRepo, ILibraryManager libraryManager, IUserManager userManager,
|
||||||
IDtoService dtoService, IUserDataManager userDataManager)
|
IDtoService dtoService, IUserDataManager userDataManager, IChannelManager channelManager)
|
||||||
{
|
{
|
||||||
_itemRepo = itemRepo;
|
_itemRepo = itemRepo;
|
||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
_dtoService = dtoService;
|
_dtoService = dtoService;
|
||||||
_userDataManager = userDataManager;
|
_userDataManager = userDataManager;
|
||||||
|
_channelManager = channelManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public object Get(GetMediaFolders request)
|
public object Get(GetMediaFolders request)
|
||||||
|
@ -417,6 +421,21 @@ namespace MediaBrowser.Api.Library
|
||||||
var songs = filteredItems.OfType<Audio>().ToList();
|
var songs = filteredItems.OfType<Audio>().ToList();
|
||||||
var series = filteredItems.OfType<Series>().ToList();
|
var series = filteredItems.OfType<Series>().ToList();
|
||||||
|
|
||||||
|
var channelCount = 0;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
channelCount = _channelManager.GetChannels(new ChannelQuery
|
||||||
|
{
|
||||||
|
UserId = request.UserId.HasValue ? request.UserId.Value.ToString("N") : null
|
||||||
|
|
||||||
|
}, CancellationToken.None).Result.TotalRecordCount;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.ErrorException("Error getting channels", ex);
|
||||||
|
}
|
||||||
|
|
||||||
var counts = new ItemCounts
|
var counts = new ItemCounts
|
||||||
{
|
{
|
||||||
AlbumCount = albums.Count,
|
AlbumCount = albums.Count,
|
||||||
|
@ -432,7 +451,9 @@ namespace MediaBrowser.Api.Library
|
||||||
BoxSetCount = boxsets.Count,
|
BoxSetCount = boxsets.Count,
|
||||||
BookCount = books.Count,
|
BookCount = books.Count,
|
||||||
|
|
||||||
UniqueTypes = items.Select(i => i.GetClientTypeName()).Distinct().ToList()
|
UniqueTypes = items.Select(i => i.GetClientTypeName()).Distinct().ToList(),
|
||||||
|
|
||||||
|
ChannelCount = channelCount
|
||||||
};
|
};
|
||||||
|
|
||||||
return ToOptimizedSerializedResultUsingCache(counts);
|
return ToOptimizedSerializedResultUsingCache(counts);
|
||||||
|
|
|
@ -240,7 +240,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
public bool? HasOfficialRating { get; set; }
|
public bool? HasOfficialRating { get; set; }
|
||||||
|
|
||||||
[ApiMember(Name = "CollapseBoxSetItems", Description = "Whether or not to hide items behind their boxsets.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
|
[ApiMember(Name = "CollapseBoxSetItems", Description = "Whether or not to hide items behind their boxsets.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
|
||||||
public bool CollapseBoxSetItems { get; set; }
|
public bool? CollapseBoxSetItems { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -318,7 +318,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
|
|
||||||
items = items.AsEnumerable();
|
items = items.AsEnumerable();
|
||||||
|
|
||||||
if (request.CollapseBoxSetItems && AllowBoxSetCollapsing(request))
|
if (CollapseBoxSetItems(request))
|
||||||
{
|
{
|
||||||
items = CollapseItemsWithinBoxSets(items, user);
|
items = CollapseItemsWithinBoxSets(items, user);
|
||||||
}
|
}
|
||||||
|
@ -346,6 +346,22 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool CollapseBoxSetItems(GetItems request)
|
||||||
|
{
|
||||||
|
var param = request.CollapseBoxSetItems;
|
||||||
|
|
||||||
|
if (!param.HasValue)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(request.IncludeItemTypes) &&
|
||||||
|
request.IncludeItemTypes.Split(',').Contains("Movie", StringComparer.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
param = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return param.HasValue && param.Value && AllowBoxSetCollapsing(request);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the items to serialize.
|
/// Gets the items to serialize.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
8
MediaBrowser.Controller/Channels/ChannelCategoryItem.cs
Normal file
8
MediaBrowser.Controller/Channels/ChannelCategoryItem.cs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Controller.Channels
|
||||||
|
{
|
||||||
|
public class ChannelCategoryItem : Folder
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -35,6 +35,9 @@ namespace MediaBrowser.Controller.Channels
|
||||||
|
|
||||||
public Dictionary<string, string> ProviderIds { get; set; }
|
public Dictionary<string, string> ProviderIds { get; set; }
|
||||||
|
|
||||||
|
public DateTime? PremiereDate { get; set; }
|
||||||
|
public int? ProductionYear { get; set; }
|
||||||
|
|
||||||
public ChannelItemInfo()
|
public ChannelItemInfo()
|
||||||
{
|
{
|
||||||
Genres = new List<string>();
|
Genres = new List<string>();
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
|
using MediaBrowser.Controller.Providers;
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -44,19 +47,24 @@ namespace MediaBrowser.Controller.Channels
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the channel items.
|
/// Gets the channel items.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="user">The user.</param>
|
/// <param name="query">The query.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task{IEnumerable{ChannelItem}}.</returns>
|
/// <returns>Task{IEnumerable{ChannelItem}}.</returns>
|
||||||
Task<IEnumerable<ChannelItemInfo>> GetChannelItems(User user, CancellationToken cancellationToken);
|
Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the channel items.
|
/// Gets the channel image.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="categoryId">The category identifier.</param>
|
/// <param name="type">The type.</param>
|
||||||
/// <param name="user">The user.</param>
|
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task{IEnumerable{ChannelItem}}.</returns>
|
/// <returns>Task{DynamicImageInfo}.</returns>
|
||||||
Task<IEnumerable<ChannelItemInfo>> GetChannelItems(string categoryId, User user, CancellationToken cancellationToken);
|
Task<DynamicImageResponse> GetChannelImage(ImageType type, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the supported channel images.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>IEnumerable{ImageType}.</returns>
|
||||||
|
IEnumerable<ImageType> GetSupportedChannelImages();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ChannelCapabilities
|
public class ChannelCapabilities
|
||||||
|
@ -68,4 +76,18 @@ namespace MediaBrowser.Controller.Channels
|
||||||
{
|
{
|
||||||
public string SearchTerm { get; set; }
|
public string SearchTerm { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class InternalChannelItemQuery
|
||||||
|
{
|
||||||
|
public string CategoryId { get; set; }
|
||||||
|
|
||||||
|
public User User { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ChannelItemResult
|
||||||
|
{
|
||||||
|
public List<ChannelItemInfo> Items { get; set; }
|
||||||
|
|
||||||
|
public TimeSpan CacheLength { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,7 @@
|
||||||
<Compile Include="..\SharedVersion.cs">
|
<Compile Include="..\SharedVersion.cs">
|
||||||
<Link>Properties\SharedVersion.cs</Link>
|
<Link>Properties\SharedVersion.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Channels\ChannelCategoryItem.cs" />
|
||||||
<Compile Include="Channels\ChannelItemInfo.cs" />
|
<Compile Include="Channels\ChannelItemInfo.cs" />
|
||||||
<Compile Include="Channels\IChannel.cs" />
|
<Compile Include="Channels\IChannel.cs" />
|
||||||
<Compile Include="Channels\IChannelManager.cs" />
|
<Compile Include="Channels\IChannelManager.cs" />
|
||||||
|
|
|
@ -219,6 +219,11 @@ namespace MediaBrowser.Dlna
|
||||||
Containers = new[]{"avi"},
|
Containers = new[]{"avi"},
|
||||||
MimeType = "avi",
|
MimeType = "avi",
|
||||||
Type = DlnaProfileType.Video
|
Type = DlnaProfileType.Video
|
||||||
|
},
|
||||||
|
new DirectPlayProfile
|
||||||
|
{
|
||||||
|
Containers = new[]{"mp4"},
|
||||||
|
Type = DlnaProfileType.Video
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -300,6 +305,12 @@ namespace MediaBrowser.Dlna
|
||||||
Containers = new[]{"avi"},
|
Containers = new[]{"avi"},
|
||||||
Type = DlnaProfileType.Video,
|
Type = DlnaProfileType.Video,
|
||||||
MimeType = "avi"
|
MimeType = "avi"
|
||||||
|
},
|
||||||
|
new DirectPlayProfile
|
||||||
|
{
|
||||||
|
Containers = new[]{"asf"},
|
||||||
|
Type = DlnaProfileType.Audio,
|
||||||
|
MimeType = "x-ms-wmv"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -32,6 +32,14 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
{
|
{
|
||||||
contentFeatures = "DLNA.ORG_PN=WMABASE";
|
contentFeatures = "DLNA.ORG_PN=WMABASE";
|
||||||
}
|
}
|
||||||
|
else if (string.Equals(item.FileFormat, "wmw", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
contentFeatures = "DLNA.ORG_PN=WMVMED_BASE";
|
||||||
|
}
|
||||||
|
else if (string.Equals(item.FileFormat, "asf", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
contentFeatures = "DLNA.ORG_PN=WMVMED_BASE";
|
||||||
|
}
|
||||||
else if (string.Equals(item.FileFormat, "avi", StringComparison.OrdinalIgnoreCase))
|
else if (string.Equals(item.FileFormat, "avi", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
contentFeatures = "DLNA.ORG_PN=AVI";
|
contentFeatures = "DLNA.ORG_PN=AVI";
|
||||||
|
|
|
@ -68,6 +68,7 @@ namespace MediaBrowser.Model.Dto
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The unique types.</value>
|
/// <value>The unique types.</value>
|
||||||
public List<string> UniqueTypes { get; set; }
|
public List<string> UniqueTypes { get; set; }
|
||||||
|
public int ChannelCount { get; set; }
|
||||||
|
|
||||||
public ItemCounts()
|
public ItemCounts()
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
using MediaBrowser.Controller.Channels;
|
||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
|
using MediaBrowser.Controller.Providers;
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Server.Implementations.Channels
|
||||||
|
{
|
||||||
|
public class ChannelImageProvider : IDynamicImageProvider, IHasChangeMonitor
|
||||||
|
{
|
||||||
|
private readonly IChannelManager _channelManager;
|
||||||
|
|
||||||
|
public ChannelImageProvider(IChannelManager channelManager)
|
||||||
|
{
|
||||||
|
_channelManager = channelManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<ImageType> GetSupportedImages(IHasImages item)
|
||||||
|
{
|
||||||
|
return GetChannel(item).GetSupportedChannelImages();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<DynamicImageResponse> GetImage(IHasImages item, ImageType type, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var channel = GetChannel(item);
|
||||||
|
|
||||||
|
return channel.GetChannelImage(type, cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "Channel Image Provider"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Supports(IHasImages item)
|
||||||
|
{
|
||||||
|
return item is Channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
|
||||||
|
{
|
||||||
|
return GetSupportedImages(item).Any(i => !item.HasImage(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
private IChannel GetChannel(IHasImages item)
|
||||||
|
{
|
||||||
|
var channel = (Channel)item;
|
||||||
|
|
||||||
|
return ((ChannelManager)_channelManager).GetChannelProvider(channel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -68,11 +68,6 @@ namespace MediaBrowser.Server.Implementations.Channels
|
||||||
return item is IChannelItem;
|
return item is IChannelItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Order
|
|
||||||
{
|
|
||||||
get { return 0; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
|
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
|
||||||
{
|
{
|
||||||
var channelItem = item as IChannelItem;
|
var channelItem = item as IChannelItem;
|
||||||
|
|
|
@ -202,16 +202,19 @@ namespace MediaBrowser.Server.Implementations.Channels
|
||||||
return await GetReturnItems(items, user, query.StartIndex, query.Limit, cancellationToken).ConfigureAwait(false);
|
return await GetReturnItems(items, user, query.StartIndex, query.Limit, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Task<IEnumerable<ChannelItemInfo>> GetChannelItems(IChannel channel, User user, string categoryId, CancellationToken cancellationToken)
|
private async Task<IEnumerable<ChannelItemInfo>> GetChannelItems(IChannel channel, User user, string categoryId, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
// TODO: Put some caching in here
|
// TODO: Put some caching in here
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(categoryId))
|
var query = new InternalChannelItemQuery
|
||||||
{
|
{
|
||||||
return channel.GetChannelItems(user, cancellationToken);
|
User = user,
|
||||||
}
|
CategoryId = categoryId
|
||||||
|
};
|
||||||
|
|
||||||
return channel.GetChannelItems(categoryId, user, cancellationToken);
|
var result = await channel.GetChannelItems(query, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
return result.Items;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<QueryResult<BaseItemDto>> GetReturnItems(IEnumerable<ChannelItemInfo> items, User user, int? startIndex, int? limit, CancellationToken cancellationToken)
|
private async Task<QueryResult<BaseItemDto>> GetReturnItems(IEnumerable<ChannelItemInfo> items, User user, int? startIndex, int? limit, CancellationToken cancellationToken)
|
||||||
|
@ -246,10 +249,36 @@ namespace MediaBrowser.Server.Implementations.Channels
|
||||||
|
|
||||||
private async Task<BaseItem> GetChannelItemEntity(ChannelItemInfo info)
|
private async Task<BaseItem> GetChannelItemEntity(ChannelItemInfo info)
|
||||||
{
|
{
|
||||||
return null;
|
BaseItem item;
|
||||||
|
|
||||||
|
if (info.Type == ChannelItemType.Category)
|
||||||
|
{
|
||||||
|
item = new ChannelCategoryItem();
|
||||||
|
}
|
||||||
|
else if (info.MediaType == ChannelMediaType.Audio)
|
||||||
|
{
|
||||||
|
item = new ChannelAudioItem();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
item = new ChannelVideoItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
private IChannel GetChannelProvider(Channel channel)
|
item.Name = info.Name;
|
||||||
|
item.Genres = info.Genres;
|
||||||
|
item.CommunityRating = info.CommunityRating;
|
||||||
|
item.OfficialRating = info.OfficialRating;
|
||||||
|
item.Overview = info.Overview;
|
||||||
|
item.People = info.People;
|
||||||
|
item.PremiereDate = info.PremiereDate;
|
||||||
|
item.ProductionYear = info.ProductionYear;
|
||||||
|
item.RunTimeTicks = info.RunTimeTicks;
|
||||||
|
item.ProviderIds = info.ProviderIds;
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal IChannel GetChannelProvider(Channel channel)
|
||||||
{
|
{
|
||||||
return _channels.First(i => string.Equals(i.Name, channel.OriginalChannelName, StringComparison.OrdinalIgnoreCase));
|
return _channels.First(i => string.Equals(i.Name, channel.OriginalChannelName, StringComparison.OrdinalIgnoreCase));
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
using MediaBrowser.Common.ScheduledTasks;
|
||||||
|
using MediaBrowser.Controller.Channels;
|
||||||
|
using MediaBrowser.Model.Tasks;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Server.Implementations.Channels
|
||||||
|
{
|
||||||
|
class RefreshChannelsScheduledTask : IScheduledTask, IConfigurableScheduledTask
|
||||||
|
{
|
||||||
|
private readonly IChannelManager _manager;
|
||||||
|
|
||||||
|
public RefreshChannelsScheduledTask(IChannelManager manager)
|
||||||
|
{
|
||||||
|
_manager = manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "Refresh Channels"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Description
|
||||||
|
{
|
||||||
|
get { return "Refreshes internet channel information."; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Category
|
||||||
|
{
|
||||||
|
get { return "Channels"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task Execute(System.Threading.CancellationToken cancellationToken, IProgress<double> progress)
|
||||||
|
{
|
||||||
|
var manager = (ChannelManager)_manager;
|
||||||
|
|
||||||
|
return manager.RefreshChannels(progress, cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<ITaskTrigger> GetDefaultTriggers()
|
||||||
|
{
|
||||||
|
return new ITaskTrigger[]
|
||||||
|
{
|
||||||
|
new StartupTrigger(),
|
||||||
|
|
||||||
|
new SystemEventTrigger{ SystemEvent = SystemEvent.WakeFromSleep},
|
||||||
|
|
||||||
|
new IntervalTrigger{ Interval = TimeSpan.FromHours(24)}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsHidden
|
||||||
|
{
|
||||||
|
get { return true; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsEnabled
|
||||||
|
{
|
||||||
|
get { return true; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -106,8 +106,10 @@
|
||||||
<Link>Properties\SharedVersion.cs</Link>
|
<Link>Properties\SharedVersion.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="BdInfo\BdInfoExaminer.cs" />
|
<Compile Include="BdInfo\BdInfoExaminer.cs" />
|
||||||
|
<Compile Include="Channels\ChannelImageProvider.cs" />
|
||||||
<Compile Include="Channels\ChannelItemImageProvider.cs" />
|
<Compile Include="Channels\ChannelItemImageProvider.cs" />
|
||||||
<Compile Include="Channels\ChannelManager.cs" />
|
<Compile Include="Channels\ChannelManager.cs" />
|
||||||
|
<Compile Include="Channels\RefreshChannelsScheduledTask.cs" />
|
||||||
<Compile Include="Collections\CollectionManager.cs" />
|
<Compile Include="Collections\CollectionManager.cs" />
|
||||||
<Compile Include="Collections\CollectionsDynamicFolder.cs" />
|
<Compile Include="Collections\CollectionsDynamicFolder.cs" />
|
||||||
<Compile Include="Configuration\ServerConfigurationManager.cs" />
|
<Compile Include="Configuration\ServerConfigurationManager.cs" />
|
||||||
|
|
|
@ -171,6 +171,7 @@ namespace MediaBrowser.ServerApplication
|
||||||
private ILocalizationManager LocalizationManager { get; set; }
|
private ILocalizationManager LocalizationManager { get; set; }
|
||||||
|
|
||||||
private IEncodingManager EncodingManager { get; set; }
|
private IEncodingManager EncodingManager { get; set; }
|
||||||
|
private IChannelManager ChannelManager { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the user data repository.
|
/// Gets or sets the user data repository.
|
||||||
|
@ -491,8 +492,8 @@ namespace MediaBrowser.ServerApplication
|
||||||
MediaEncoder);
|
MediaEncoder);
|
||||||
RegisterSingleInstance(EncodingManager);
|
RegisterSingleInstance(EncodingManager);
|
||||||
|
|
||||||
var channelManager = new ChannelManager(UserManager, DtoService, LibraryManager, Logger, ServerConfigurationManager, FileSystemManager);
|
ChannelManager = new ChannelManager(UserManager, DtoService, LibraryManager, Logger, ServerConfigurationManager, FileSystemManager);
|
||||||
RegisterSingleInstance<IChannelManager>(channelManager);
|
RegisterSingleInstance(ChannelManager);
|
||||||
|
|
||||||
var appThemeManager = new AppThemeManager(ApplicationPaths, FileSystemManager, JsonSerializer, Logger);
|
var appThemeManager = new AppThemeManager(ApplicationPaths, FileSystemManager, JsonSerializer, Logger);
|
||||||
RegisterSingleInstance<IAppThemeManager>(appThemeManager);
|
RegisterSingleInstance<IAppThemeManager>(appThemeManager);
|
||||||
|
@ -684,6 +685,8 @@ namespace MediaBrowser.ServerApplication
|
||||||
LiveTvManager.AddParts(GetExports<ILiveTvService>());
|
LiveTvManager.AddParts(GetExports<ILiveTvService>());
|
||||||
|
|
||||||
SessionManager.AddParts(GetExports<ISessionControllerFactory>());
|
SessionManager.AddParts(GetExports<ISessionControllerFactory>());
|
||||||
|
|
||||||
|
ChannelManager.AddParts(GetExports<IChannel>());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -479,6 +479,8 @@ namespace MediaBrowser.WebDashboard.Api
|
||||||
"appsweather.js",
|
"appsweather.js",
|
||||||
"autoorganizetv.js",
|
"autoorganizetv.js",
|
||||||
"autoorganizelog.js",
|
"autoorganizelog.js",
|
||||||
|
"channels.js",
|
||||||
|
"channelitems.js",
|
||||||
"dashboardinfo.js",
|
"dashboardinfo.js",
|
||||||
"dashboardpage.js",
|
"dashboardpage.js",
|
||||||
"directorybrowser.js",
|
"directorybrowser.js",
|
||||||
|
|
|
@ -93,6 +93,12 @@
|
||||||
<Content Include="dashboard-ui\appsplayback.html">
|
<Content Include="dashboard-ui\appsplayback.html">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\channelitems.html">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\channels.html">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="dashboard-ui\css\chromecast.css">
|
<Content Include="dashboard-ui\css\chromecast.css">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
@ -480,6 +486,12 @@
|
||||||
<Content Include="dashboard-ui\scripts\appsplayback.js">
|
<Content Include="dashboard-ui\scripts\appsplayback.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\scripts\channelitems.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\scripts\channels.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="dashboard-ui\scripts\chromecast.js">
|
<Content Include="dashboard-ui\scripts\chromecast.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
|
@ -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.341</version>
|
<version>3.0.343</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.341" />
|
<dependency id="MediaBrowser.Common" version="3.0.343" />
|
||||||
<dependency id="NLog" version="2.1.0" />
|
<dependency id="NLog" version="2.1.0" />
|
||||||
<dependency id="SimpleInjector" version="2.4.1" />
|
<dependency id="SimpleInjector" version="2.4.1" />
|
||||||
<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.341</version>
|
<version>3.0.343</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.341</version>
|
<version>3.0.343</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.341" />
|
<dependency id="MediaBrowser.Common" version="3.0.343" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user