Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
jim60105 committed Jun 29, 2024
2 parents cfc6296 + b9e6e3a commit 09a08cd
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 185 deletions.
10 changes: 5 additions & 5 deletions Helper/NameHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public static string PlatformType(string videoId, string platform)
return platform switch
{
"Youtube" or IYtarchiveService.Name or IYtdlpService.Name
=> videoId.TrimStart('Y'),
=> videoId.StartsWith('Y') ? videoId[1..] : videoId,
"Twitch" or IStreamlinkService.Name
=> videoId.StartsWith("TW") ? videoId[2..] : videoId,
"Twitcasting" or ITwitcastingRecorderService.Name
Expand All @@ -97,13 +97,13 @@ public static string DatabaseType(string videoId, string platform)
return platform switch
{
"Youtube" or IYtarchiveService.Name or IYtdlpService.Name
=> videoId.StartsWith('Y') ? videoId : "Y" + videoId,
=> "Y" + videoId,
"Twitch" or IStreamlinkService.Name
=> videoId.StartsWith("TW") ? videoId : "TW" + videoId,
=> "TW" + videoId,
"Twitcasting" or ITwitcastingRecorderService.Name
=> videoId.StartsWith("TC") ? videoId : "TC" + videoId,
=> "TC" + videoId,
"FC2" or IFc2LiveDLService.Name
=> videoId.StartsWith("FC") ? videoId : "FC" + videoId,
=> "FC" + videoId,
_ => throw new NotImplementedException()
};
}
Expand Down
4 changes: 2 additions & 2 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
using LivestreamRecorderService.Workers;
using Microsoft.Extensions.Options;
using Serilog;
using Serilog.Debugging;

// ReSharper disable SwitchStatementHandlesSomeKnownEnumValuesWithDefault

#if !RELEASE
using Serilog.Debugging;

SelfLog.Enable(Console.WriteLine);
#endif

Expand Down Expand Up @@ -119,7 +120,6 @@

services.AddSingleton<IUploaderService, UploaderService>();

services.AddHostedService<MigrationWorker>();
services.AddHostedService<MonitorWorker>();
services.AddHostedService<RecordWorker>();
services.AddSingleton<RecordService>();
Expand Down
2 changes: 1 addition & 1 deletion ScopedServices/PlatformService/TwitchService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public override async Task UpdateVideoDataAsync(Video video, CancellationToken c

public override async Task UpdateChannelDataAsync(Channel channel, CancellationToken stoppingToken)
{
string? channelId = channel.id;
string channelId = channel.id;
GetUsersResponse? usersResponse =
await twitchApi.Helix.Users.GetUsersAsync(logins: [NameHelper.ChangeId.ChannelId.PlatformType(channelId, PlatformName)]);

Expand Down
174 changes: 0 additions & 174 deletions Workers/MigrationWorker.cs

This file was deleted.

6 changes: 3 additions & 3 deletions Workers/MonitorWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
// KubernetesService needed to be initialized first
IJobService ___ = scope.ServiceProvider.GetRequiredService<IJobService>();
YoutubeService youtubeSerivce = scope.ServiceProvider.GetRequiredService<YoutubeService>();
YoutubeService youtubeService = scope.ServiceProvider.GetRequiredService<YoutubeService>();
TwitcastingService twitcastingService = scope.ServiceProvider.GetRequiredService<TwitcastingService>();
Fc2Service fc2Service = scope.ServiceProvider.GetRequiredService<Fc2Service>();
VideoService videoService = scope.ServiceProvider.GetRequiredService<VideoService>();

#endregion

await MonitorPlatformAsync(youtubeSerivce, videoService, stoppingToken);
await MonitorPlatformAsync(youtubeService, videoService, stoppingToken);
await MonitorPlatformAsync(twitcastingService, videoService, stoppingToken);
await MonitorPlatformAsync(fc2Service, videoService, stoppingToken);

Expand All @@ -59,7 +59,7 @@ private async Task MonitorPlatformAsync(IPlatformService platformService, VideoS
{
if (!platformService.StepInterval(Interval)) return;

List<Channel>? channels = await platformService.GetMonitoringChannels();
List<Channel> channels = await platformService.GetMonitoringChannels();
logger.LogTrace("Get {channelCount} channels for {platform}", channels.Count, platformService.PlatformName);
await updateVideosDataFromSource();
await updateScheduledVideosStatus();
Expand Down

0 comments on commit 09a08cd

Please sign in to comment.