fix adding single items to playlists (#2382)
This commit is contained in:
@@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
### Fixed
|
||||
- Fix transcoding content with bt709/pc color metadata
|
||||
- Fix scripted schedule validation (file exists) when creating or editing playout
|
||||
- Fix adding single episode, movie, season, show to empty playlists
|
||||
|
||||
### Changed
|
||||
- **BREAKING CHANGE**: change how `Scripted Schedule` system works
|
||||
|
||||
@@ -20,9 +20,11 @@ public class AddEpisodeToPlaylistHandler(IDbContextFactory<TvContext> dbContextF
|
||||
|
||||
private static async Task<Unit> ApplyAddEpisodeRequest(TvContext dbContext, Parameters parameters)
|
||||
{
|
||||
int index = parameters.Playlist.Items.Count > 0 ? parameters.Playlist.Items.Max(i => i.Index) + 1 : 0;
|
||||
|
||||
var playlistItem = new PlaylistItem
|
||||
{
|
||||
Index = parameters.Playlist.Items.Max(i => i.Index) + 1,
|
||||
Index = index,
|
||||
CollectionType = ProgramScheduleItemCollectionType.Episode,
|
||||
MediaItemId = parameters.Episode.Id,
|
||||
PlaybackOrder = PlaybackOrder.Shuffle,
|
||||
|
||||
@@ -20,9 +20,11 @@ public class AddMovieToPlaylistHandler(IDbContextFactory<TvContext> dbContextFac
|
||||
|
||||
private static async Task<Unit> ApplyAddMovieRequest(TvContext dbContext, Parameters parameters)
|
||||
{
|
||||
int index = parameters.Playlist.Items.Count > 0 ? parameters.Playlist.Items.Max(i => i.Index) + 1 : 0;
|
||||
|
||||
var playlistItem = new PlaylistItem
|
||||
{
|
||||
Index = parameters.Playlist.Items.Max(i => i.Index) + 1,
|
||||
Index = index,
|
||||
CollectionType = ProgramScheduleItemCollectionType.Movie,
|
||||
MediaItemId = parameters.Movie.Id,
|
||||
PlaybackOrder = PlaybackOrder.Shuffle,
|
||||
|
||||
@@ -20,9 +20,11 @@ public class AddSeasonToPlaylistHandler(IDbContextFactory<TvContext> dbContextFa
|
||||
|
||||
private static async Task<Unit> ApplyAddSeasonRequest(TvContext dbContext, Parameters parameters)
|
||||
{
|
||||
int index = parameters.Playlist.Items.Count > 0 ? parameters.Playlist.Items.Max(i => i.Index) + 1 : 0;
|
||||
|
||||
var playlistItem = new PlaylistItem
|
||||
{
|
||||
Index = parameters.Playlist.Items.Max(i => i.Index) + 1,
|
||||
Index = index,
|
||||
CollectionType = ProgramScheduleItemCollectionType.TelevisionSeason,
|
||||
MediaItemId = parameters.Season.Id,
|
||||
PlaybackOrder = PlaybackOrder.Shuffle,
|
||||
|
||||
@@ -20,9 +20,11 @@ public class AddShowToPlaylistHandler(IDbContextFactory<TvContext> dbContextFact
|
||||
|
||||
private static async Task<Unit> ApplyAddShowRequest(TvContext dbContext, Parameters parameters)
|
||||
{
|
||||
int index = parameters.Playlist.Items.Count > 0 ? parameters.Playlist.Items.Max(i => i.Index) + 1 : 0;
|
||||
|
||||
var playlistItem = new PlaylistItem
|
||||
{
|
||||
Index = parameters.Playlist.Items.Max(i => i.Index) + 1,
|
||||
Index = index,
|
||||
CollectionType = ProgramScheduleItemCollectionType.TelevisionShow,
|
||||
MediaItemId = parameters.Show.Id,
|
||||
PlaybackOrder = PlaybackOrder.Shuffle,
|
||||
|
||||
Reference in New Issue
Block a user