Skip to content

Commit

Permalink
last inventory exists
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-zhur committed Sep 29, 2024
1 parent 3b82926 commit e01ccdb
Show file tree
Hide file tree
Showing 7 changed files with 970 additions and 12 deletions.
15 changes: 5 additions & 10 deletions OneShelf.Videos/OneShelf.Videos.App/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,19 @@

var service1 = host.Services.GetRequiredService<Service1>();
var service2 = host.Services.GetRequiredService<Service2>();
var service3 = host.Services.GetRequiredService<ExifService>();
var service4 = host.Services.GetRequiredService<LiveDownloader>();
var liveDownloader = host.Services.GetRequiredService<LiveDownloader>();
await using var videosDatabase = host.Services.GetRequiredService<VideosDatabase>();

//await videosDatabase.Database.MigrateAsync();

//await service4.UpdateLive(true);
//await videosDatabase.AppendTopics();
//await videosDatabase.AppendMediae();
//await videosDatabase.UpdateMediaTopics();



await liveDownloader.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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ private async Task SaveToDatabase(ChatBase chat, Dictionary<int, (string name, L
videosDatabase.LiveChats.Add(liveChat);
}

foreach (var liveMedia in liveChat.LiveTopics.SelectMany(x => x.LiveMediae))
{
liveMedia.LastInventoryExists = false;
}

liveChat.Title = chat.Title;

foreach (var topic in topics)
Expand Down Expand Up @@ -180,6 +185,7 @@ private async Task SaveToDatabase(ChatBase chat, Dictionary<int, (string name, L
liveTopic.LiveMediae.Add(liveMedia);
}

liveMedia.LastInventoryExists = true;
liveMedia.MessageDate = media.message.fwd_from?.date ?? media.message.Date;
liveMedia.IsForwarded = media.message.fwd_from != null;
liveMedia.MediaType = media.message.media.GetType().ToString();
Expand Down
Loading

0 comments on commit e01ccdb

Please sign in to comment.