* rework television media * refactor poster saving * television and movie views are working again * remove dead code * use paper styling for all cards * add show poster, plot to seasons page * remove missing shows; cleanup interfaces * fix split show display (same show in different folders/sources) * add placeholder "add to schedule" button * no more duplicate television shows, even with the same show split across sources * stop releasing CLI for now * use season number as season placeholder * add television shows to collections * add television seasons to collections * add television episodes to collections * add movies to collections * remove movies, shows, seasons, episodes from collections * fix page width and menus * fix buffer size defaults * fix chronological episode ordering * allow deleting media collections * don't get stuck building a playout with an empty collection * schedule editing and playouts work again * minor cleanup * remove dead code * fix bugs with viewing movies as they are loading * add scanner tests; support nested movie folders * update collections docs * rearrange order of schedule items * add show and season to schedule * delete schedules that use legacy collections, reset all posters * move cleanup to new migration * load fallback metadata when nfo fails; don't require metadata in ui * update readme and screenshots
63 lines
2.1 KiB
C#
63 lines
2.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using ErsatzTV.Core.Domain;
|
|
using LanguageExt;
|
|
|
|
namespace ErsatzTV.Infrastructure.Data
|
|
{
|
|
public static class DbInitializer
|
|
{
|
|
public static Unit Initialize(TvContext context)
|
|
{
|
|
if (context.Resolutions.Any())
|
|
{
|
|
return Unit.Default;
|
|
}
|
|
|
|
var resolutions = new List<Resolution>
|
|
{
|
|
new() { Id = 1, Name = "720x480", Width = 720, Height = 480 },
|
|
new() { Id = 2, Name = "1280x720", Width = 1280, Height = 720 },
|
|
new() { Id = 3, Name = "1920x1080", Width = 1920, Height = 1080 },
|
|
new() { Id = 4, Name = "3840x2160", Width = 3840, Height = 2160 }
|
|
};
|
|
context.Resolutions.AddRange(resolutions);
|
|
context.SaveChanges();
|
|
|
|
var resolutionConfig = new ConfigElement
|
|
{
|
|
Key = ConfigElementKey.FFmpegDefaultResolutionId.Key,
|
|
Value = "3" // 1920x1080
|
|
};
|
|
context.ConfigElements.Add(resolutionConfig);
|
|
context.SaveChanges();
|
|
|
|
var defaultProfile = FFmpegProfile.New("1920x1080 x264 ac3", resolutions[2]);
|
|
context.FFmpegProfiles.Add(defaultProfile);
|
|
context.SaveChanges();
|
|
|
|
var profileConfig = new ConfigElement
|
|
{
|
|
Key = ConfigElementKey.FFmpegDefaultProfileId.Key,
|
|
Value = defaultProfile.Id.ToString()
|
|
};
|
|
context.ConfigElements.Add(profileConfig);
|
|
context.SaveChanges();
|
|
|
|
var defaultChannel = new Channel(Guid.NewGuid())
|
|
{
|
|
Number = 1,
|
|
Name = "ErsatzTV",
|
|
FFmpegProfile = defaultProfile,
|
|
StreamingMode = StreamingMode.TransportStream
|
|
};
|
|
context.Channels.Add(defaultChannel);
|
|
context.SaveChanges();
|
|
|
|
// TODO: create looping static image that mentions configuring via web
|
|
return Unit.Default;
|
|
}
|
|
}
|
|
}
|