mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 03:52:33 +02:00
store scene name in history
This commit is contained in:
parent
b8bd2bffbf
commit
e256271c5c
@ -0,0 +1,14 @@
|
||||
using FluentMigrator;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migration
|
||||
{
|
||||
[Migration(16)]
|
||||
public class updated_imported_history_item : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Execute.Sql(@"UPDATE HISTORY SET Data = replace( Data, '""Path""', '""ImportedPath""' ) WHERE EventType=3");
|
||||
}
|
||||
}
|
||||
}
|
@ -62,7 +62,7 @@ public void Handle(EpisodeGrabbedEvent message)
|
||||
{
|
||||
var history = new History
|
||||
{
|
||||
EventType = HistoryEventType.Grabbed,
|
||||
EventType = HistoryEventType.Grabbed,
|
||||
Date = DateTime.UtcNow,
|
||||
Quality = message.Episode.ParsedEpisodeInfo.Quality,
|
||||
SourceTitle = message.Episode.Report.Title,
|
||||
@ -81,20 +81,21 @@ public void Handle(EpisodeGrabbedEvent message)
|
||||
|
||||
public void Handle(EpisodeImportedEvent message)
|
||||
{
|
||||
foreach (var episode in message.EpisodeFile.Episodes.Value)
|
||||
foreach (var episode in message.DroppedEpisode.Episodes)
|
||||
{
|
||||
var history = new History
|
||||
{
|
||||
EventType = HistoryEventType.DownloadFolderImported,
|
||||
Date = DateTime.UtcNow,
|
||||
Quality = message.EpisodeFile.Quality,
|
||||
SourceTitle = message.EpisodeFile.Path,
|
||||
SeriesId = message.EpisodeFile.SeriesId,
|
||||
Quality = message.DroppedEpisode.Quality,
|
||||
SourceTitle = message.ImportedEpisode.SceneName,
|
||||
SeriesId = message.ImportedEpisode.SeriesId,
|
||||
EpisodeId = episode.Id
|
||||
};
|
||||
|
||||
history.Data.Add("Path", message.EpisodeFile.Path);
|
||||
history.Data.Add("Filename", Path.GetFileNameWithoutExtension(message.EpisodeFile.Path));
|
||||
history.Data.Add("FileId", message.ImportedEpisode.Id.ToString());
|
||||
history.Data.Add("DroppedPath", message.DroppedEpisode.Path);
|
||||
history.Data.Add("ImportedPath", message.ImportedEpisode.Path);
|
||||
|
||||
_historyRepository.Insert(history);
|
||||
}
|
||||
|
@ -65,12 +65,14 @@ public List<ImportDecision> Import(List<ImportDecision> decisions, bool newDownl
|
||||
episodeFile.SceneName = Path.GetFileNameWithoutExtension(localEpisode.Path.CleanFilePath());
|
||||
episodeFile.Episodes = localEpisode.Episodes;
|
||||
|
||||
|
||||
if (newDownload)
|
||||
{
|
||||
episodeFile = _episodeFileUpgrader.UpgradeEpisodeFile(episodeFile, localEpisode);
|
||||
_messageAggregator.PublishEvent(new EpisodeImportedEvent(episodeFile));
|
||||
_messageAggregator.PublishEvent(new EpisodeImportedEvent(localEpisode, episodeFile));
|
||||
}
|
||||
|
||||
|
||||
|
||||
_mediaFileService.Add(episodeFile);
|
||||
imported.Add(importDecision);
|
||||
}
|
||||
|
@ -1,14 +1,17 @@
|
||||
using NzbDrone.Common.Messaging;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
|
||||
namespace NzbDrone.Core.MediaFiles.Events
|
||||
{
|
||||
public class EpisodeImportedEvent : IEvent
|
||||
{
|
||||
public EpisodeFile EpisodeFile { get; private set; }
|
||||
public LocalEpisode DroppedEpisode { get; private set; }
|
||||
public EpisodeFile ImportedEpisode { get; private set; }
|
||||
|
||||
public EpisodeImportedEvent(EpisodeFile episodeFile)
|
||||
public EpisodeImportedEvent(LocalEpisode droppedEpisode, EpisodeFile importedEpisode)
|
||||
{
|
||||
EpisodeFile = episodeFile;
|
||||
DroppedEpisode = droppedEpisode;
|
||||
ImportedEpisode = importedEpisode;
|
||||
}
|
||||
}
|
||||
}
|
@ -158,6 +158,7 @@
|
||||
<Compile Include="Datastore\Migration\013_add_air_date_utc.cs" />
|
||||
<Compile Include="Datastore\Migration\014_drop_air_date.cs" />
|
||||
<Compile Include="Datastore\Migration\015_add_air_date_as_string.cs" />
|
||||
<Compile Include="Datastore\Migration\016_updated_imported_history_item.cs" />
|
||||
<Compile Include="Datastore\Migration\Framework\MigrationContext.cs" />
|
||||
<Compile Include="Datastore\Migration\Framework\MigrationController.cs" />
|
||||
<Compile Include="Datastore\Migration\Framework\MigrationExtension.cs" />
|
||||
|
@ -35,14 +35,14 @@
|
||||
{{#if data}}
|
||||
{{#with data}}
|
||||
<dl class="dl-horizontal">
|
||||
{{#if filename}}
|
||||
<dt>Filename</dt>
|
||||
<dd>{{filename}}</dd>
|
||||
{{#if droppedPath}}
|
||||
<dt>Source:</dt>
|
||||
<dd>{{droppedPath}}</dd>
|
||||
{{/if}}
|
||||
|
||||
{{#if path}}
|
||||
<dt>Path</dt>
|
||||
<dd>{{path}}</dd>
|
||||
{{#if importedPath}}
|
||||
<dt>Imported To:</dt>
|
||||
<dd>{{importedPath}}</dd>
|
||||
{{/if}}
|
||||
</dl>
|
||||
{{/with}}
|
||||
|
Loading…
Reference in New Issue
Block a user