subscription - published threshold
This commit is contained in:
parent
e1eb0dc8e8
commit
340a2f92a6
@ -125,6 +125,10 @@ class TaskCog(commands.Cog):
|
|||||||
for item in feed.items:
|
for item in feed.items:
|
||||||
log.debug("processing item '%s'", item.guid)
|
log.debug("processing item '%s'", item.guid)
|
||||||
|
|
||||||
|
if item.pub_date < sub.published_threshold:
|
||||||
|
log.debug("item '%s' older than subscription threshold '%s', skipping", item.pub_date, sub.published_threshold)
|
||||||
|
continue
|
||||||
|
|
||||||
blocked = any(self.filter_item(_filter, item) for _filter in filters)
|
blocked = any(self.filter_item(_filter, item) for _filter in filters)
|
||||||
mutated_item = item.create_mutated_copy(sub.mutators)
|
mutated_item = item.create_mutated_copy(sub.mutators)
|
||||||
|
|
||||||
|
@ -281,6 +281,7 @@ class Subscription(DjangoDataModel):
|
|||||||
mutators: dict[str, list[dict]]
|
mutators: dict[str, list[dict]]
|
||||||
article_fetch_image: bool
|
article_fetch_image: bool
|
||||||
embed_colour: str
|
embed_colour: str
|
||||||
|
published_threshold: datetime
|
||||||
active: bool
|
active: bool
|
||||||
channels_count: int
|
channels_count: int
|
||||||
|
|
||||||
@ -292,6 +293,7 @@ class Subscription(DjangoDataModel):
|
|||||||
"title": item.pop("article_title_mutators"),
|
"title": item.pop("article_title_mutators"),
|
||||||
"description": item.pop("article_desc_mutators")
|
"description": item.pop("article_desc_mutators")
|
||||||
}
|
}
|
||||||
|
item["published_threshold"] = datetime.strptime(item["published_threshold"], "%Y-%m-%d")
|
||||||
|
|
||||||
return item
|
return item
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user