Skip to content

Commit 289da58

Browse files
jet-logicjet-logic
authored andcommitted
added text_to_ascii
1 parent e4bc3cc commit 289da58

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "renx"
7-
version = "0.0.1"
7+
version = "0.0.2"
88
description = "Advanced file renaming tool with regex and case transformation support"
99
readme = "README.md"
1010
authors = [

renx/__main__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def text_to_ascii(text):
1414
)
1515

1616

17-
class ScanDir(ScanTree):
17+
class App(ScanTree):
1818
def __init__(self) -> None:
1919
self._entry_filters = []
2020
super().__init__()
@@ -33,7 +33,7 @@ def add_arguments(self, ap):
3333
if not ap.description:
3434
ap.description = "Renames files matching re substitution pattern"
3535

36-
super(ScanDir, self).add_arguments(ap)
36+
super(App, self).add_arguments(ap)
3737

3838
def start(self):
3939
from re import compile as regex
@@ -54,6 +54,7 @@ def start(self):
5454

5555
def slugify(value):
5656
value = str(value)
57+
value = text_to_ascii(value)
5758
value = re.sub(r"[^a-zA-Z0-9_.+-]+", "_", value)
5859
return value
5960

@@ -119,4 +120,4 @@ def process_entry(self, de):
119120
print(f'REN: {name1!r} -> {name2!r} {dry_run and "?" or "!"} @{parent}')
120121

121122

122-
(__name__ == "__main__") and ScanDir().main()
123+
(__name__ == "__main__") and App().main()

tests/test_urlsafe.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_urlsafe_dry_run(self):
4646

4747
# Verify output contains expected renames
4848
expected_transforms = {
49-
"My Résumé.pdf": "My_R_sum.pdf",
49+
"My Résumé.pdf": "My_Resume.pdf",
5050
"Vacation Photos 2023.jpg": "Vacation_Photos_2023.jpg",
5151
"Price List (v2).xlsx": "Price_List_v2.xlsx",
5252
"config~backup.json": "config_backup.json",
@@ -76,7 +76,7 @@ def test_urlsafe_actual_rename(self):
7676

7777
# Expected filenames after transformation
7878
expected_files = [
79-
"My_R_sum.pdf",
79+
"My_Resume.pdf",
8080
"Vacation_Photos_2023.jpg",
8181
"Price_List_v2.xlsx",
8282
"config_backup.json",
@@ -107,7 +107,7 @@ def test_combined_options(self):
107107

108108
# Verify combined transformation
109109
expected_files = [
110-
"my_r_sum.pdf",
110+
"my_resume.pdf",
111111
"vacation_photos_2023.jpg",
112112
"price_list_v2.xlsx",
113113
"config_backup.json",

0 commit comments

Comments
 (0)