update recording sync fields

This commit is contained in:
Luke Pulverenti 2016-02-11 13:29:42 -05:00
parent 232d0eb14c
commit 9e8d35dadc
6 changed files with 20 additions and 13 deletions

View File

@ -1,4 +1,5 @@
using MediaBrowser.Controller.Entities; using System;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Dto; using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Querying; using MediaBrowser.Model.Querying;
using System.Collections.Generic; using System.Collections.Generic;
@ -44,10 +45,10 @@ namespace MediaBrowser.Controller.Dto
/// <summary> /// <summary>
/// Fills the synchronize information. /// Fills the synchronize information.
/// </summary> /// </summary>
/// <param name="dtos">The dtos.</param> /// <param name="tuples">The tuples.</param>
/// <param name="options">The options.</param> /// <param name="options">The options.</param>
/// <param name="user">The user.</param> /// <param name="user">The user.</param>
void FillSyncInfo(IEnumerable<IHasSyncInfo> dtos, DtoOptions options, User user); void FillSyncInfo(IEnumerable<Tuple<BaseItem, BaseItemDto>> tuples, DtoOptions options, User user);
/// <summary> /// <summary>
/// Gets the base item dto. /// Gets the base item dto.

View File

@ -329,7 +329,6 @@ namespace MediaBrowser.Controller.Library
/// <param name="parentId">The parent identifier.</param> /// <param name="parentId">The parent identifier.</param>
/// <param name="viewType">Type of the view.</param> /// <param name="viewType">Type of the view.</param>
/// <param name="sortName">Name of the sort.</param> /// <param name="sortName">Name of the sort.</param>
/// <param name="uniqueId">The unique identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task&lt;UserView&gt;.</returns> /// <returns>Task&lt;UserView&gt;.</returns>
Task<UserView> GetNamedView(User user, Task<UserView> GetNamedView(User user,

View File

@ -99,7 +99,7 @@ namespace MediaBrowser.Providers.People
var requestCount = _requestCount; var requestCount = _requestCount;
if (requestCount >= 5) if (requestCount >= 10)
{ {
//_logger.Debug("Throttling Tmdb people"); //_logger.Debug("Throttling Tmdb people");

View File

@ -212,17 +212,17 @@ namespace MediaBrowser.Server.Implementations.Dto
}).Items; }).Items;
} }
public void FillSyncInfo(IEnumerable<IHasSyncInfo> dtos, DtoOptions options, User user) public void FillSyncInfo(IEnumerable<Tuple<BaseItem, BaseItemDto>> tuples, DtoOptions options, User user)
{ {
if (options.Fields.Contains(ItemFields.SyncInfo)) if (options.Fields.Contains(ItemFields.SyncInfo))
{ {
var syncProgress = GetSyncedItemProgress(options); var syncProgress = GetSyncedItemProgress(options);
foreach (var dto in dtos) foreach (var tuple in tuples)
{ {
var item = _libraryManager.GetItemById(dto.Id); var item = tuple.Item1;
FillSyncInfo(dto, item, syncProgress, options, user); FillSyncInfo(tuple.Item2, item, syncProgress, options, user);
} }
} }
} }

View File

@ -1592,18 +1592,18 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var internalResult = await GetInternalRecordings(query, cancellationToken).ConfigureAwait(false); var internalResult = await GetInternalRecordings(query, cancellationToken).ConfigureAwait(false);
var returnArray = internalResult.Items var tuples = internalResult.Items
.Select(i => _dtoService.GetBaseItemDto(i, options, user)) .Select(i => new Tuple<BaseItem, BaseItemDto>(i, _dtoService.GetBaseItemDto(i, options, user)))
.ToArray(); .ToArray();
if (user != null) if (user != null)
{ {
_dtoService.FillSyncInfo(returnArray, new DtoOptions(), user); _dtoService.FillSyncInfo(tuples, new DtoOptions(), user);
} }
return new QueryResult<BaseItemDto> return new QueryResult<BaseItemDto>
{ {
Items = returnArray, Items = tuples.Select(i => i.Item2).ToArray(),
TotalRecordCount = internalResult.TotalRecordCount TotalRecordCount = internalResult.TotalRecordCount
}; };
} }
@ -1684,6 +1684,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
} }
_lastRecordingRefreshTime = DateTime.MinValue;
// This is the responsibility of the live tv service // This is the responsibility of the live tv service
await _libraryManager.DeleteItem((BaseItem)recording, new DeleteOptions await _libraryManager.DeleteItem((BaseItem)recording, new DeleteOptions
{ {

View File

@ -491,6 +491,11 @@ namespace MediaBrowser.Server.Implementations.Sync
public bool SupportsSync(BaseItem item) public bool SupportsSync(BaseItem item)
{ {
if (item == null)
{
throw new ArgumentNullException("item");
}
if (item is Playlist) if (item is Playlist)
{ {
return true; return true;