Skip to content

Commit 668b707

Browse files
committed
fix: remove date-based overlays when content is downloaded
Coming Soon, Countdown, Far Future Release Date, and Releasing Tomorrow overlays persisted after content was grabbed before its official release date. Added downloaded == false to all affected preset template conditions. Returning Soon templates intentionally excluded — they track future seasons on shows that already have downloaded content. Ref: agregarr/agregarr#554
1 parent fff1237 commit 668b707

1 file changed

Lines changed: 138 additions & 18 deletions

File tree

server/lib/overlays/PresetTemplates.ts

Lines changed: 138 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,12 @@ export const PRESET_TEMPLATES: {
286286
operator: 'lte',
287287
value: 30,
288288
}, // Only ≤30 days
289+
{
290+
ruleOperator: 'and',
291+
field: 'downloaded',
292+
operator: 'eq',
293+
value: false,
294+
},
289295
],
290296
},
291297
{
@@ -299,6 +305,12 @@ export const PRESET_TEMPLATES: {
299305
operator: 'lte',
300306
value: 30,
301307
}, // Only ≤30 days
308+
{
309+
ruleOperator: 'and',
310+
field: 'downloaded',
311+
operator: 'eq',
312+
value: false,
313+
},
302314
],
303315
},
304316
],
@@ -1273,7 +1285,7 @@ export const PRESET_TEMPLATES: {
12731285
applicationCondition: {
12741286
sections: [
12751287
{
1276-
// Movies: >30 days, monitored, not a show, in Radarr
1288+
// Movies: >30 days, monitored, not a show, in Radarr, not yet downloaded
12771289
rules: [
12781290
{ field: 'daysUntilRelease', operator: 'gt', value: 30 },
12791291
{
@@ -1294,10 +1306,16 @@ export const PRESET_TEMPLATES: {
12941306
operator: 'eq',
12951307
value: true,
12961308
},
1309+
{
1310+
ruleOperator: 'and',
1311+
field: 'downloaded',
1312+
operator: 'eq',
1313+
value: false,
1314+
},
12971315
],
12981316
},
12991317
{
1300-
// OR TV S01: >30 days, monitored, season <= 1, in Sonarr
1318+
// OR TV S01: >30 days, monitored, season <= 1, in Sonarr, not yet downloaded
13011319
sectionOperator: 'or',
13021320
rules: [
13031321
{ field: 'daysUntilRelease', operator: 'gt', value: 30 },
@@ -1319,6 +1337,12 @@ export const PRESET_TEMPLATES: {
13191337
operator: 'eq',
13201338
value: true,
13211339
},
1340+
{
1341+
ruleOperator: 'and',
1342+
field: 'downloaded',
1343+
operator: 'eq',
1344+
value: false,
1345+
},
13221346
],
13231347
},
13241348
],
@@ -1375,7 +1399,7 @@ export const PRESET_TEMPLATES: {
13751399
applicationCondition: {
13761400
sections: [
13771401
{
1378-
// Movies: (>30 days AND movie) AND NOT inRadarr
1402+
// Movies: (>30 days AND movie) AND NOT inRadarr AND not downloaded
13791403
rules: [
13801404
{ field: 'daysUntilRelease', operator: 'gt', value: 30 },
13811405
{
@@ -1390,10 +1414,16 @@ export const PRESET_TEMPLATES: {
13901414
operator: 'eq',
13911415
value: false,
13921416
},
1417+
{
1418+
ruleOperator: 'and',
1419+
field: 'downloaded',
1420+
operator: 'eq',
1421+
value: false,
1422+
},
13931423
],
13941424
},
13951425
{
1396-
// OR (>30 days AND movie) AND NOT monitored
1426+
// OR (>30 days AND movie) AND NOT monitored AND not downloaded
13971427
sectionOperator: 'or',
13981428
rules: [
13991429
{ field: 'daysUntilRelease', operator: 'gt', value: 30 },
@@ -1409,10 +1439,16 @@ export const PRESET_TEMPLATES: {
14091439
operator: 'eq',
14101440
value: false,
14111441
},
1442+
{
1443+
ruleOperator: 'and',
1444+
field: 'downloaded',
1445+
operator: 'eq',
1446+
value: false,
1447+
},
14121448
],
14131449
},
14141450
{
1415-
// OR TV S01: (>30 days AND season <= 1) AND NOT inSonarr
1451+
// OR TV S01: (>30 days AND season <= 1) AND NOT inSonarr AND not downloaded
14161452
sectionOperator: 'or',
14171453
rules: [
14181454
{ field: 'daysUntilRelease', operator: 'gt', value: 30 },
@@ -1428,10 +1464,16 @@ export const PRESET_TEMPLATES: {
14281464
operator: 'eq',
14291465
value: false,
14301466
},
1467+
{
1468+
ruleOperator: 'and',
1469+
field: 'downloaded',
1470+
operator: 'eq',
1471+
value: false,
1472+
},
14311473
],
14321474
},
14331475
{
1434-
// OR (>30 days AND season <= 1) AND NOT monitored
1476+
// OR (>30 days AND season <= 1) AND NOT monitored AND not downloaded
14351477
sectionOperator: 'or',
14361478
rules: [
14371479
{ field: 'daysUntilRelease', operator: 'gt', value: 30 },
@@ -1447,6 +1489,12 @@ export const PRESET_TEMPLATES: {
14471489
operator: 'eq',
14481490
value: false,
14491491
},
1492+
{
1493+
ruleOperator: 'and',
1494+
field: 'downloaded',
1495+
operator: 'eq',
1496+
value: false,
1497+
},
14501498
],
14511499
},
14521500
],
@@ -1505,7 +1553,7 @@ export const PRESET_TEMPLATES: {
15051553
sections: [
15061554
{
15071555
rules: [
1508-
// Base condition: 2-30 days until release
1556+
// Base condition: 2-30 days until release, not yet downloaded
15091557
{ field: 'daysUntilRelease', operator: 'gt', value: 1 },
15101558
{
15111559
ruleOperator: 'and',
@@ -1533,10 +1581,16 @@ export const PRESET_TEMPLATES: {
15331581
operator: 'eq',
15341582
value: true,
15351583
},
1584+
{
1585+
ruleOperator: 'and',
1586+
field: 'downloaded',
1587+
operator: 'eq',
1588+
value: false,
1589+
},
15361590
],
15371591
},
15381592
{
1539-
// OR TV Season 1
1593+
// OR TV Season 1, not yet downloaded
15401594
sectionOperator: 'or',
15411595
rules: [
15421596
{ field: 'daysUntilRelease', operator: 'gt', value: 1 },
@@ -1564,6 +1618,12 @@ export const PRESET_TEMPLATES: {
15641618
operator: 'eq',
15651619
value: true,
15661620
},
1621+
{
1622+
ruleOperator: 'and',
1623+
field: 'downloaded',
1624+
operator: 'eq',
1625+
value: false,
1626+
},
15671627
],
15681628
},
15691629
],
@@ -1626,7 +1686,7 @@ export const PRESET_TEMPLATES: {
16261686
applicationCondition: {
16271687
sections: [
16281688
{
1629-
// Movies: (2-30 days AND movie) AND NOT inRadarr
1689+
// Movies: (2-30 days AND movie) AND NOT inRadarr AND not downloaded
16301690
rules: [
16311691
{ field: 'daysUntilRelease', operator: 'gt', value: 1 },
16321692
{
@@ -1647,10 +1707,16 @@ export const PRESET_TEMPLATES: {
16471707
operator: 'eq',
16481708
value: false,
16491709
},
1710+
{
1711+
ruleOperator: 'and',
1712+
field: 'downloaded',
1713+
operator: 'eq',
1714+
value: false,
1715+
},
16501716
],
16511717
},
16521718
{
1653-
// OR (2-30 days AND movie) AND NOT monitored
1719+
// OR (2-30 days AND movie) AND NOT monitored AND not downloaded
16541720
sectionOperator: 'or',
16551721
rules: [
16561722
{ field: 'daysUntilRelease', operator: 'gt', value: 1 },
@@ -1672,10 +1738,16 @@ export const PRESET_TEMPLATES: {
16721738
operator: 'eq',
16731739
value: false,
16741740
},
1741+
{
1742+
ruleOperator: 'and',
1743+
field: 'downloaded',
1744+
operator: 'eq',
1745+
value: false,
1746+
},
16751747
],
16761748
},
16771749
{
1678-
// OR TV S01: (2-30 days AND season <= 1) AND NOT inSonarr
1750+
// OR TV S01: (2-30 days AND season <= 1) AND NOT inSonarr AND not downloaded
16791751
sectionOperator: 'or',
16801752
rules: [
16811753
{ field: 'daysUntilRelease', operator: 'gt', value: 1 },
@@ -1697,10 +1769,16 @@ export const PRESET_TEMPLATES: {
16971769
operator: 'eq',
16981770
value: false,
16991771
},
1772+
{
1773+
ruleOperator: 'and',
1774+
field: 'downloaded',
1775+
operator: 'eq',
1776+
value: false,
1777+
},
17001778
],
17011779
},
17021780
{
1703-
// OR (2-30 days AND season <= 1) AND NOT monitored
1781+
// OR (2-30 days AND season <= 1) AND NOT monitored AND not downloaded
17041782
sectionOperator: 'or',
17051783
rules: [
17061784
{ field: 'daysUntilRelease', operator: 'gt', value: 1 },
@@ -1722,6 +1800,12 @@ export const PRESET_TEMPLATES: {
17221800
operator: 'eq',
17231801
value: false,
17241802
},
1803+
{
1804+
ruleOperator: 'and',
1805+
field: 'downloaded',
1806+
operator: 'eq',
1807+
value: false,
1808+
},
17251809
],
17261810
},
17271811
],
@@ -1780,7 +1864,7 @@ export const PRESET_TEMPLATES: {
17801864
applicationCondition: {
17811865
sections: [
17821866
{
1783-
// Movies: tomorrow, monitored, not a show, in Radarr
1867+
// Movies: tomorrow, monitored, not a show, in Radarr, not yet downloaded
17841868
rules: [
17851869
{ field: 'daysUntilRelease', operator: 'eq', value: 1 },
17861870
{
@@ -1801,10 +1885,16 @@ export const PRESET_TEMPLATES: {
18011885
operator: 'eq',
18021886
value: true,
18031887
},
1888+
{
1889+
ruleOperator: 'and',
1890+
field: 'downloaded',
1891+
operator: 'eq',
1892+
value: false,
1893+
},
18041894
],
18051895
},
18061896
{
1807-
// OR TV S01: tomorrow, monitored, season <= 1, in Sonarr
1897+
// OR TV S01: tomorrow, monitored, season <= 1, in Sonarr, not yet downloaded
18081898
sectionOperator: 'or',
18091899
rules: [
18101900
{ field: 'daysUntilRelease', operator: 'eq', value: 1 },
@@ -1826,6 +1916,12 @@ export const PRESET_TEMPLATES: {
18261916
operator: 'eq',
18271917
value: true,
18281918
},
1919+
{
1920+
ruleOperator: 'and',
1921+
field: 'downloaded',
1922+
operator: 'eq',
1923+
value: false,
1924+
},
18291925
],
18301926
},
18311927
],
@@ -1880,7 +1976,7 @@ export const PRESET_TEMPLATES: {
18801976
applicationCondition: {
18811977
sections: [
18821978
{
1883-
// Movies: (tomorrow AND movie) AND NOT inRadarr
1979+
// Movies: (tomorrow AND movie) AND NOT inRadarr AND not downloaded
18841980
rules: [
18851981
{ field: 'daysUntilRelease', operator: 'eq', value: 1 },
18861982
{
@@ -1895,10 +1991,16 @@ export const PRESET_TEMPLATES: {
18951991
operator: 'eq',
18961992
value: false,
18971993
},
1994+
{
1995+
ruleOperator: 'and',
1996+
field: 'downloaded',
1997+
operator: 'eq',
1998+
value: false,
1999+
},
18982000
],
18992001
},
19002002
{
1901-
// OR (tomorrow AND movie) AND NOT monitored
2003+
// OR (tomorrow AND movie) AND NOT monitored AND not downloaded
19022004
sectionOperator: 'or',
19032005
rules: [
19042006
{ field: 'daysUntilRelease', operator: 'eq', value: 1 },
@@ -1914,10 +2016,16 @@ export const PRESET_TEMPLATES: {
19142016
operator: 'eq',
19152017
value: false,
19162018
},
2019+
{
2020+
ruleOperator: 'and',
2021+
field: 'downloaded',
2022+
operator: 'eq',
2023+
value: false,
2024+
},
19172025
],
19182026
},
19192027
{
1920-
// OR TV S01: (tomorrow AND season <= 1) AND NOT inSonarr
2028+
// OR TV S01: (tomorrow AND season <= 1) AND NOT inSonarr AND not downloaded
19212029
sectionOperator: 'or',
19222030
rules: [
19232031
{ field: 'daysUntilRelease', operator: 'eq', value: 1 },
@@ -1933,10 +2041,16 @@ export const PRESET_TEMPLATES: {
19332041
operator: 'eq',
19342042
value: false,
19352043
},
2044+
{
2045+
ruleOperator: 'and',
2046+
field: 'downloaded',
2047+
operator: 'eq',
2048+
value: false,
2049+
},
19362050
],
19372051
},
19382052
{
1939-
// OR (tomorrow AND season <= 1) AND NOT monitored
2053+
// OR (tomorrow AND season <= 1) AND NOT monitored AND not downloaded
19402054
sectionOperator: 'or',
19412055
rules: [
19422056
{ field: 'daysUntilRelease', operator: 'eq', value: 1 },
@@ -1952,6 +2066,12 @@ export const PRESET_TEMPLATES: {
19522066
operator: 'eq',
19532067
value: false,
19542068
},
2069+
{
2070+
ruleOperator: 'and',
2071+
field: 'downloaded',
2072+
operator: 'eq',
2073+
value: false,
2074+
},
19552075
],
19562076
},
19572077
],

0 commit comments

Comments
 (0)