Simplify bulding policy
The order of items is still preserved
MODIFY
plextraktsync/config/HttpCacheConfig.py
plextraktsync/config/HttpCacheConfig.py
@@ -93,14 +93,9 @@ def urls_expire_after(self) -> ExpirationPatterns:
NOTE: If there is more than one match, the first match will be used in the order they are defined
"""
- # We need to build the dict manually, so users can have overrides for builtin patterns
- policy = {}
- for k, v in self.default_policy.items():
- # Use user value if present
- if k in self.policy:
- v = self.policy[k]
- policy[k] = v
-
+ # We build dict from default_policy to keep the order of it
+ policy = self.default_policy.copy()
+ # This will keep the order if user overwrote the item
policy.update(self.policy)
return policy

Simplify bulding policy

The order of items is still preserved