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

View File

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