mirror of
https://github.com/hmaxnl/SharpRSS.git
synced 2025-01-18 12:54:20 +01:00
Reworking db models from Argotic
This commit is contained in:
parent
4ef3b58a20
commit
5a1f350caf
|
@ -143,7 +143,7 @@ namespace SharpRss
|
|||
FeedModel? feed = null;
|
||||
await using SqliteConnection dbc = new SqliteConnection(ConnectionString);
|
||||
dbc.Open();
|
||||
await using SqliteCommand cmd = new SqliteCommand($"INSERT OR REPLACE INTO {FeedTable} (url, title, group_id, feed_type, description, language, copyright, date_added, last_updated, image_url, original_document) VALUES (@url, @title, @groupId, @feedType, @description, @language, @copyright, @dateAdded), @lastUpdated, @imageUrl, @originalDoc); SELECT * FROM {FeedTable} WHERE url=@url", dbc)
|
||||
await using SqliteCommand cmd = new SqliteCommand($"INSERT OR REPLACE INTO {FeedTable} (url, title, group_id, feed_type, description, language, copyright, date_added, last_updated, image_url, original_document) VALUES (@url, @title, @groupId, @feedType, @description, @language, @copyright, @dateAdded, @lastUpdated, @imageUrl, @originalDoc); SELECT * FROM {FeedTable} WHERE url=@url", dbc)
|
||||
{
|
||||
Parameters =
|
||||
{
|
||||
|
@ -154,8 +154,8 @@ namespace SharpRss
|
|||
new SqliteParameter("description", feedModel.Description ?? string.Empty),
|
||||
new SqliteParameter("language", feedModel.Language ?? string.Empty),
|
||||
new SqliteParameter("copyright", feedModel.Copyright ?? string.Empty),
|
||||
new SqliteParameter("dateAdded", feedModel.DateAdded?.ToUnixTimeMilliseconds()),
|
||||
new SqliteParameter("lastUpdated", feedModel.LastUpdated?.ToUnixTimeMilliseconds()),
|
||||
new SqliteParameter("dateAdded", feedModel.DateAdded?.ToUnixTimeMilliseconds() ?? 0),
|
||||
new SqliteParameter("lastUpdated", feedModel.LastUpdated?.ToUnixTimeMilliseconds() ?? 0),
|
||||
new SqliteParameter("imageUrl", feedModel.ImageUrl ?? string.Empty),
|
||||
new SqliteParameter("originalDoc", feedModel.OriginalDocument ?? string.Empty)
|
||||
}
|
||||
|
|
|
@ -49,9 +49,9 @@ namespace SharpRss.Services
|
|||
// Add feed
|
||||
FeedModel? dbFeed = await DbAccess.SetFeedAsync(fModel);
|
||||
// Update/fetch items
|
||||
await DbAccess.FetchFeedItemsAsync(new string[] { fModel.Url });
|
||||
//await DbAccess.FetchFeedItemsAsync(new string[] { fModel.Url });
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
private static FeedModel FromResource(ISyndicationResource resource)
|
||||
{
|
||||
|
@ -60,6 +60,13 @@ namespace SharpRss.Services
|
|||
{
|
||||
case SyndicationContentFormat.Rss:
|
||||
RssFeed rssFeed = (RssFeed)resource;
|
||||
model.FeedType = rssFeed.Format.ToString();
|
||||
model.Title = rssFeed.Channel.Title;
|
||||
model.Description = rssFeed.Channel.Description;
|
||||
model.Copyright = rssFeed.Channel.Copyright;
|
||||
model.Url = rssFeed.Channel.SelfLink.ToString();
|
||||
model.ImageUrl = rssFeed.Channel.Image?.Url.ToString();
|
||||
model.Language = rssFeed.Channel.Language?.ToString();
|
||||
break;
|
||||
case SyndicationContentFormat.Atom:
|
||||
AtomFeed atomFeed = (AtomFeed)resource;
|
||||
|
@ -158,8 +165,8 @@ namespace SharpRss.Services
|
|||
throw;
|
||||
}*/
|
||||
/*var groups = await GetGroupsAsync();
|
||||
CategoryModel testGroup = groups.Single(x => x.Name == "News");*/
|
||||
await AddSubscriptionAsync("https://www.nu.nl/rss/Algemeen");
|
||||
CategoryModel testGroup = groups.Single(x => x.Name == "News");
|
||||
await AddSubscriptionAsync("https://www.nu.nl/rss/Algemeen", testGroup);*/
|
||||
/*await AddFeedsAsync(new[]
|
||||
{
|
||||
"https://www.nu.nl/rss/Algemeen",
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user