Browse Source

missing metadata fixes (#373)

pull/374/head
Jason Dove 5 years ago committed by GitHub
parent
commit
c3e0aaf0b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      CHANGELOG.md
  2. 2
      ErsatzTV.Core/Domain/MediaItem/Episode.cs
  3. 34
      ErsatzTV.Core/Metadata/FallbackMetadataProvider.cs
  4. 2
      ErsatzTV.Infrastructure/Data/Repositories/TelevisionRepository.cs

3
CHANGELOG.md

@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file. @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]
### Fixed
- Fix scanning and indexing local movies and episodes with no metadata
- Fix displaying seasons for shows with no year (in metadata or in folder name)
## [0.0.58-alpha] - 2021-09-15
### Added

2
ErsatzTV.Core/Domain/MediaItem/Episode.cs

@ -3,7 +3,7 @@ using System.Diagnostics; @@ -3,7 +3,7 @@ using System.Diagnostics;
namespace ErsatzTV.Core.Domain
{
[DebuggerDisplay("{EpisodeMetadata[0].Title}")]
[DebuggerDisplay("{EpisodeMetadata[0].Title ?? \"[unknown episode]\"}")]
public class Episode : MediaItem
{
public int SeasonId { get; set; }

34
ErsatzTV.Core/Metadata/FallbackMetadataProvider.cs

@ -15,7 +15,14 @@ namespace ErsatzTV.Core.Metadata @@ -15,7 +15,14 @@ namespace ErsatzTV.Core.Metadata
{
string fileName = Path.GetFileName(showFolder);
var metadata = new ShowMetadata
{ MetadataKind = MetadataKind.Fallback, Title = fileName ?? showFolder };
{
MetadataKind = MetadataKind.Fallback,
Title = fileName ?? showFolder,
Genres = new List<Genre>(),
Tags = new List<Tag>(),
Studios = new List<Studio>(),
Actors = new List<Actor>()
};
return GetTelevisionShowMetadata(fileName, metadata);
}
@ -33,7 +40,7 @@ namespace ErsatzTV.Core.Metadata @@ -33,7 +40,7 @@ namespace ErsatzTV.Core.Metadata
var baseMetadata = new EpisodeMetadata
{
MetadataKind = MetadataKind.Fallback,
Title = fileName ?? path,
Title = Path.GetFileNameWithoutExtension(path) ?? path,
DateAdded = DateTime.UtcNow,
EpisodeNumber = 0,
Actors = new List<Actor>(),
@ -54,7 +61,17 @@ namespace ErsatzTV.Core.Metadata @@ -54,7 +61,17 @@ namespace ErsatzTV.Core.Metadata
{
string path = movie.MediaVersions.Head().MediaFiles.Head().Path;
string fileName = Path.GetFileName(path);
var metadata = new MovieMetadata { MetadataKind = MetadataKind.Fallback, Title = fileName ?? path };
var metadata = new MovieMetadata
{
MetadataKind = MetadataKind.Fallback,
Title = Path.GetFileNameWithoutExtension(path) ?? path,
Genres = new List<Genre>(),
Tags = new List<Tag>(),
Studios = new List<Studio>(),
Actors = new List<Actor>(),
Directors = new List<Director>(),
Writers = new List<Writer>()
};
return fileName != null ? GetMovieMetadata(fileName, metadata) : metadata;
}
@ -128,6 +145,7 @@ namespace ErsatzTV.Core.Metadata @@ -128,6 +145,7 @@ namespace ErsatzTV.Core.Metadata
EpisodeNumber = episodeNumber,
DateAdded = baseMetadata.DateAdded,
DateUpdated = baseMetadata.DateAdded,
Title = baseMetadata.Title,
Actors = new List<Actor>(),
Artwork = new List<Artwork>(),
Directors = new List<Director>(),
@ -164,12 +182,6 @@ namespace ErsatzTV.Core.Metadata @@ -164,12 +182,6 @@ namespace ErsatzTV.Core.Metadata
metadata.Title = match.Groups[1].Value.Trim();
metadata.Year = int.Parse(match.Groups[2].Value);
metadata.ReleaseDate = new DateTime(int.Parse(match.Groups[2].Value), 1, 1);
metadata.Genres = new List<Genre>();
metadata.Tags = new List<Tag>();
metadata.Studios = new List<Studio>();
metadata.Actors = new List<Actor>();
metadata.Directors = new List<Director>();
metadata.Writers = new List<Writer>();
metadata.DateUpdated = DateTime.UtcNow;
}
}
@ -214,10 +226,6 @@ namespace ErsatzTV.Core.Metadata @@ -214,10 +226,6 @@ namespace ErsatzTV.Core.Metadata
metadata.Title = match.Groups[1].Value;
metadata.Year = int.Parse(match.Groups[2].Value);
metadata.ReleaseDate = new DateTime(int.Parse(match.Groups[2].Value), 1, 1);
metadata.Genres = new List<Genre>();
metadata.Tags = new List<Tag>();
metadata.Studios = new List<Studio>();
metadata.Actors = new List<Actor>();
metadata.DateUpdated = DateTime.UtcNow;
}
}

2
ErsatzTV.Infrastructure/Data/Repositories/TelevisionRepository.cs

@ -144,7 +144,7 @@ namespace ErsatzTV.Infrastructure.Data.Repositories @@ -144,7 +144,7 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
@"SELECT m1.ShowId
FROM ShowMetadata m1
LEFT OUTER JOIN ShowMetadata m2 ON m2.ShowId = @ShowId
WHERE m1.Title = m2.Title AND m1.Year = m2.Year",
WHERE m1.Title = m2.Title AND m1.Year is m2.Year",
new { ShowId = televisionShowId })
.Map(results => results.ToList());

Loading…
Cancel
Save