bhtool 0.4.0__tar.gz → 0.5.0__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: bhtool
3
- Version: 0.4.0
3
+ Version: 0.5.0
4
4
  Summary: Assorted CLI utilities for Bosco’s workflows (dev, media, macOS, LLM helpers).
5
5
  Author-email: Bosco Ho <apposite@gmail.com>
6
6
  Requires-Python: >=3.13
@@ -92,14 +92,15 @@ NORMALIZE_SYSTEM_PROMPT = textwrap.dedent("""
92
92
  normalized name.
93
93
  - Strip release/quality tags: [1080p], [720p], [WEBRip], [BluRay],
94
94
  [YTS.MX], codec names, group names, etc.
95
- - For files: normalize only the base name (before the extension); the
96
- extension stays unchanged in the output.
95
+ - For files: normalize only the base name before the extension. Do not
96
+ include the extension in the normalized file name.
97
97
  - Preserve the original spelling of the title; only fix casing and
98
98
  punctuation.
99
99
  """).strip()
100
100
 
101
101
  NORMALIZE_USER_PROMPT_TEMPLATE = textwrap.dedent("""
102
- Convert these names to normalized form.
102
+ Convert these names to normalized form. For files, return the base name
103
+ without the extension.
103
104
 
104
105
  Directory names:
105
106
  {dir_list}
@@ -109,21 +110,31 @@ NORMALIZE_USER_PROMPT_TEMPLATE = textwrap.dedent("""
109
110
  """).strip()
110
111
 
111
112
 
112
- class NameMapping(BaseModel):
113
- """One original name and its normalized form."""
113
+ class DirMapping(BaseModel):
114
+ """One original directory name and its normalized form."""
114
115
 
115
- original: str = Field(description="The original directory or file name.")
116
- normalized: str = Field(description="The normalized name.")
116
+ original: str = Field(description="The original directory name.")
117
+ normalized: str = Field(description="The normalized directory name.")
118
+
119
+
120
+ class FileMapping(BaseModel):
121
+ """One original file name and its normalized base name."""
122
+
123
+ original: str = Field(description="The original file name, including its extension.")
124
+ normalized: str = Field(
125
+ description="The normalized base name, without the file extension."
126
+ )
117
127
 
118
128
 
119
129
  class NormalizedNameMapping(BaseModel):
120
130
  """Normalized names for the directories and files in one root directory."""
121
131
 
122
- directories: list[NameMapping] = Field(
132
+ directories: list[DirMapping] = Field(
123
133
  default_factory=list, description="Normalized directory names."
124
134
  )
125
- files: list[NameMapping] = Field(
126
- default_factory=list, description="Normalized file names."
135
+ files: list[FileMapping] = Field(
136
+ default_factory=list,
137
+ description="Normalized file base names, without the file extensions.",
127
138
  )
128
139
 
129
140
 
@@ -273,6 +284,9 @@ def rename_movies(
273
284
  old_name, new_name = e["original"], e["normalized"]
274
285
  old_path = root / old_name
275
286
  suffix = Path(old_name).suffix
287
+ # The model returns the base name; drop the extension if it came along anyway.
288
+ if suffix and new_name.lower().endswith(suffix.lower()):
289
+ new_name = new_name[: -len(suffix)]
276
290
  new_path = root / (new_name + suffix)
277
291
  if old_name == new_name + suffix:
278
292
  continue
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "bhtool"
3
- version = "0.4.0"
3
+ version = "0.5.0"
4
4
  description = "Assorted CLI utilities for Bosco’s workflows (dev, media, macOS, LLM helpers)."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes