Skip to content

Commit

Permalink
update tv db cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
LukePulverenti committed Mar 25, 2015
1 parent 9b86e21 commit 2b580b0
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion MediaBrowser.Controller/Persistence/IItemRepository.cs
Expand Up @@ -107,7 +107,7 @@ public interface IItemRepository : IRepository
/// </summary>
/// <param name="type">The type.</param>
/// <returns>IEnumerable{Guid}.</returns>
IEnumerable<string> GetItemsOfType(Type type);
IEnumerable<Guid> GetItemsOfType(Type type);

/// <summary>
/// Saves the children.
Expand Down
5 changes: 0 additions & 5 deletions MediaBrowser.Dlna/PlayTo/PlayToController.cs
Expand Up @@ -134,11 +134,6 @@ private void updateTimer_Elapsed(object state)
}
}

private string GetServerAddress()
{
return _serverAddress;
}

async void _device_MediaChanged(object sender, MediaChangedEventArgs e)
{
try
Expand Down
Expand Up @@ -25,14 +25,14 @@ public Task<SessionInfo> GetSession(IServiceRequest requestContext)
{
var authorization = _authContext.GetAuthorizationInfo(requestContext);

if (!string.IsNullOrWhiteSpace(authorization.Token))
{
var auth = GetTokenInfo(requestContext);
if (auth != null)
{
return _sessionManager.GetSessionByAuthenticationToken(auth, authorization.DeviceId, requestContext.RemoteIp, authorization.Version);
}
}
//if (!string.IsNullOrWhiteSpace(authorization.Token))
//{
// var auth = GetTokenInfo(requestContext);
// if (auth != null)
// {
// return _sessionManager.GetSessionByAuthenticationToken(auth, authorization.DeviceId, requestContext.RemoteIp, authorization.Version);
// }
//}

var session = _sessionManager.GetSession(authorization.DeviceId, authorization.Client, authorization.Version);
return Task.FromResult(session);
Expand Down
Expand Up @@ -1115,7 +1115,7 @@ private async Task DeleteOldPrograms(List<Guid> currentIdList, IProgress<double>
{
cancellationToken.ThrowIfCancellationRequested();

if (!currentIdList.Contains(new Guid(programId)))
if (!currentIdList.Contains(programId))
{
var program = _libraryManager.GetItemById(programId);

Expand Down
Expand Up @@ -521,8 +521,8 @@ public IEnumerable<BaseItem> GetChildrenItems(Guid parentId)
}
}
}
public IEnumerable<string> GetItemsOfType(Type type)

public IEnumerable<Guid> GetItemsOfType(Type type)
{
if (type == null)
{
Expand All @@ -541,7 +541,7 @@ public IEnumerable<string> GetItemsOfType(Type type)
{
while (reader.Read())
{
yield return reader.GetString(0);
yield return reader.GetGuid(0);
}
}
}
Expand Down
Expand Up @@ -125,7 +125,7 @@ public async Task<DynamicImageResponse> GetImage(IHasImages item, ImageType type

protected abstract Task<List<BaseItem>> GetItemsWithImages(IHasImages item);

private const string Version = "3";
private const string Version = "4";
protected string GetConfigurationCacheKey(List<BaseItem> items, string itemName)
{
var parts = Version + "_" + (itemName ?? string.Empty) + "_" +
Expand Down
Expand Up @@ -41,17 +41,25 @@ public bool SupportsMediaControl
}

private bool _isActive;
private DateTime _lastActivityDate;
public bool IsSessionActive
{
get
{
return HasOpenSockets;
if (HasOpenSockets)
{
return true;
}

//return false;
return _isActive && (DateTime.UtcNow - _lastActivityDate).TotalMinutes <= 10;
}
}

public void OnActivity()
{
_isActive = true;
_lastActivityDate = DateTime.UtcNow;
}

private IEnumerable<IWebSocketConnection> GetActiveSockets()
Expand Down

0 comments on commit 2b580b0

Please sign in to comment.