Skip to content

Commit

Permalink
Fix time checks in sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Foxocube committed Jan 10, 2025
1 parent 46f24d2 commit c488a61
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions MediaFeeder/MediaFeeder/Components/Dialogs/AddVideo.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h3>AddVideo</h3>

@code {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h3>EditSubscription</h3>

@code {

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public async Task Consume(ConsumeContext<SynchroniseSubscriptionContract<RSSProv
logger.LogInformation("Starting synchronize {}", subscription.Name);

foreach (var video in await db.Videos
.Where(v => v.SubscriptionId == subscription.Id && v.New && DateTimeOffset.Now - v.PublishDate <= TimeSpan.FromDays(1))
.Where(v => v.SubscriptionId == subscription.Id && v.New && DateTimeOffset.UtcNow - v.PublishDate <= TimeSpan.FromDays(1))
.ToListAsync(context.CancellationToken)
)
video.New = false;
Expand Down Expand Up @@ -60,7 +60,7 @@ private async Task SyncVideo(SyndicationItem item, int subscriptionId, Cancellat

video.VideoId = item.ElementExtensions.ReadElementExtensions<string>("identifier", "http://purl.org/dc/elements/1.1/").FirstOrDefault() ?? item.Id;
video.Name = item.Title.Text;
video.New = DateTimeOffset.Now - item.PublishDate <= TimeSpan.FromDays(7);
video.New = DateTimeOffset.UtcNow - item.PublishDate <= TimeSpan.FromDays(7);
video.PublishDate = item.PublishDate;
//video.Thumb = "";
video.Description = item.Summary.Text;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public async Task Consume(ConsumeContext<SynchroniseSubscriptionContract<Youtube
logger.LogInformation("Starting synchronize {}", subscription.Name);

foreach (var video in await db.Videos
.Where(v => v.SubscriptionId == subscription.Id && v.New && DateTimeOffset.Now - v.PublishDate <= TimeSpan.FromDays(1))
.Where(v => v.SubscriptionId == subscription.Id && v.New && DateTimeOffset.UtcNow - v.PublishDate <= TimeSpan.FromDays(1))
.ToListAsync(context.CancellationToken)
)
video.New = false;
Expand Down

0 comments on commit c488a61

Please sign in to comment.