add activity log feature

This commit is contained in:
Luke Pulverenti
2014-08-10 18:13:17 -04:00
parent 0f508dab47
commit e84ba17b9f
59 changed files with 1539 additions and 303 deletions

View File

@@ -0,0 +1,17 @@
using MediaBrowser.Model.Activity;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Querying;
using System;
using System.Threading.Tasks;
namespace MediaBrowser.Controller.Activity
{
public interface IActivityManager
{
event EventHandler<GenericEventArgs<ActivityLogEntry>> EntryCreated;
Task Create(ActivityLogEntry entry);
QueryResult<ActivityLogEntry> GetActivityLogEntries(int? startIndex, int? limit);
}
}

View File

@@ -0,0 +1,13 @@
using MediaBrowser.Model.Activity;
using MediaBrowser.Model.Querying;
using System.Threading.Tasks;
namespace MediaBrowser.Controller.Activity
{
public interface IActivityRepository
{
Task Create(ActivityLogEntry entry);
QueryResult<ActivityLogEntry> GetActivityLogEntries(int? startIndex, int? limit);
}
}

View File

@@ -1,7 +1,5 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Events;
using System;
namespace MediaBrowser.Controller.Configuration
{
@@ -10,11 +8,6 @@ namespace MediaBrowser.Controller.Configuration
/// </summary>
public interface IServerConfigurationManager : IConfigurationManager
{
/// <summary>
/// Occurs when [configuration updating].
/// </summary>
event EventHandler<GenericEventArgs<ServerConfiguration>> ConfigurationUpdating;
/// <summary>
/// Gets the application paths.
/// </summary>

View File

@@ -102,17 +102,9 @@ namespace MediaBrowser.Controller.Entities.Movies
var totalItems = items.Count;
var percentages = new Dictionary<Guid, double>(totalItems);
var tasks = new List<Task>();
// Refresh songs
foreach (var item in items)
{
if (tasks.Count >= 3)
{
await Task.WhenAll(tasks).ConfigureAwait(false);
tasks.Clear();
}
cancellationToken.ThrowIfCancellationRequested();
var innerProgress = new ActionableProgress<double>();
@@ -132,13 +124,9 @@ namespace MediaBrowser.Controller.Entities.Movies
});
// Avoid implicitly captured closure
var taskChild = item;
tasks.Add(Task.Run(async () => await RefreshItem(taskChild, refreshOptions, innerProgress, cancellationToken).ConfigureAwait(false), cancellationToken));
await RefreshItem(item, refreshOptions, innerProgress, cancellationToken).ConfigureAwait(false);
}
await Task.WhenAll(tasks).ConfigureAwait(false);
tasks.Clear();
// Refresh current item
await RefreshMetadata(refreshOptions, cancellationToken).ConfigureAwait(false);

View File

@@ -31,6 +31,7 @@ namespace MediaBrowser.Controller.Library
event EventHandler<GenericEventArgs<User>> UserCreated;
event EventHandler<GenericEventArgs<User>> UserConfigurationUpdated;
event EventHandler<GenericEventArgs<User>> UserPasswordChanged;
/// <summary>
/// Updates the configuration.

View File

