Merge pull request #1730 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2016-05-13 14:31:53 -04:00
commit 4a28c31d23
14 changed files with 71 additions and 46 deletions

View File

@ -311,7 +311,7 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
trigger.Triggered -= trigger_Triggered;
trigger.Triggered += trigger_Triggered;
trigger.Start(LastExecutionResult, isApplicationStartup);
trigger.Start(LastExecutionResult, Logger, Name, isApplicationStartup);
}
}
@ -339,7 +339,7 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
await Task.Delay(1000).ConfigureAwait(false);
trigger.Start(LastExecutionResult, false);
trigger.Start(LastExecutionResult, Logger, Name, false);
}
private Task _currentTask;

View File

@ -1,7 +1,9 @@
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Tasks;
using System;
using System.Globalization;
using System.Threading;
using MediaBrowser.Model.Logging;
namespace MediaBrowser.Common.ScheduledTasks
{
@ -35,7 +37,7 @@ namespace MediaBrowser.Common.ScheduledTasks
/// </summary>
/// <param name="lastResult">The last result.</param>
/// <param name="isApplicationStartup">if set to <c>true</c> [is application startup].</param>
public void Start(TaskResult lastResult, bool isApplicationStartup)
public void Start(TaskResult lastResult, ILogger logger, string taskName, bool isApplicationStartup)
{
DisposeTimer();
@ -44,7 +46,11 @@ namespace MediaBrowser.Common.ScheduledTasks
var triggerDate = now.TimeOfDay > TimeOfDay ? now.Date.AddDays(1) : now.Date;
triggerDate = triggerDate.Add(TimeOfDay);
Timer = new Timer(state => OnTriggered(), null, triggerDate - now, TimeSpan.FromMilliseconds(-1));
var dueTime = triggerDate - now;
logger.Info("Daily trigger for {0} set to fire at {1}, which is {2} minutes from now.", taskName, triggerDate.ToString(), dueTime.TotalMinutes.ToString(CultureInfo.InvariantCulture));
Timer = new Timer(state => OnTriggered(), null, dueTime, TimeSpan.FromMilliseconds(-1));
}
/// <summary>

View File

@ -1,6 +1,7 @@
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Tasks;
using System;
using MediaBrowser.Model.Logging;
namespace MediaBrowser.Common.ScheduledTasks
{
@ -19,7 +20,7 @@ namespace MediaBrowser.Common.ScheduledTasks
/// </summary>
/// <param name="lastResult">The last result.</param>
/// <param name="isApplicationStartup">if set to <c>true</c> [is application startup].</param>
void Start(TaskResult lastResult, bool isApplicationStartup);
void Start(TaskResult lastResult, ILogger logger, string taskName, bool isApplicationStartup);
/// <summary>
/// Stops waiting for the trigger action

View File

@ -3,6 +3,7 @@ using MediaBrowser.Model.Tasks;
using System;
using System.Linq;
using System.Threading;
using MediaBrowser.Model.Logging;
namespace MediaBrowser.Common.ScheduledTasks
{
@ -38,7 +39,7 @@ namespace MediaBrowser.Common.ScheduledTasks
/// </summary>
/// <param name="lastResult">The last result.</param>
/// <param name="isApplicationStartup">if set to <c>true</c> [is application startup].</param>
public void Start(TaskResult lastResult, bool isApplicationStartup)
public void Start(TaskResult lastResult, ILogger logger, string taskName, bool isApplicationStartup)
{
DisposeTimer();

View File

@ -2,6 +2,7 @@
using MediaBrowser.Model.Tasks;
using System;
using System.Threading.Tasks;
using MediaBrowser.Model.Logging;
namespace MediaBrowser.Common.ScheduledTasks
{
@ -30,7 +31,7 @@ namespace MediaBrowser.Common.ScheduledTasks
/// </summary>
/// <param name="lastResult">The last result.</param>
/// <param name="isApplicationStartup">if set to <c>true</c> [is application startup].</param>
public async void Start(TaskResult lastResult, bool isApplicationStartup)
public async void Start(TaskResult lastResult, ILogger logger, string taskName, bool isApplicationStartup)
{
if (isApplicationStartup)
{

View File

@ -3,6 +3,7 @@ using MediaBrowser.Model.Tasks;
using Microsoft.Win32;
using System;
using System.Threading.Tasks;
using MediaBrowser.Model.Logging;
namespace MediaBrowser.Common.ScheduledTasks
{
@ -30,7 +31,7 @@ namespace MediaBrowser.Common.ScheduledTasks
/// </summary>
/// <param name="lastResult">The last result.</param>
/// <param name="isApplicationStartup">if set to <c>true</c> [is application startup].</param>
public void Start(TaskResult lastResult, bool isApplicationStartup)
public void Start(TaskResult lastResult, ILogger logger, string taskName, bool isApplicationStartup)
{
switch (SystemEvent)
{

View File

@ -1,6 +1,7 @@
using System;
using System.Threading;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Common.ScheduledTasks
@ -41,7 +42,7 @@ namespace MediaBrowser.Common.ScheduledTasks
/// </summary>
/// <param name="lastResult">The last result.</param>
/// <param name="isApplicationStartup">if set to <c>true</c> [is application startup].</param>
public void Start(TaskResult lastResult, bool isApplicationStartup)
public void Start(TaskResult lastResult, ILogger logger, string taskName, bool isApplicationStartup)
{
DisposeTimer();

View File

@ -104,7 +104,14 @@ namespace MediaBrowser.Controller.Entities.TV
[IgnoreDataMember]
public override string PresentationUniqueKey
{
get { return GetUserDataKeys().First(); }
get
{
if (EnablePooling())
{
return GetUserDataKeys().First();
}
return base.PresentationUniqueKey;
}
}
/// <summary>

View File

@ -0,0 +1,12 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Notifications;
namespace MediaBrowser.Controller.Health
{
public interface IHealthMonitor
{
Task<List<Notification>> GetNotifications(CancellationToken cancellationToken);
}
}

View File

@ -180,6 +180,7 @@
<Compile Include="Entities\UserView.cs" />
<Compile Include="Entities\UserViewBuilder.cs" />
<Compile Include="FileOrganization\IFileOrganizationService.cs" />
<Compile Include="Health\IHealthMonitor.cs" />
<Compile Include="IO\ThrottledStream.cs" />
<Compile Include="Library\DeleteOptions.cs" />
<Compile Include="Library\ILibraryPostScanTask.cs" />

View File

@ -933,21 +933,10 @@ namespace MediaBrowser.Server.Implementations.Library
Path.Combine(path, validFilename) :
Path.Combine(path, subFolderPrefix, validFilename);
var id = GetNewItemId(fullPath, type);
BaseItem obj;
if (!_libraryItemsCache.TryGetValue(id, out obj))
{
obj = CreateItemByName<T>(fullPath, name, id);
RegisterItem(id, obj);
}
return obj as T;
return CreateItemByName<T>(fullPath, name);
}
private T CreateItemByName<T>(string path, string name, Guid id)
private T CreateItemByName<T>(string path, string name)
where T : BaseItem, new()
{
var isArtist = typeof(T) == typeof(MusicArtist);
@ -970,6 +959,8 @@ namespace MediaBrowser.Server.Implementations.Library
}
}
var id = GetNewItemId(path, typeof(T));
var item = GetItemById(id) as T;
if (item == null)

View File

@ -1,4 +1,3 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.Movies;
@ -85,15 +84,11 @@ namespace MediaBrowser.Server.Implementations.Persistence
private IDbCommand _updateInheritedRatingCommand;
private IDbCommand _updateInheritedTagsCommand;
public const int LatestSchemaVersion = 77;
public const int LatestSchemaVersion = 78;
/// <summary>
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.
/// </summary>
/// appPaths
/// or
/// jsonSerializer
/// </exception>
public SqliteItemRepository(IServerConfigurationManager config, IJsonSerializer jsonSerializer, ILogManager logManager)
: base(logManager)
{
@ -356,7 +351,9 @@ namespace MediaBrowser.Server.Implementations.Persistence
"OriginalTitle",
"PrimaryVersionId",
"DateLastMediaAdded",
"Album"
"Album",
"CriticRating",
"CriticRatingSummary"
};
private readonly string[] _mediaStreamSaveColumns =
@ -1247,6 +1244,16 @@ namespace MediaBrowser.Server.Implementations.Persistence
item.Album = reader.GetString(55);
}
if (!reader.IsDBNull(56))
{
item.CriticRating = reader.GetFloat(56);
}
if (!reader.IsDBNull(57))
{
item.CriticRatingSummary = reader.GetString(57);
}
return item;
}
@ -2306,12 +2313,13 @@ namespace MediaBrowser.Server.Implementations.Persistence
if (_config.Configuration.SchemaVersion >= 66)
{
whereClauses.Add("CleanName=@Name");
cmd.Parameters.Add(cmd, "@Name", DbType.String).Value = query.Name.RemoveDiacritics();
}
else
{
whereClauses.Add("Name=@Name");
cmd.Parameters.Add(cmd, "@Name", DbType.String).Value = query.Name;
}
cmd.Parameters.Add(cmd, "@Name", DbType.String).Value = query.Name;
}
if (!string.IsNullOrWhiteSpace(query.NameContains))
@ -2324,7 +2332,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
{
whereClauses.Add("Name like @NameContains");
}
cmd.Parameters.Add(cmd, "@NameContains", DbType.String).Value = "%" + query.NameContains + "%";
cmd.Parameters.Add(cmd, "@NameContains", DbType.String).Value = "%" + query.NameContains.RemoveDiacritics() + "%";
}
if (!string.IsNullOrWhiteSpace(query.NameStartsWith))
{

View File

@ -316,7 +316,7 @@ namespace MediaBrowser.WebDashboard.Api
DeleteFilesByExtension(bowerPath, ".txt");
DeleteFilesByExtension(bowerPath, ".map");
DeleteFilesByExtension(bowerPath, ".md");
DeleteFilesByExtension(bowerPath, ".json");
DeleteFilesByExtension(bowerPath, ".json", "strings\\");
DeleteFilesByExtension(bowerPath, ".gz");
DeleteFilesByExtension(bowerPath, ".bat");
DeleteFilesByExtension(bowerPath, ".sh");
@ -401,7 +401,7 @@ namespace MediaBrowser.WebDashboard.Api
}
}
private void DeleteFilesByExtension(string path, string extension)
private void DeleteFilesByExtension(string path, string extension, string exclude = null)
{
var files = _fileSystem.GetFiles(path, true)
.Where(i => string.Equals(i.Extension, extension, StringComparison.OrdinalIgnoreCase))
@ -409,6 +409,13 @@ namespace MediaBrowser.WebDashboard.Api
foreach (var file in files)
{
if (!string.IsNullOrWhiteSpace(exclude))
{
if (file.FullName.IndexOf(exclude, StringComparison.OrdinalIgnoreCase) != -1)
{
continue;
}
}
_fileSystem.DeleteFile(file.FullName);
}
}

View File

@ -140,12 +140,6 @@
<Content Include="dashboard-ui\components\metadataeditor\personeditor.template.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\components\recordingcreator\recordingcreator.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\components\recordingcreator\recordingcreator.template.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\components\recordingeditor\recordingeditor.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -467,9 +461,6 @@
<Content Include="dashboard-ui\thirdparty\jquerymobile-1.4.5\jquery.mobile.custom.icons.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jquerymobile-1.4.5\jquery.mobile.custom.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jquerymobile-1.4.5\jquery.mobile.custom.theme.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -1710,9 +1701,6 @@
<Content Include="dashboard-ui\thirdparty\jquerymobile-1.4.5\jqm.popup.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="dashboard-ui\thirdparty\jquerymobile-1.4.5\jquery.mobile-1.4.5.min.map">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="dashboard-ui\voice\grammar\en-US.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>