Browse Source

fix emby tag sync for movies and shows (#975)

pull/976/head
Jason Dove 4 years ago committed by GitHub
parent
commit
d21c985a77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 4
      ErsatzTV.Infrastructure/Emby/EmbyApiClient.cs
  3. 2
      ErsatzTV.Infrastructure/Emby/Models/EmbyLibraryItemResponse.cs
  4. 7
      ErsatzTV.Infrastructure/Emby/Models/EmbyTagItemResponse.cs
  5. 4306
      ErsatzTV.Infrastructure/Migrations/20221001005007_Reset_EmbyMovieShowEtagForTagItems.Designer.cs
  6. 40
      ErsatzTV.Infrastructure/Migrations/20221001005007_Reset_EmbyMovieShowEtagForTagItems.cs
  7. 2
      ErsatzTV.Infrastructure/Migrations/TvContextModelSnapshot.cs

1
CHANGELOG.md

@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix scaling logic for `Nvidia` acceleration and software mode
- Attempt to position watermarks within content (not over added black padding)
- Fix search results for `Other Videos` when NFO metadata is used
- Properly synchronize tags from Emby movies and shows
### Added
- Add `QSV Device` option to ffmpeg profile on linux

4
ErsatzTV.Infrastructure/Emby/EmbyApiClient.cs

@ -382,7 +382,7 @@ public class EmbyApiClient : IEmbyApiClient @@ -382,7 +382,7 @@ public class EmbyApiClient : IEmbyApiClient
DateAdded = dateAdded,
ContentRating = item.OfficialRating,
Genres = Optional(item.Genres).Flatten().Map(g => new Genre { Name = g }).ToList(),
Tags = Optional(item.Tags).Flatten().Map(t => new Tag { Name = t }).ToList(),
Tags = Optional(item.TagItems).Flatten().Map(t => new Tag { Name = t.Name }).ToList(),
Studios = Optional(item.Studios).Flatten().Map(s => new Studio { Name = s.Name }).ToList(),
Actors = Optional(item.People).Flatten().Collect(r => ProjectToActor(r, dateAdded)).ToList(),
Directors = Optional(item.People).Flatten().Collect(r => ProjectToDirector(r)).ToList(),
@ -507,7 +507,7 @@ public class EmbyApiClient : IEmbyApiClient @@ -507,7 +507,7 @@ public class EmbyApiClient : IEmbyApiClient
DateAdded = dateAdded,
ContentRating = item.OfficialRating,
Genres = Optional(item.Genres).Flatten().Map(g => new Genre { Name = g }).ToList(),
Tags = Optional(item.Tags).Flatten().Map(t => new Tag { Name = t }).ToList(),
Tags = Optional(item.TagItems).Flatten().Map(t => new Tag { Name = t.Name }).ToList(),
Studios = Optional(item.Studios).Flatten().Map(s => new Studio { Name = s.Name }).ToList(),
Actors = Optional(item.People).Flatten().Collect(r => ProjectToActor(r, dateAdded)).ToList(),
Artwork = new List<Artwork>(),

2
ErsatzTV.Infrastructure/Emby/Models/EmbyLibraryItemResponse.cs

@ -10,7 +10,7 @@ public class EmbyLibraryItemResponse @@ -10,7 +10,7 @@ public class EmbyLibraryItemResponse
public DateTimeOffset DateCreated { get; set; }
public long RunTimeTicks { get; set; }
public List<string> Genres { get; set; }
public List<string> Tags { get; set; }
public List<EmbyTagItemResponse> TagItems { get; set; }
public int ProductionYear { get; set; }
public EmbyProviderIdsResponse ProviderIds { get; set; }
public string PremiereDate { get; set; }

7
ErsatzTV.Infrastructure/Emby/Models/EmbyTagItemResponse.cs

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
namespace ErsatzTV.Infrastructure.Emby.Models;
public class EmbyTagItemResponse
{
public string Name { get; set; }
public int Id { get; set; }
}

4306
ErsatzTV.Infrastructure/Migrations/20221001005007_Reset_EmbyMovieShowEtagForTagItems.Designer.cs generated

File diff suppressed because it is too large Load Diff

40
ErsatzTV.Infrastructure/Migrations/20221001005007_Reset_EmbyMovieShowEtagForTagItems.cs

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ErsatzTV.Infrastructure.Migrations
{
public partial class Reset_EmbyMovieShowEtagForTagItems : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
// clear etag on all emby movies
migrationBuilder.Sql(@"UPDATE EmbyMovie SET Etag = NULL");
// clear etag on all emby shows
migrationBuilder.Sql(@"UPDATE EmbyShow SET Etag = NULL");
// force scanning libraries with NULL etag movies
migrationBuilder.Sql(
@"UPDATE Library SET LastScan = '0001-01-01 00:00:00' WHERE Library.Id IN
(SELECT DISTINCT Library.Id FROM Library
INNER JOIN LibraryPath LP on Library.Id = LP.LibraryId
INNER JOIN MediaItem MI on LP.Id = MI.LibraryPathId
INNER JOIN EmbyMovie EM ON MI.Id = EM.Id
WHERE EM.Etag IS NULL)");
// force scanning libraries with NULL etag shows
migrationBuilder.Sql(
@"UPDATE Library SET LastScan = '0001-01-01 00:00:00' WHERE Library.Id IN
(SELECT DISTINCT Library.Id FROM Library
INNER JOIN LibraryPath LP on Library.Id = LP.LibraryId
INNER JOIN MediaItem MI on LP.Id = MI.LibraryPathId
INNER JOIN EmbyShow ES ON MI.Id = ES.Id
WHERE ES.Etag IS NULL)");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

2
ErsatzTV.Infrastructure/Migrations/TvContextModelSnapshot.cs

@ -15,7 +15,7 @@ namespace ErsatzTV.Infrastructure.Migrations @@ -15,7 +15,7 @@ namespace ErsatzTV.Infrastructure.Migrations
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "6.0.8");
modelBuilder.HasAnnotation("ProductVersion", "6.0.9");
modelBuilder.Entity("ErsatzTV.Core.Domain.Actor", b =>
{

Loading…
Cancel
Save