support sync for live tv recordings

This commit is contained in:
Luke Pulverenti
2015-04-12 14:58:21 -04:00
parent d4b61da59d
commit 933fca78e6
14 changed files with 153 additions and 19 deletions

View File

@@ -35,6 +35,14 @@ namespace MediaBrowser.Controller.Dto
/// <returns>Task{BaseItemDto}.</returns>
BaseItemDto GetBaseItemDto(BaseItem item, List<ItemFields> fields, User user = null, BaseItem owner = null);
/// <summary>
/// Fills the synchronize information.
/// </summary>
/// <param name="dtos">The dtos.</param>
/// <param name="options">The options.</param>
/// <param name="user">The user.</param>
void FillSyncInfo(IEnumerable<IHasSyncInfo> dtos, DtoOptions options, User user);
/// <summary>
/// Gets the base item dto.
/// </summary>

View File

@@ -50,6 +50,16 @@ namespace MediaBrowser.Controller.Entities
{
var user = query.User;
if (query.IncludeItemTypes != null &&
query.IncludeItemTypes.Length == 1 &&
string.Equals(query.IncludeItemTypes[0], "Playlist", StringComparison.OrdinalIgnoreCase))
{
if (!string.Equals(viewType, CollectionType.Playlists, StringComparison.OrdinalIgnoreCase))
{
return await FindPlaylists(queryParent, user, query).ConfigureAwait(false);
}
}
switch (viewType)
{
case CollectionType.Channels:
@@ -240,6 +250,16 @@ namespace MediaBrowser.Controller.Entities
}
}
private async Task<QueryResult<BaseItem>> FindPlaylists(Folder parent, User user, InternalItemsQuery query)
{
var collectionFolders = user.RootFolder.GetChildren(user, true).Select(i => i.Id).ToList();
var list = _playlistManager.GetPlaylists(user.Id.ToString("N"))
.Where(i => i.GetChildren(user, true).Any(media => _libraryManager.GetCollectionFolders(media).Select(c => c.Id).Any(collectionFolders.Contains)));
return GetResult(list, parent, query);
}
private int GetSpecialItemsLimit()
{
return 50;

View File

@@ -1,4 +1,5 @@
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.LiveTv;
@@ -74,10 +75,11 @@ namespace MediaBrowser.Controller.LiveTv
/// Gets the recording.
/// </summary>
/// <param name="id">The identifier.</param>
/// <param name="user">The user.</param>
/// <param name="options">The options.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <param name="user">The user.</param>
/// <returns>Task{RecordingInfoDto}.</returns>
Task<RecordingInfoDto> GetRecording(string id, CancellationToken cancellationToken, User user = null);
Task<RecordingInfoDto> GetRecording(string id, DtoOptions options, CancellationToken cancellationToken, User user = null);
/// <summary>
/// Gets the channel.
@@ -103,14 +105,15 @@ namespace MediaBrowser.Controller.LiveTv
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{TimerInfoDto}.</returns>
Task<SeriesTimerInfoDto> GetSeriesTimer(string id, CancellationToken cancellationToken);
/// <summary>
/// Gets the recordings.
/// </summary>
/// <param name="query">The query.</param>
/// <param name="options">The options.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>QueryResult{RecordingInfoDto}.</returns>
Task<QueryResult<RecordingInfoDto>> GetRecordings(RecordingQuery query, CancellationToken cancellationToken);
Task<QueryResult<RecordingInfoDto>> GetRecordings(RecordingQuery query, DtoOptions options, CancellationToken cancellationToken);
/// <summary>
/// Gets the timers.