1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00

Metadata bug fixes

Fixed: Don't link XBMC episode images to Roksbox
Fixed: Don't scan for metadata until files are imported
This commit is contained in:
Mark McDowall 2014-05-01 19:19:42 -07:00
parent 1f40bef249
commit 9355c9d9f1
5 changed files with 37 additions and 16 deletions

View File

@ -0,0 +1,14 @@
using NzbDrone.Core.Datastore.Migration.Framework;
using FluentMigrator;
namespace NzbDrone.Core.Datastore.Migration
{
[Migration(49)]
public class add_hash_to_metadata_files : NzbDroneMigrationBase
{
protected override void MainDbUpgrade()
{
Alter.Table("MetadataFiles").AddColumn("Hash").AsString().Nullable();
}
}
}

View File

@ -96,7 +96,7 @@ public override MetadataFile FindMetadataFile(Series series, string path)
};
//Series and season images are both named folder.jpg, only season ones sit in season folders
if (String.Compare(filename, parentdir.Name, true) == 0)
if (String.Compare(filename, parentdir.Name, StringComparison.InvariantCultureIgnoreCase) == 0)
{
var seasonMatch = SeasonImagesRegex.Match(parentdir.Name);
if (seasonMatch.Success)
@ -128,16 +128,22 @@ public override MetadataFile FindMetadataFile(Series series, string path)
if (parseResult != null &&
!parseResult.FullSeason)
{
switch (Path.GetExtension(filename).ToLowerInvariant())
var extension = Path.GetExtension(filename).ToLowerInvariant();
if (extension == ".xml")
{
case ".xml":
metadata.Type = MetadataType.EpisodeMetadata;
return metadata;
case ".jpg":
metadata.Type = MetadataType.EpisodeImage;
return metadata;
}
if (extension == ".jpg")
{
if (!Path.GetFileNameWithoutExtension(filename).EndsWith("-thumb"))
{
metadata.Type = MetadataType.EpisodeImage;
return metadata;
}
}
}
return null;

View File

@ -147,7 +147,7 @@ private MetadataFile ProcessSeriesMetadata(IMetadata consumer, Series series, Li
new MetadataFile
{
SeriesId = series.Id,
Consumer = GetType().Name,
Consumer = consumer.GetType().Name,
Type = MetadataType.SeriesMetadata,
};
@ -196,7 +196,7 @@ private MetadataFile ProcessEpisodeMetadata(IMetadata consumer, Series series, E
{
SeriesId = series.Id,
EpisodeFileId = episodeFile.Id,
Consumer = GetType().Name,
Consumer = consumer.GetType().Name,
Type = MetadataType.EpisodeMetadata,
RelativePath = relativePath
};
@ -233,7 +233,7 @@ private List<MetadataFile> ProcessSeriesImages(IMetadata consumer, Series series
new MetadataFile
{
SeriesId = series.Id,
Consumer = GetType().Name,
Consumer = consumer.GetType().Name,
Type = MetadataType.SeriesImage,
RelativePath = relativePath
};
@ -269,7 +269,7 @@ private List<MetadataFile> ProcessSeasonImages(IMetadata consumer, Series series
{
SeriesId = series.Id,
SeasonNumber = season.SeasonNumber,
Consumer = GetType().Name,
Consumer = consumer.GetType().Name,
Type = MetadataType.SeasonImage,
RelativePath = relativePath
};
@ -317,7 +317,7 @@ private List<MetadataFile> ProcessEpisodeImages(IMetadata consumer, Series serie
{
SeriesId = series.Id,
EpisodeFileId = episodeFile.Id,
Consumer = GetType().Name,
Consumer = consumer.GetType().Name,
Type = MetadataType.EpisodeImage,
RelativePath = DiskProviderBase.GetRelativePath(series.Path, image.Path)
};

View File

@ -5,14 +5,14 @@
using NzbDrone.Common;
using NzbDrone.Common.Disk;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Metadata.Files;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Tv.Events;
namespace NzbDrone.Core.Metadata
{
public class ExistingMetadataService : IHandle<SeriesUpdatedEvent>
public class ExistingMetadataService : IHandle<SeriesScannedEvent>
{
private readonly IDiskProvider _diskProvider;
private readonly IMetadataFileService _metadataFileService;
@ -33,7 +33,7 @@ public ExistingMetadataService(IDiskProvider diskProvider,
_consumers = consumers.ToList();
}
public void Handle(SeriesUpdatedEvent message)
public void Handle(SeriesScannedEvent message)
{
if (!_diskProvider.FolderExists(message.Series.Path)) return;

View File

@ -194,6 +194,7 @@
<Compile Include="Datastore\Migration\046_fix_nzb_su_url.cs" />
<Compile Include="Datastore\Migration\047_add_published_date_blacklist_column.cs" />
<Compile Include="Datastore\Migration\048_add_title_to_scenemappings.cs" />
<Compile Include="Datastore\Migration\049_add_hash_to_metadata_files.cs" />
<Compile Include="Datastore\Migration\Framework\MigrationContext.cs" />
<Compile Include="Datastore\Migration\Framework\MigrationController.cs" />
<Compile Include="Datastore\Migration\Framework\MigrationExtension.cs" />