Browse Source

maintain collection progress across alternate schedules (#1211)

pull/1212/head
Jason Dove 2 years ago committed by GitHub
parent
commit
7e0801119e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 5
      ErsatzTV.Core.Tests/Scheduling/PlayoutBuilderTests.cs
  3. 5
      ErsatzTV.Core/Domain/PlayoutProgramScheduleAnchor.cs
  4. 5
      ErsatzTV.Core/Scheduling/PlayoutBuilder.cs
  5. 4416
      ErsatzTV.Infrastructure/Migrations/20230316013110_Remove_PlayoutProgramScheduleAnchor_ProgramScheduleId.Designer.cs
  6. 50
      ErsatzTV.Infrastructure/Migrations/20230316013110_Remove_PlayoutProgramScheduleAnchor_ProgramScheduleId.cs
  7. 13
      ErsatzTV.Infrastructure/Migrations/TvContextModelSnapshot.cs

1
CHANGELOG.md

@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix playout mode duration bugs in XMLTV
- Tail mode filler will properly include filler duration in XMLTV
- Duration that wraps across midnight will no longer have overlapping items in XMLTV
- Maintain collection progress across all alternate schedules on a playout
### Changed
- Ignore case of video and audio file extensions in local folder scanner

5
ErsatzTV.Core.Tests/Scheduling/PlayoutBuilderTests.cs

@ -2078,8 +2078,7 @@ public class PlayoutBuilderTests @@ -2078,8 +2078,7 @@ public class PlayoutBuilderTests
Index = 1,
Seed = 12345
},
Playout = playout,
ProgramSchedule = playout.ProgramSchedule
Playout = playout
});
var configRepo = new Mock<IConfigElementRepository>();
@ -2242,8 +2241,6 @@ public class PlayoutBuilderTests @@ -2242,8 +2241,6 @@ public class PlayoutBuilderTests
MediaItemId = headAnchor.MediaItemId,
MultiCollection = headAnchor.MultiCollection,
MultiCollectionId = headAnchor.MultiCollectionId,
ProgramSchedule = headAnchor.ProgramSchedule,
ProgramScheduleId = headAnchor.ProgramScheduleId,
SmartCollection = headAnchor.SmartCollection,
SmartCollectionId = headAnchor.SmartCollectionId
});

5
ErsatzTV.Core/Domain/PlayoutProgramScheduleAnchor.cs

@ -10,11 +10,6 @@ public class PlayoutProgramScheduleAnchor @@ -10,11 +10,6 @@ public class PlayoutProgramScheduleAnchor
[NotLogged]
public Playout Playout { get; set; }
public int ProgramScheduleId { get; set; }
[NotLogged]
public ProgramSchedule ProgramSchedule { get; set; }
public DateTime? AnchorDate { get; set; }
public DateTimeOffset? AnchorDateOffset => AnchorDate.HasValue

5
ErsatzTV.Core/Scheduling/PlayoutBuilder.cs

@ -684,8 +684,6 @@ public class PlayoutBuilder : IPlayoutBuilder @@ -684,8 +684,6 @@ public class PlayoutBuilder : IPlayoutBuilder
{
Playout = playout,
PlayoutId = playout.Id,
ProgramSchedule = activeSchedule,
ProgramScheduleId = activeSchedule.Id,
CollectionType = collectionKey.CollectionType,
CollectionId = collectionKey.CollectionId,
MultiCollectionId = collectionKey.MultiCollectionId,
@ -722,8 +720,7 @@ public class PlayoutBuilder : IPlayoutBuilder @@ -722,8 +720,7 @@ public class PlayoutBuilder : IPlayoutBuilder
Option<PlayoutProgramScheduleAnchor> maybeAnchor = playout.ProgramScheduleAnchors
.OrderByDescending(a => a.AnchorDate ?? DateTime.MaxValue)
.FirstOrDefault(
a => a.ProgramScheduleId == activeSchedule.Id
&& a.CollectionType == collectionKey.CollectionType
a => a.CollectionType == collectionKey.CollectionType
&& a.CollectionId == collectionKey.CollectionId
&& a.MultiCollectionId == collectionKey.MultiCollectionId
&& a.SmartCollectionId == collectionKey.SmartCollectionId

4416
ErsatzTV.Infrastructure/Migrations/20230316013110_Remove_PlayoutProgramScheduleAnchor_ProgramScheduleId.Designer.cs generated

File diff suppressed because it is too large Load Diff

50
ErsatzTV.Infrastructure/Migrations/20230316013110_Remove_PlayoutProgramScheduleAnchor_ProgramScheduleId.cs

@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ErsatzTV.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class Remove_PlayoutProgramScheduleAnchor_ProgramScheduleId : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_PlayoutProgramScheduleAnchor_ProgramSchedule_ProgramScheduleId",
table: "PlayoutProgramScheduleAnchor");
migrationBuilder.DropIndex(
name: "IX_PlayoutProgramScheduleAnchor_ProgramScheduleId",
table: "PlayoutProgramScheduleAnchor");
migrationBuilder.DropColumn(
name: "ProgramScheduleId",
table: "PlayoutProgramScheduleAnchor");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "ProgramScheduleId",
table: "PlayoutProgramScheduleAnchor",
type: "INTEGER",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateIndex(
name: "IX_PlayoutProgramScheduleAnchor_ProgramScheduleId",
table: "PlayoutProgramScheduleAnchor",
column: "ProgramScheduleId");
migrationBuilder.AddForeignKey(
name: "FK_PlayoutProgramScheduleAnchor_ProgramSchedule_ProgramScheduleId",
table: "PlayoutProgramScheduleAnchor",
column: "ProgramScheduleId",
principalTable: "ProgramSchedule",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

13
ErsatzTV.Infrastructure/Migrations/TvContextModelSnapshot.cs

@ -1515,9 +1515,6 @@ namespace ErsatzTV.Infrastructure.Migrations @@ -1515,9 +1515,6 @@ namespace ErsatzTV.Infrastructure.Migrations
b.Property<int>("PlayoutId")
.HasColumnType("INTEGER");
b.Property<int>("ProgramScheduleId")
.HasColumnType("INTEGER");
b.Property<int?>("SmartCollectionId")
.HasColumnType("INTEGER");
@ -1531,8 +1528,6 @@ namespace ErsatzTV.Infrastructure.Migrations @@ -1531,8 +1528,6 @@ namespace ErsatzTV.Infrastructure.Migrations
b.HasIndex("PlayoutId");
b.HasIndex("ProgramScheduleId");
b.HasIndex("SmartCollectionId");
b.ToTable("PlayoutProgramScheduleAnchor", (string)null);
@ -3370,12 +3365,6 @@ namespace ErsatzTV.Infrastructure.Migrations @@ -3370,12 +3365,6 @@ namespace ErsatzTV.Infrastructure.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ErsatzTV.Core.Domain.ProgramSchedule", "ProgramSchedule")
.WithMany()
.HasForeignKey("ProgramScheduleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ErsatzTV.Core.Domain.SmartCollection", "SmartCollection")
.WithMany()
.HasForeignKey("SmartCollectionId")
@ -3410,8 +3399,6 @@ namespace ErsatzTV.Infrastructure.Migrations @@ -3410,8 +3399,6 @@ namespace ErsatzTV.Infrastructure.Migrations
b.Navigation("Playout");
b.Navigation("ProgramSchedule");
b.Navigation("SmartCollection");
});

Loading…
Cancel
Save