mirror of https://github.com/ErsatzTV/ErsatzTV.git
				
				
			
				 19 changed files with 4009 additions and 20 deletions
			
			
		@ -0,0 +1,21 @@
				@@ -0,0 +1,21 @@
					 | 
				
			||||
using System; | 
				
			||||
 | 
				
			||||
namespace ErsatzTV.Application.Streaming.Queries | 
				
			||||
{ | 
				
			||||
    public record GetWrappedProcessByChannelNumber : FFmpegProcessRequest | 
				
			||||
    { | 
				
			||||
        public GetWrappedProcessByChannelNumber(string scheme, string host, string channelNumber) : base( | 
				
			||||
            channelNumber, | 
				
			||||
            "ts", | 
				
			||||
            DateTimeOffset.Now, | 
				
			||||
            false, | 
				
			||||
            true) | 
				
			||||
        { | 
				
			||||
            Scheme = scheme; | 
				
			||||
            Host = host; | 
				
			||||
        } | 
				
			||||
 | 
				
			||||
        public string Scheme { get; } | 
				
			||||
        public string Host { get; } | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,46 @@
				@@ -0,0 +1,46 @@
					 | 
				
			||||
using System; | 
				
			||||
using System.Diagnostics; | 
				
			||||
using System.Threading.Tasks; | 
				
			||||
using ErsatzTV.Core; | 
				
			||||
using ErsatzTV.Core.Domain; | 
				
			||||
using ErsatzTV.Core.Interfaces.FFmpeg; | 
				
			||||
using ErsatzTV.Infrastructure.Data; | 
				
			||||
using ErsatzTV.Infrastructure.Extensions; | 
				
			||||
using LanguageExt; | 
				
			||||
using Microsoft.EntityFrameworkCore; | 
				
			||||
 | 
				
			||||
namespace ErsatzTV.Application.Streaming.Queries | 
				
			||||
{ | 
				
			||||
    public class GetWrappedProcessByChannelNumberHandler : FFmpegProcessHandler<GetWrappedProcessByChannelNumber> | 
				
			||||
    { | 
				
			||||
        private readonly IFFmpegProcessService _ffmpegProcessService; | 
				
			||||
 | 
				
			||||
        public GetWrappedProcessByChannelNumberHandler( | 
				
			||||
            IDbContextFactory<TvContext> dbContextFactory, | 
				
			||||
            IFFmpegProcessService ffmpegProcessService) | 
				
			||||
            : base(dbContextFactory) | 
				
			||||
        { | 
				
			||||
            _ffmpegProcessService = ffmpegProcessService; | 
				
			||||
        } | 
				
			||||
 | 
				
			||||
        protected override async Task<Either<BaseError, PlayoutItemProcessModel>> GetProcess( | 
				
			||||
            TvContext dbContext, | 
				
			||||
            GetWrappedProcessByChannelNumber request, | 
				
			||||
            Channel channel, | 
				
			||||
            string ffmpegPath) | 
				
			||||
        { | 
				
			||||
            bool saveReports = await dbContext.ConfigElements | 
				
			||||
                .GetValue<bool>(ConfigElementKey.FFmpegSaveReports) | 
				
			||||
                .Map(result => result.IfNone(false)); | 
				
			||||
 | 
				
			||||
            Process process = _ffmpegProcessService.WrapSegmenter( | 
				
			||||
                ffmpegPath, | 
				
			||||
                saveReports, | 
				
			||||
                channel, | 
				
			||||
                request.Scheme, | 
				
			||||
                request.Host); | 
				
			||||
 | 
				
			||||
            return new PlayoutItemProcessModel(process, DateTimeOffset.MaxValue); | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
									
										
											File diff suppressed because it is too large
											Load Diff
										
									
								
							
						@ -0,0 +1,22 @@
				@@ -0,0 +1,22 @@
					 | 
				
			||||
using Microsoft.EntityFrameworkCore.Migrations; | 
				
			||||
 | 
				
			||||
#nullable disable | 
				
			||||
 | 
				
			||||
namespace ErsatzTV.Infrastructure.Migrations | 
				
			||||
{ | 
				
			||||
    public partial class Remove_HLSHybridStreamingMode : Migration | 
				
			||||
    { | 
				
			||||
        protected override void Up(MigrationBuilder migrationBuilder) | 
				
			||||
        { | 
				
			||||
            // replace HLS Hybrid with HLS Segmenter
 | 
				
			||||
            migrationBuilder.Sql("UPDATE Channel SET StreamingMode = 4 WHERE StreamingMode = 3"); | 
				
			||||
 | 
				
			||||
            // replace MPEG-TS (Legacy) with new MPEG-TS
 | 
				
			||||
            migrationBuilder.Sql("UPDATE Channel SET StreamingMode = 5 WHERE StreamingMode = 1"); | 
				
			||||
        } | 
				
			||||
 | 
				
			||||
        protected override void Down(MigrationBuilder migrationBuilder) | 
				
			||||
        { | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
					Loading…
					
					
				
		Reference in new issue