@@ -269,7 +269,7 @@ namespace MediaBrowser.Controller.Library
if ((attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
{
logger.Debug("Igoring series file or folder marked hidden: {0}", child.FullName);
//logger.Debug("Igoring series file or folder marked hidden: {0}", child.FullName);
continue;
}

View File

@@ -68,6 +68,8 @@
<Compile Include="..\SharedVersion.cs">
<Link>Properties\SharedVersion.cs</Link>
</Compile>
<Compile Include="Activity\IActivityManager.cs" />
<Compile Include="Activity\IActivityRepository.cs" />
<Compile Include="Channels\ChannelFolderItem.cs" />
<Compile Include="Channels\ChannelItemInfo.cs" />
<Compile Include="Channels\ChannelItemResult.cs" />
@@ -241,6 +243,7 @@
<Compile Include="Security\AuthenticationInfoQuery.cs" />
<Compile Include="Security\IAuthenticationRepository.cs" />
<Compile Include="Security\IEncryptionManager.cs" />
<Compile Include="Session\AuthenticationRequest.cs" />
<Compile Include="Subtitles\ISubtitleManager.cs" />
<Compile Include="Subtitles\ISubtitleProvider.cs" />
<Compile Include="Providers\ItemIdentifier.cs" />
@@ -320,6 +323,7 @@
<Compile Include="Sorting\IUserBaseItemComparer.cs" />
<Compile Include="Providers\BaseItemXmlParser.cs" />
<Compile Include="Sorting\SortExtensions.cs" />
<Compile Include="Subtitles\SubtitleDownloadEventArgs.cs" />
<Compile Include="Subtitles\SubtitleResponse.cs" />
<Compile Include="Subtitles\SubtitleSearchRequest.cs" />
<Compile Include="Sync\ICloudSyncProvider.cs" />
@@ -360,4 +364,4 @@ xcopy "$(TargetPath)" "$(SolutionDir)\Nuget\dlls\" /y /d /r /i
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>

View File

@@ -16,10 +16,6 @@ namespace MediaBrowser.Controller.Notifications
/// </summary>
event EventHandler<NotificationUpdateEventArgs> NotificationAdded;
/// <summary>
/// Occurs when [notification updated].
/// </summary>
event EventHandler<NotificationUpdateEventArgs> NotificationUpdated;
/// <summary>
/// Occurs when [notifications marked read].
/// </summary>
event EventHandler<NotificationReadEventArgs> NotificationsMarkedRead;
@@ -37,14 +33,6 @@ namespace MediaBrowser.Controller.Notifications
/// <returns>NotificationResult.</returns>
NotificationResult GetNotifications(NotificationQuery query);
/// <summary>
/// Gets the notification.
/// </summary>
/// <param name="id">The id.</param>
/// <param name="userId">The user id.</param>
/// <returns>Notification.</returns>
Notification GetNotification(string id, string userId);
/// <summary>
/// Adds the notification.
/// </summary>

View File

@@ -0,0 +1,14 @@

namespace MediaBrowser.Controller.Session
{
public class AuthenticationRequest
{
public string Username { get; set; }
public string Password { get; set; }
public string App { get; set; }
public string AppVersion { get; set; }
public string DeviceId { get; set; }
public string DeviceName { get; set; }
public string RemoteEndPoint { get; set; }
}
}

View File

@@ -1,6 +1,7 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Session;
using MediaBrowser.Model.Users;
using System;
@@ -46,6 +47,16 @@ namespace MediaBrowser.Controller.Session
/// Occurs when [capabilities changed].
/// </summary>
event EventHandler<SessionEventArgs> CapabilitiesChanged;
/// <summary>
/// Occurs when [authentication failed].
/// </summary>
event EventHandler<GenericEventArgs<AuthenticationRequest>> AuthenticationFailed;
/// <summary>
/// Occurs when [authentication succeeded].
/// </summary>
event EventHandler<GenericEventArgs<AuthenticationRequest>> AuthenticationSucceeded;
/// <summary>
/// Gets the sessions.
@@ -211,23 +222,10 @@ namespace MediaBrowser.Controller.Session
/// <summary>
/// Authenticates the new session.
/// </summary>
/// <param name="username">The username.</param>
/// <param name="password">The password.</param>
/// <param name="clientType">Type of the client.</param>
/// <param name="appVersion">The application version.</param>
/// <param name="deviceId">The device identifier.</param>
/// <param name="deviceName">Name of the device.</param>
/// <param name="remoteEndPoint">The remote end point.</param>
/// <param name="request">The request.</param>
/// <param name="isLocal">if set to <c>true</c> [is local].</param>
/// <returns>Task{SessionInfo}.</returns>
Task<AuthenticationResult> AuthenticateNewSession(string username,
string password,
string clientType,
string appVersion,
string deviceId,
string deviceName,
string remoteEndPoint,
bool isLocal);
Task<AuthenticationResult> AuthenticateNewSession(AuthenticationRequest request, bool isLocal);
/// <summary>
/// Reports the capabilities.

View File

@@ -1,5 +1,6 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Providers;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
@@ -8,6 +9,16 @@ namespace MediaBrowser.Controller.Subtitles
{
public interface ISubtitleManager
{
/// <summary>
/// Occurs when [subtitle download failure].
/// </summary>
event EventHandler<SubtitleDownloadFailureEventArgs> SubtitleDownloadFailure;
/// <summary>
/// Occurs when [subtitles downloaded].
/// </summary>
event EventHandler<SubtitleDownloadEventArgs> SubtitlesDownloaded;
/// <summary>
/// Adds the parts.
/// </summary>
@@ -31,7 +42,7 @@ namespace MediaBrowser.Controller.Subtitles
/// <param name="request">The request.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{IEnumerable{RemoteSubtitleInfo}}.</returns>
Task<IEnumerable<RemoteSubtitleInfo>> SearchSubtitles(SubtitleSearchRequest request,
Task<IEnumerable<RemoteSubtitleInfo>> SearchSubtitles(SubtitleSearchRequest request,
CancellationToken cancellationToken);
/// <summary>
@@ -41,8 +52,8 @@ namespace MediaBrowser.Controller.Subtitles
/// <param name="subtitleId">The subtitle identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task DownloadSubtitles(Video video,
string subtitleId,
Task DownloadSubtitles(Video video,
string subtitleId,
CancellationToken cancellationToken);
/// <summary>

View File

@@ -0,0 +1,27 @@
using System;
using MediaBrowser.Controller.Entities;
namespace MediaBrowser.Controller.Subtitles
{
public class SubtitleDownloadEventArgs
{
public BaseItem Item { get; set; }
public string Format { get; set; }
public string Language { get; set; }
public bool IsForced { get; set; }
public string Provider { get; set; }
}
public class SubtitleDownloadFailureEventArgs
{
public BaseItem Item { get; set; }
public string Provider { get; set; }
public Exception Exception { get; set; }
}
}