diskscan is triggered when new episodes are added.
This commit is contained in:
parent
c6933f0228
commit
80759f923e
|
@ -204,7 +204,7 @@
|
||||||
<Compile Include="ParserTests\ParserFixture.cs" />
|
<Compile Include="ParserTests\ParserFixture.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Qualities\QualityProfileFixture.cs" />
|
<Compile Include="Qualities\QualityProfileFixture.cs" />
|
||||||
<Compile Include="TvTests\SeriesProviderTest.cs" />
|
<Compile Include="TvTests\SeriesServiceFixture.cs" />
|
||||||
<Compile Include="UpdateTests\UpdatePackageProviderFixture.cs" />
|
<Compile Include="UpdateTests\UpdatePackageProviderFixture.cs" />
|
||||||
<Compile Include="UpdateTests\GetUpdateLogFixture.cs" />
|
<Compile Include="UpdateTests\GetUpdateLogFixture.cs" />
|
||||||
<Compile Include="XbmcVersionTests.cs" />
|
<Compile Include="XbmcVersionTests.cs" />
|
||||||
|
|
Binary file not shown.
|
@ -13,9 +13,5 @@ namespace NzbDrone.Core.MediaFiles.Commands
|
||||||
SeriesId = seriesId;
|
SeriesId = seriesId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DiskScanCommand()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,6 +9,7 @@ using NzbDrone.Core.MediaFiles.Commands;
|
||||||
using NzbDrone.Core.Parser;
|
using NzbDrone.Core.Parser;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
|
using NzbDrone.Core.Tv.Events;
|
||||||
|
|
||||||
namespace NzbDrone.Core.MediaFiles
|
namespace NzbDrone.Core.MediaFiles
|
||||||
{
|
{
|
||||||
|
@ -18,7 +19,7 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
string[] GetVideoFiles(string path, bool allDirectories = true);
|
string[] GetVideoFiles(string path, bool allDirectories = true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DiskScanService : IDiskScanService, IExecute<DiskScanCommand>
|
public class DiskScanService : IDiskScanService, IExecute<DiskScanCommand>, IHandle<EpisodeInfoAddedEvent>
|
||||||
{
|
{
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
private static readonly string[] MediaExtensions = new[] { ".mkv", ".avi", ".wmv", ".mp4", ".mpg", ".mpeg", ".xvid", ".flv", ".mov", ".rm", ".rmvb", ".divx", ".dvr-ms", ".ts", ".ogm", ".m4v", ".strm" };
|
private static readonly string[] MediaExtensions = new[] { ".mkv", ".avi", ".wmv", ".mp4", ".mpg", ".mpeg", ".xvid", ".flv", ".mov", ".rm", ".rmvb", ".divx", ".dvr-ms", ".ts", ".ogm", ".m4v", ".strm" };
|
||||||
|
@ -143,5 +144,10 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
Scan(series);
|
Scan(series);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Handle(EpisodeInfoAddedEvent message)
|
||||||
|
{
|
||||||
|
Scan(message.Series);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -206,7 +206,7 @@ namespace NzbDrone.Core.Tv
|
||||||
|
|
||||||
if (newList.Any())
|
if (newList.Any())
|
||||||
{
|
{
|
||||||
_messageAggregator.PublishEvent(new EpisodeInfoAddedEvent(newList));
|
_messageAggregator.PublishEvent(new EpisodeInfoAddedEvent(newList, series));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateList.Any())
|
if (updateList.Any())
|
||||||
|
|
|
@ -6,10 +6,12 @@ namespace NzbDrone.Core.Tv.Events
|
||||||
{
|
{
|
||||||
public class EpisodeInfoAddedEvent : IEvent
|
public class EpisodeInfoAddedEvent : IEvent
|
||||||
{
|
{
|
||||||
|
public Series Series { get; private set; }
|
||||||
public ReadOnlyCollection<Episode> Episodes { get; private set; }
|
public ReadOnlyCollection<Episode> Episodes { get; private set; }
|
||||||
|
|
||||||
public EpisodeInfoAddedEvent(IList<Episode> episodes)
|
public EpisodeInfoAddedEvent(IList<Episode> episodes, Series series)
|
||||||
{
|
{
|
||||||
|
Series = series;
|
||||||
Episodes = new ReadOnlyCollection<Episode>(episodes);
|
Episodes = new ReadOnlyCollection<Episode>(episodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,18 +101,20 @@ namespace NzbDrone.Core.Tv
|
||||||
{
|
{
|
||||||
Ensure.That(() => newSeries).IsNotNull();
|
Ensure.That(() => newSeries).IsNotNull();
|
||||||
|
|
||||||
if (String.IsNullOrWhiteSpace(newSeries.FolderName))
|
newSeries.FolderName = FileNameBuilder.CleanFilename(newSeries.Title);
|
||||||
{
|
newSeries.RootFolder = _rootFolderService.Get(newSeries.RootFolderId);
|
||||||
newSeries.FolderName = FileNameBuilder.CleanFilename(newSeries.Title);
|
|
||||||
_diskProvider.CreateFolder(Path.Combine(_rootFolderService.Get(newSeries.RootFolderId).Path, newSeries.FolderName));
|
_diskProvider.CreateFolder(newSeries.Path);
|
||||||
}
|
|
||||||
|
|
||||||
_logger.Info("Adding Series [{0}] Path: [{1}]", newSeries.Title, newSeries.Path);
|
_logger.Info("Adding Series [{0}] Path: [{1}]", newSeries.Title, newSeries.Path);
|
||||||
|
|
||||||
newSeries.Monitored = true;
|
newSeries.Monitored = true;
|
||||||
newSeries.CleanTitle = Parser.Parser.NormalizeTitle(newSeries.Title);
|
newSeries.CleanTitle = Parser.Parser.NormalizeTitle(newSeries.Title);
|
||||||
|
|
||||||
if (newSeries.QualityProfileId == 0)
|
if (newSeries.QualityProfileId == 0)
|
||||||
|
{
|
||||||
newSeries.QualityProfileId = _configService.DefaultQualityProfile;
|
newSeries.QualityProfileId = _configService.DefaultQualityProfile;
|
||||||
|
}
|
||||||
|
|
||||||
newSeries.SeasonFolder = _configService.UseSeasonFolder;
|
newSeries.SeasonFolder = _configService.UseSeasonFolder;
|
||||||
newSeries.BacklogSetting = BacklogSettingType.Inherit;
|
newSeries.BacklogSetting = BacklogSettingType.Inherit;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
define(['app', 'Series/SeriesModel'], function () {
|
define(['app', 'Series/SeriesModel'], function () {
|
||||||
|
|
||||||
NzbDrone.Series.Delete.DeleteSeriesView = Backbone.Marionette.ItemView.extend({
|
NzbDrone.Series.Delete.DeleteSeriesView = Backbone.Marionette.ItemView.extend({
|
||||||
template : 'Series/Delete/DeleteSeriesTemplate',
|
template: 'Series/Delete/DeleteSeriesTemplate',
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
'click .x-confirm-delete': 'removeSeries'
|
'click .x-confirm-delete': 'removeSeries'
|
||||||
|
@ -18,6 +18,7 @@ define(['app', 'Series/SeriesModel'], function () {
|
||||||
|
|
||||||
this.model.destroy({
|
this.model.destroy({
|
||||||
data : { 'deleteFiles': deleteFiles },
|
data : { 'deleteFiles': deleteFiles },
|
||||||
|
wait : true,
|
||||||
success: function (model) {
|
success: function (model) {
|
||||||
model.collection.remove(model);
|
model.collection.remove(model);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
define(['app', 'Series/SeriesModel'], function () {
|
define(['app', 'Series/SeriesModel'], function () {
|
||||||
NzbDrone.Series.SeriesCollection = Backbone.PageableCollection.extend({
|
NzbDrone.Series.SeriesCollection = Backbone.Collection.extend({
|
||||||
url : NzbDrone.Constants.ApiRoot + '/series',
|
url : NzbDrone.Constants.ApiRoot + '/series',
|
||||||
model: NzbDrone.Series.SeriesModel,
|
model: NzbDrone.Series.SeriesModel,
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue