diff --git a/OneShelf.Videos/OneShelf.Videos.App/Program.cs b/OneShelf.Videos/OneShelf.Videos.App/Program.cs index 3f66143b..82526f9d 100644 --- a/OneShelf.Videos/OneShelf.Videos.App/Program.cs +++ b/OneShelf.Videos/OneShelf.Videos.App/Program.cs @@ -17,12 +17,21 @@ var service2 = host.Services.GetRequiredService(); var service3 = host.Services.GetRequiredService(); var service4 = host.Services.GetRequiredService(); - await using var videosDatabase = host.Services.GetRequiredService(); -await videosDatabase.Database.MigrateAsync(); -await videosDatabase.AppendTopics(); -//await service4.Try(false); +//await videosDatabase.Database.MigrateAsync(); + +//await service4.UpdateLive(true); +//await videosDatabase.AppendTopics(); +//await videosDatabase.AppendMediae(); +//await videosDatabase.UpdateMediaTopics(); + + + +await service2.UploadPhotos(await service1.GetExportLivePhoto()); +await service2.UploadVideos(await service1.GetExportLiveVideo()); + + //await videosDatabase.CreateMissingStaticTopics(); //await videosDatabase.UpdateStaticMessagesTopics(); diff --git a/OneShelf.Videos/OneShelf.Videos.BusinessLogic/Services/ExifService.cs b/OneShelf.Videos/OneShelf.Videos.BusinessLogic/Services/ExifService.cs index 1e9c39eb..da429546 100644 --- a/OneShelf.Videos/OneShelf.Videos.BusinessLogic/Services/ExifService.cs +++ b/OneShelf.Videos/OneShelf.Videos.BusinessLogic/Services/ExifService.cs @@ -4,13 +4,19 @@ namespace OneShelf.Videos.BusinessLogic.Services; public class ExifService { - public async Task SetExifTimestamp(string path, string tempFileName, DateTime timestamp) + public async Task SetExifTimestamp(string path, string tempFileName, DateTime timestamp) { var image = await ImageFile.FromFileAsync(path); if (image.Errors.Any()) throw new($"Some image errors, {path}."); - if (image.Properties.Contains(ExifTag.DateTime)) throw new($"The image contains a datetime, {path}."); + if (image.Properties.Contains(ExifTag.DateTime)) + { + File.Copy(path, tempFileName); + return false; + } image.Properties.Set(ExifTag.DateTime, timestamp); await image.SaveAsync(tempFileName); + + return true; } } \ No newline at end of file diff --git a/OneShelf.Videos/OneShelf.Videos.BusinessLogic/Services/Live/LiveDownloader.cs b/OneShelf.Videos/OneShelf.Videos.BusinessLogic/Services/Live/LiveDownloader.cs index 3189c5c4..cc8c396d 100644 --- a/OneShelf.Videos/OneShelf.Videos.BusinessLogic/Services/Live/LiveDownloader.cs +++ b/OneShelf.Videos/OneShelf.Videos.BusinessLogic/Services/Live/LiveDownloader.cs @@ -17,7 +17,7 @@ public class LiveDownloader(IOptions options, ILogger media)> topics) + private async Task SaveToDatabase(ChatBase chat, Dictionary media)> topics) { var liveChat = await videosDatabase.LiveChats.Include(x => x.LiveTopics).ThenInclude(x => x.LiveMediae).SingleOrDefaultAsync(x => x.Id == chat.ID); if (liveChat == null)