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.
- {bhtool-0.4.0 → bhtool-0.5.0}/PKG-INFO +1 -1
- {bhtool-0.4.0 → bhtool-0.5.0}/bhtool/list_movies.py +24 -10
- {bhtool-0.4.0 → bhtool-0.5.0}/pyproject.toml +1 -1
- {bhtool-0.4.0 → bhtool-0.5.0}/.gitignore +0 -0
- {bhtool-0.4.0 → bhtool-0.5.0}/.python-version +0 -0
- {bhtool-0.4.0 → bhtool-0.5.0}/README.md +0 -0
- {bhtool-0.4.0 → bhtool-0.5.0}/bhtool/bumpver.py +0 -0
- {bhtool-0.4.0 → bhtool-0.5.0}/bhtool/cli.py +0 -0
- {bhtool-0.4.0 → bhtool-0.5.0}/bhtool/clr_chmod.py +0 -0
- {bhtool-0.4.0 → bhtool-0.5.0}/bhtool/gdoc.py +0 -0
- {bhtool-0.4.0 → bhtool-0.5.0}/bhtool/llm_services.py +0 -0
- {bhtool-0.4.0 → bhtool-0.5.0}/bhtool/npread.py +0 -0
- {bhtool-0.4.0 → bhtool-0.5.0}/bhtool/portkill.py +0 -0
- {bhtool-0.4.0 → bhtool-0.5.0}/bhtool/psword.py +0 -0
- {bhtool-0.4.0 → bhtool-0.5.0}/bhtool/rm_npm.py +0 -0
- {bhtool-0.4.0 → bhtool-0.5.0}/bhtool/run.py +0 -0
- {bhtool-0.4.0 → bhtool-0.5.0}/bhtool/text.py +0 -0
- {bhtool-0.4.0 → bhtool-0.5.0}/bhtool/todict.py +0 -0
- {bhtool-0.4.0 → bhtool-0.5.0}/bhtool/utils.py +0 -0
- {bhtool-0.4.0 → bhtool-0.5.0}/jtools/jtools.js +0 -0
- {bhtool-0.4.0 → bhtool-0.5.0}/jtools/package.json +0 -0
|
@@ -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
|
|
96
|
-
|
|
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
|
|
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
|
|
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[
|
|
132
|
+
directories: list[DirMapping] = Field(
|
|
123
133
|
default_factory=list, description="Normalized directory names."
|
|
124
134
|
)
|
|
125
|
-
files: list[
|
|
126
|
-
default_factory=list,
|
|
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
|
|
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
|