updated nuget

This commit is contained in:
Luke Pulverenti 2014-02-27 11:25:04 -05:00
parent 74625cc580
commit f0f897e97e
9 changed files with 109 additions and 19 deletions

View File

@ -98,7 +98,7 @@ namespace MediaBrowser.Dlna.PlayTo
} }
} }
public Task<HttpResponseInfo> PostSoapDataAsync(Uri url, string soapAction, string postData, string header = null, int timeOut = 20000) private Task<HttpResponseInfo> PostSoapDataAsync(Uri url, string soapAction, string postData, string header = null, int timeOut = 20000)
{ {
if (!soapAction.StartsWith("\"")) if (!soapAction.StartsWith("\""))
soapAction = "\"" + soapAction + "\""; soapAction = "\"" + soapAction + "\"";

View File

@ -2,7 +2,6 @@
using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using System; using System;
@ -188,7 +187,7 @@ namespace MediaBrowser.Providers.All
{ {
PopulateBackdrops(images, files, imagePrefix, "backdrop", "backdrop", ImageType.Backdrop); PopulateBackdrops(images, files, imagePrefix, "backdrop", "backdrop", ImageType.Backdrop);
if (string.IsNullOrEmpty(item.Path)) if (!string.IsNullOrEmpty(item.Path))
{ {
var name = Path.GetFileNameWithoutExtension(item.Path); var name = Path.GetFileNameWithoutExtension(item.Path);

View File

@ -0,0 +1,58 @@
using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Controller.LiveTv;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace MediaBrowser.Server.Implementations.LiveTv
{
class CleanDatabaseScheduledTask : IScheduledTask, IConfigurableScheduledTask
{
private readonly ILiveTvManager _liveTvManager;
public CleanDatabaseScheduledTask(ILiveTvManager liveTvManager)
{
_liveTvManager = liveTvManager;
}
public string Name
{
get { return "Clean TV Database"; }
}
public string Description
{
get { return "Deletes old programs from the tv database."; }
}
public string Category
{
get { return "Live TV"; }
}
public Task Execute(System.Threading.CancellationToken cancellationToken, IProgress<double> progress)
{
var manager = (LiveTvManager)_liveTvManager;
return manager.CleanDatabase(progress, cancellationToken);
}
public IEnumerable<ITaskTrigger> GetDefaultTriggers()
{
return new ITaskTrigger[]
{
new IntervalTrigger{ Interval = TimeSpan.FromHours(24)}
};
}
public bool IsHidden
{
get { return _liveTvManager.ActiveService == null; }
}
public bool IsEnabled
{
get { return true; }
}
}
}

View File

@ -37,7 +37,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
private readonly IUserManager _userManager; private readonly IUserManager _userManager;
private readonly IUserDataManager _userDataManager; private readonly IUserDataManager _userDataManager;
private readonly ILibraryManager _libraryManager; private readonly ILibraryManager _libraryManager;
private readonly IMediaEncoder _mediaEncoder;
private readonly ITaskManager _taskManager; private readonly ITaskManager _taskManager;
private readonly LiveTvDtoService _tvDtoService; private readonly LiveTvDtoService _tvDtoService;
@ -50,7 +49,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv
private List<Guid> _channelIdList = new List<Guid>(); private List<Guid> _channelIdList = new List<Guid>();
private Dictionary<Guid, LiveTvProgram> _programs = new Dictionary<Guid, LiveTvProgram>(); private Dictionary<Guid, LiveTvProgram> _programs = new Dictionary<Guid, LiveTvProgram>();
public LiveTvManager(IServerConfigurationManager config, IFileSystem fileSystem, ILogger logger, IItemRepository itemRepo, IImageProcessor imageProcessor, IUserDataManager userDataManager, IDtoService dtoService, IUserManager userManager, ILibraryManager libraryManager, IMediaEncoder mediaEncoder, ITaskManager taskManager) private SemaphoreSlim _refreshSemaphore = new SemaphoreSlim(1, 1);
public LiveTvManager(IServerConfigurationManager config, IFileSystem fileSystem, ILogger logger, IItemRepository itemRepo, IImageProcessor imageProcessor, IUserDataManager userDataManager, IDtoService dtoService, IUserManager userManager, ILibraryManager libraryManager, ITaskManager taskManager)
{ {
_config = config; _config = config;
_fileSystem = fileSystem; _fileSystem = fileSystem;
@ -58,7 +59,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
_itemRepo = itemRepo; _itemRepo = itemRepo;
_userManager = userManager; _userManager = userManager;
_libraryManager = libraryManager; _libraryManager = libraryManager;
_mediaEncoder = mediaEncoder;
_taskManager = taskManager; _taskManager = taskManager;
_userDataManager = userDataManager; _userDataManager = userDataManager;
@ -706,6 +706,20 @@ namespace MediaBrowser.Server.Implementations.LiveTv
} }
internal async Task RefreshChannels(IProgress<double> progress, CancellationToken cancellationToken) internal async Task RefreshChannels(IProgress<double> progress, CancellationToken cancellationToken)
{
await _refreshSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
try
{
await RefreshChannelsInternal(progress, cancellationToken).ConfigureAwait(false);
}
finally
{
_refreshSemaphore.Release();
}
}
private async Task RefreshChannelsInternal(IProgress<double> progress, CancellationToken cancellationToken)
{ {
// Avoid implicitly captured closure // Avoid implicitly captured closure
var service = ActiveService; var service = ActiveService;
@ -795,21 +809,39 @@ namespace MediaBrowser.Server.Implementations.LiveTv
double percent = numComplete; double percent = numComplete;
percent /= allChannelsList.Count; percent /= allChannelsList.Count;
progress.Report(70 * percent + 10); progress.Report(80 * percent + 10);
} }
_programs = programs.ToDictionary(i => i.Id); _programs = programs.ToDictionary(i => i.Id);
progress.Report(80); progress.Report(90);
// Load these now which will prefetch metadata // Load these now which will prefetch metadata
await GetRecordings(new RecordingQuery(), cancellationToken).ConfigureAwait(false); await GetRecordings(new RecordingQuery(), cancellationToken).ConfigureAwait(false);
progress.Report(85);
await DeleteOldPrograms(_programs.Keys.ToList(), progress, cancellationToken).ConfigureAwait(false);
progress.Report(100); progress.Report(100);
} }
public async Task CleanDatabase(IProgress<double> progress, CancellationToken cancellationToken)
{
var service = ActiveService;
if (service == null)
{
progress.Report(100);
return;
}
await _refreshSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
try
{
await DeleteOldPrograms(_programs.Keys.ToList(), progress, cancellationToken).ConfigureAwait(false);
}
finally
{
_refreshSemaphore.Release();
}
}
private async Task DeleteOldPrograms(List<Guid> currentIdList, IProgress<double> progress, CancellationToken cancellationToken) private async Task DeleteOldPrograms(List<Guid> currentIdList, IProgress<double> progress, CancellationToken cancellationToken)
{ {
var list = _itemRepo.GetItemsOfType(typeof(LiveTvProgram)).ToList(); var list = _itemRepo.GetItemsOfType(typeof(LiveTvProgram)).ToList();
@ -829,7 +861,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
double percent = numComplete; double percent = numComplete;
percent /= list.Count; percent /= list.Count;
progress.Report(15 * percent + 85); progress.Report(100 * percent);
} }
} }

View File

@ -178,6 +178,7 @@
<Compile Include="Library\Validators\StudiosValidator.cs" /> <Compile Include="Library\Validators\StudiosValidator.cs" />
<Compile Include="Library\Validators\YearsPostScanTask.cs" /> <Compile Include="Library\Validators\YearsPostScanTask.cs" />
<Compile Include="LiveTv\ChannelImageProvider.cs" /> <Compile Include="LiveTv\ChannelImageProvider.cs" />
<Compile Include="LiveTv\CleanDatabaseScheduledTask.cs" />
<Compile Include="LiveTv\LiveTvDtoService.cs" /> <Compile Include="LiveTv\LiveTvDtoService.cs" />
<Compile Include="LiveTv\LiveTvManager.cs" /> <Compile Include="LiveTv\LiveTvManager.cs" />
<Compile Include="LiveTv\ProgramImageProvider.cs" /> <Compile Include="LiveTv\ProgramImageProvider.cs" />

View File

@ -438,7 +438,7 @@ namespace MediaBrowser.ServerApplication
MediaEncoder); MediaEncoder);
RegisterSingleInstance(EncodingManager); RegisterSingleInstance(EncodingManager);
LiveTvManager = new LiveTvManager(ServerConfigurationManager, FileSystemManager, Logger, ItemRepository, ImageProcessor, UserDataManager, DtoService, UserManager, LibraryManager, MediaEncoder, TaskManager); LiveTvManager = new LiveTvManager(ServerConfigurationManager, FileSystemManager, Logger, ItemRepository, ImageProcessor, UserDataManager, DtoService, UserManager, LibraryManager, TaskManager);
RegisterSingleInstance(LiveTvManager); RegisterSingleInstance(LiveTvManager);
var displayPreferencesTask = Task.Run(async () => await ConfigureDisplayPreferencesRepositories().ConfigureAwait(false)); var displayPreferencesTask = Task.Run(async () => await ConfigureDisplayPreferencesRepositories().ConfigureAwait(false));

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Common.Internal</id> <id>MediaBrowser.Common.Internal</id>
<version>3.0.332</version> <version>3.0.333</version>
<title>MediaBrowser.Common.Internal</title> <title>MediaBrowser.Common.Internal</title>
<authors>Luke</authors> <authors>Luke</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description> <description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
<copyright>Copyright © Media Browser 2013</copyright> <copyright>Copyright © Media Browser 2013</copyright>
<dependencies> <dependencies>
<dependency id="MediaBrowser.Common" version="3.0.332" /> <dependency id="MediaBrowser.Common" version="3.0.333" />
<dependency id="NLog" version="2.1.0" /> <dependency id="NLog" version="2.1.0" />
<dependency id="SimpleInjector" version="2.4.1" /> <dependency id="SimpleInjector" version="2.4.1" />
<dependency id="sharpcompress" version="0.10.2" /> <dependency id="sharpcompress" version="0.10.2" />

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Common</id> <id>MediaBrowser.Common</id>
<version>3.0.332</version> <version>3.0.333</version>
<title>MediaBrowser.Common</title> <title>MediaBrowser.Common</title>
<authors>Media Browser Team</authors> <authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Server.Core</id> <id>MediaBrowser.Server.Core</id>
<version>3.0.332</version> <version>3.0.333</version>
<title>Media Browser.Server.Core</title> <title>Media Browser.Server.Core</title>
<authors>Media Browser Team</authors> <authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains core components required to build plugins for Media Browser Server.</description> <description>Contains core components required to build plugins for Media Browser Server.</description>
<copyright>Copyright © Media Browser 2013</copyright> <copyright>Copyright © Media Browser 2013</copyright>
<dependencies> <dependencies>
<dependency id="MediaBrowser.Common" version="3.0.332" /> <dependency id="MediaBrowser.Common" version="3.0.333" />
</dependencies> </dependencies>
</metadata> </metadata>
<files> <files>