Fix #919, check if video is in watched state before auto deleting (#920)

* Fix #919, check if video is in watched state before auto deleting

* lint
This commit is contained in:
Jurrer 2025-04-29 04:22:19 +02:00 committed by GitHub
parent c00368d1f2
commit 32cc2c8a13
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 1 deletions

View File

@ -312,7 +312,14 @@ class DownloadPostProcess(DownloaderBase):
print(f"auto delete older than {autodelete_days} days")
now_lte = str(self.now - autodelete_days * 24 * 60 * 60)
data = {
"query": {"range": {"player.watched_date": {"lte": now_lte}}},
"query": {
"bool": {
"must": [
{"range": {"player.watched_date": {"lte": now_lte}}},
{"term": {"player.watched": True}},
]
}
},
"sort": [{"player.watched_date": {"order": "asc"}}],
}
self._auto_delete_watched(data)
@ -327,6 +334,7 @@ class DownloadPostProcess(DownloaderBase):
must_list = [
{"range": {"player.watched_date": {"lte": now_lte}}},
{"term": {"channel.channel_id": {"value": channel_id}}},
{"term": {"player.watched": True}},
]
data = {
"query": {"bool": {"must": must_list}},