ytdl-sub 2025.12.8__py3-none-any.whl → 2025.12.30__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ytdl_sub/__init__.py CHANGED
@@ -1 +1 @@
1
- __pypi_version__ = "2025.12.08";__local_version__ = "2025.12.08+157a0b5"
1
+ __pypi_version__ = "2025.12.30";__local_version__ = "2025.12.30+344753c"
@@ -1,5 +1,6 @@
1
1
  from typing import Any
2
2
  from typing import Dict
3
+ from typing import Iterable
3
4
  from typing import Optional
4
5
  from typing import Set
5
6
 
@@ -88,6 +89,24 @@ class Overrides(UnstructuredDictFormatterValidator, Scriptable):
88
89
 
89
90
  return True
90
91
 
92
+ def ensure_variable_names_not_a_plugin(self, plugin_names: Iterable[str]) -> None:
93
+ """
94
+ Throws an error if an override variable or function has the same name as a
95
+ preset key. This is to avoid confusion when accidentally defining things in
96
+ overrides that are meant to be in the preset.
97
+ """
98
+ for name in self.keys:
99
+ if name.startswith("%"):
100
+ name = name[1:]
101
+
102
+ if name in plugin_names:
103
+ raise self._validation_exception(
104
+ f"Override variable with name {name} cannot be used since it is"
105
+ " the name of a plugin. Perhaps you meant to define it as a plugin? If so,"
106
+ " indent it left to make it at the same level as overrides.",
107
+ exception_class=InvalidVariableNameException,
108
+ )
109
+
91
110
  def ensure_variable_name_valid(self, name: str) -> None:
92
111
  """
93
112
  Ensures the variable name does not collide with any entry variables or built-in functions.
ytdl_sub/config/preset.py CHANGED
@@ -194,6 +194,8 @@ class Preset(_PresetShell):
194
194
  self.plugins: PresetPlugins = self._validate_and_get_plugins()
195
195
  self.overrides = self._validate_key(key="overrides", validator=Overrides, default={})
196
196
 
197
+ self.overrides.ensure_variable_names_not_a_plugin(plugin_names=PRESET_KEYS)
198
+
197
199
  VariableValidation(
198
200
  downloader_options=self.downloader_options,
199
201
  output_options=self.output_options,
@@ -11,9 +11,6 @@ from ytdl_sub.entries.script.variable_types import Variable
11
11
  from ytdl_sub.script.functions import Functions
12
12
  from ytdl_sub.script.utils.name_validation import is_valid_name
13
13
 
14
- # TODO: use this
15
- SUBSCRIPTION_ARRAY = "subscription_array"
16
-
17
14
 
18
15
  class SubscriptionVariables:
19
16
  @staticmethod
@@ -163,7 +160,7 @@ class OverrideHelpers:
163
160
  True if the override name itself is valid. False otherwise.
164
161
  """
165
162
  if name.startswith("%"):
166
- return is_valid_name(name=name[1:])
163
+ name = name[1:]
167
164
 
168
165
  return is_valid_name(name=name)
169
166
 
@@ -11,8 +11,7 @@ presets:
11
11
 
12
12
  # Set the default date_range to 2 months
13
13
  overrides:
14
- date_range: "2months" # keep for legacy-reasons
15
- only_recent_date_range: "{date_range}"
14
+ only_recent_date_range: "2months"
16
15
 
17
16
  #############################################################################
18
17
  # Only Recent
ytdl_sub/script/script.py CHANGED
@@ -307,10 +307,9 @@ class Script:
307
307
 
308
308
  def _get_unresolved_output_filter(
309
309
  self,
310
- unresolved: Dict[Variable, SyntaxTree],
311
310
  output_filter: Set[str],
312
311
  unresolvable: Set[Variable],
313
- ) -> Dict[Variable, SyntaxTree]:
312
+ ) -> Set[str]:
314
313
  """
315
314
  When an output filter is applied, only a subset of variables that the filter
316
315
  depends on need to be resolved.
@@ -331,7 +330,7 @@ class Script:
331
330
  unresolvable=unresolvable,
332
331
  )
333
332
 
334
- return {var: syntax for var, syntax in unresolved.items() if var.name in subset_to_resolve}
333
+ return subset_to_resolve
335
334
 
336
335
  def _resolve(
337
336
  self,
@@ -367,18 +366,21 @@ class Script:
367
366
 
368
367
  unresolvable: Set[Variable] = {Variable(name) for name in (unresolvable or {})}
369
368
  unresolved_filter = set(resolved.keys()).union(unresolvable)
370
- unresolved: Dict[Variable, SyntaxTree] = {
371
- Variable(name): ast
372
- for name, ast in self._variables.items()
373
- if Variable(name) not in unresolved_filter
374
- }
375
369
 
376
370
  if output_filter:
377
- unresolved = self._get_unresolved_output_filter(
378
- unresolved=unresolved,
379
- output_filter=output_filter,
380
- unresolvable=unresolvable,
381
- )
371
+ unresolved = {
372
+ Variable(name): self._variables[name]
373
+ for name in self._get_unresolved_output_filter(
374
+ output_filter=output_filter,
375
+ unresolvable=unresolvable,
376
+ )
377
+ }
378
+ else:
379
+ unresolved = {
380
+ Variable(name): ast
381
+ for name, ast in self._variables.items()
382
+ if Variable(name) not in unresolved_filter
383
+ }
382
384
 
383
385
  while unresolved:
384
386
  unresolved_count: int = len(unresolved)
@@ -556,8 +558,7 @@ class Script:
556
558
  ).output
557
559
  finally:
558
560
  for name in variable_definitions.keys():
559
- if name in self._variables:
560
- del self._variables[name]
561
+ self._variables.pop(name, None)
561
562
 
562
563
  def get(self, variable_name: str) -> Resolvable:
563
564
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ytdl-sub
3
- Version: 2025.12.8
3
+ Version: 2025.12.30
4
4
  Summary: Automate downloading metadata generation with YoutubeDL
5
5
  Author: Jesse Bannon
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -1,4 +1,4 @@
1
- ytdl_sub/__init__.py,sha256=e5miG5ru_Y8JQRr16EdrHiNv8l2Ex7o1JcCdFgxjWDs,73
1
+ ytdl_sub/__init__.py,sha256=-TEMMN5C78roSqtIzCzV1QpBG296lmhcvghcr997QKY,73
2
2
  ytdl_sub/main.py,sha256=4Rf9wXxSKW7IPnWqG5YtTZ814PjP1n9WtoFDivaainE,1004
3
3
  ytdl_sub/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  ytdl_sub/cli/entrypoint.py,sha256=XXjUH4HiOP_BB2ZA_bNcyt5-o6YLAdZmj0EP3xtOtD8,9496
@@ -12,8 +12,8 @@ ytdl_sub/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  ytdl_sub/config/config_file.py,sha256=SQtVrMIUq2z3WwJVOed4y84JBMQ8aa4pbiBB0Y-YY4M,2781
13
13
  ytdl_sub/config/config_validator.py,sha256=W1dvQD8wI7VOmGOHyaliu8DC6HOjfoGsgUw2MURTZOM,9797
14
14
  ytdl_sub/config/defaults.py,sha256=NTwzlKDkks1LDGNjFMxh91fw5E6T6d_zGsCwODNYJxo,1152
15
- ytdl_sub/config/overrides.py,sha256=0L6WaVtgqGqLvSuUkn4lbll9E8IboJlA7iJteIfN4Mo,8918
16
- ytdl_sub/config/preset.py,sha256=cp_oCyR78pHqYIakUNvNnwuFfFUq1YzitvIav5QW3Jw,8517
15
+ ytdl_sub/config/overrides.py,sha256=oOMrxXSfmNciooLEUM3-GmBzuPhFNZk-2lv4sjPP-u0,9814
16
+ ytdl_sub/config/preset.py,sha256=kVT81J1yfTRthYIOBeHVk_WUrdvr_2mqyY3qUpHWKjQ,8602
17
17
  ytdl_sub/config/preset_options.py,sha256=PBinBBRLTaO4B5Q9bW2WUHAd0-x8fVIUqodOIm-py-c,14207
18
18
  ytdl_sub/config/plugin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  ytdl_sub/config/plugin/plugin.py,sha256=ugUyDnjLKcBy7lOpTbVKaGSuUMvzyyQx3DIcbv3eTkQ,4721
@@ -42,7 +42,7 @@ ytdl_sub/entries/script/function_scripts.py,sha256=iPIgTpIzXv5PRnfG8gi42zP6YKUIG
42
42
  ytdl_sub/entries/script/variable_definitions.py,sha256=dz4znpZ4op4ALtnYw2vy7ePW6z76A6TI994BFlBaOmo,43561
43
43
  ytdl_sub/entries/script/variable_types.py,sha256=6urKgOIOKYjScM5yZu-gF8sYi1HaVrTwaYJkJJg9hi8,9826
44
44
  ytdl_sub/entries/variables/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
45
- ytdl_sub/entries/variables/override_variables.py,sha256=maVwx10SMR7ZPx7roxOzJZXVWYM5TpFTfXG8052M-n4,6003
45
+ ytdl_sub/entries/variables/override_variables.py,sha256=LjWtora5FT9hSka3COP6RySBdpQ39ogiwbJgE-Z_X5Y,5923
46
46
  ytdl_sub/plugins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
47
  ytdl_sub/plugins/audio_extract.py,sha256=3S8xdL-UkOcfPcNfEebXBzSbSu2fpO3Q_wt8OQIH5HA,5445
48
48
  ytdl_sub/plugins/chapters.py,sha256=SWvHtEfVCh7K8OugKUWOWn2TTqdUbpFabbcBGsYpRHc,14495
@@ -66,7 +66,7 @@ ytdl_sub/plugins/internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
66
66
  ytdl_sub/plugins/internal/view.py,sha256=XDPCsTmchcZPYDyV7kPDeDRVm87_gjBS15q4otYCsJU,1963
67
67
  ytdl_sub/prebuilt_presets/__init__.py,sha256=Iv0ysQsR8B9__ZzzYORPOTnFTOAmHsAWEB0dFc2RBog,988
68
68
  ytdl_sub/prebuilt_presets/helpers/__init__.py,sha256=GPG1cfShC65A6wWLlgKvvXfqTKcZmksI9Av17EdARTw,146
69
- ytdl_sub/prebuilt_presets/helpers/download_deletion_options.yaml,sha256=G8RsAmMMoG0bmY3wJ_vMyBSc5gCh6WxKJZuI7OsoRLY,1420
69
+ ytdl_sub/prebuilt_presets/helpers/download_deletion_options.yaml,sha256=M_qGKXPvKjmstJ56eK6pfZHp7pG5xlOypD4S6fm98lA,1360
70
70
  ytdl_sub/prebuilt_presets/helpers/filter_duration.yaml,sha256=mIY97aHdNJfZyfcfpMtK3bF7HHjp0Z6cMRz7L9DFCUU,998
71
71
  ytdl_sub/prebuilt_presets/helpers/filter_keywords.yaml,sha256=UM9rj3DzthmwV0TAFLT3S3wNlbhMAjfd-OHJwqSWu_k,2395
72
72
  ytdl_sub/prebuilt_presets/helpers/media_quality.yaml,sha256=rehgyah_IdtqQ3aZBbYOyUqPffX2ZKlDieg_kXAmBQA,2055
@@ -93,7 +93,7 @@ ytdl_sub/prebuilt_presets/tv_show/tv_show_by_date.yaml,sha256=0OgIOzxSPNVqwcZnL6
93
93
  ytdl_sub/prebuilt_presets/tv_show/tv_show_collection.yaml,sha256=XCtt4i4-zAgyfh-p4SXSGd0FI56lWCrPOMmB6mdf-AE,238393
94
94
  ytdl_sub/script/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
95
95
  ytdl_sub/script/parser.py,sha256=30SOHkEFi0rxiW_IrC1w6WzPKuyIf766zYEVHDsndtg,21898
96
- ytdl_sub/script/script.py,sha256=cLmQ07yIffk-blomLWKdH-dTRiDroLYjgnvidc5-L80,24091
96
+ ytdl_sub/script/script.py,sha256=S-H6rYt9lCcxda9tPsElomf48kzCbGwJkdPcTIFahmA,23993
97
97
  ytdl_sub/script/script_output.py,sha256=5SIamnI-1D3xMA0qQzjf9xrIy8j6BVhGCKrl_Q1d2M8,1381
98
98
  ytdl_sub/script/functions/__init__.py,sha256=rzl6O5G0IEqFYHQECIM9bRvcuQj-ytC_p-Xl2TTa6j0,2932
99
99
  ytdl_sub/script/functions/array_functions.py,sha256=yg9rcZP67-aVzhu4oZZzUu3-AHiHltbQDWEs8GW1DJ4,7193
@@ -158,9 +158,9 @@ ytdl_sub/validators/string_select_validator.py,sha256=KFXNKWX2J80WGt08m5gVYphPMH
158
158
  ytdl_sub/validators/validators.py,sha256=X9AkECdngEXcME_C25njHaOjtqbfEJMED2eG9Qy3UPs,9352
159
159
  ytdl_sub/ytdl_additions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
160
160
  ytdl_sub/ytdl_additions/enhanced_download_archive.py,sha256=Lsc0wjHdx9d8dYJCskZYAUGDAQ_QzQ-_xbQlyrBSzfk,24884
161
- ytdl_sub-2025.12.8.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
162
- ytdl_sub-2025.12.8.dist-info/METADATA,sha256=TEiDWmOZroSIm-6SIVIXT5Ltg4mh-3Br0rvZ2KLyQJE,51419
163
- ytdl_sub-2025.12.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
164
- ytdl_sub-2025.12.8.dist-info/entry_points.txt,sha256=K3T5235NlAI-WLmHCg5tzLZHqc33OLN5IY5fOGc9t10,48
165
- ytdl_sub-2025.12.8.dist-info/top_level.txt,sha256=6z-JWazl6jXspC2DNyxOnGnEqYyGzVbgcBDoXfbkUhI,9
166
- ytdl_sub-2025.12.8.dist-info/RECORD,,
161
+ ytdl_sub-2025.12.30.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
162
+ ytdl_sub-2025.12.30.dist-info/METADATA,sha256=iJlju-U5_fduOC8r1k8UBrMMR-i5cvyucuGJj-85ciA,51420
163
+ ytdl_sub-2025.12.30.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
164
+ ytdl_sub-2025.12.30.dist-info/entry_points.txt,sha256=K3T5235NlAI-WLmHCg5tzLZHqc33OLN5IY5fOGc9t10,48
165
+ ytdl_sub-2025.12.30.dist-info/top_level.txt,sha256=6z-JWazl6jXspC2DNyxOnGnEqYyGzVbgcBDoXfbkUhI,9
166
+ ytdl_sub-2025.12.30.dist-info/RECORD,,