Refactor code structure for improved readability and maintainability

This commit is contained in:
sHa
2025-12-30 09:03:20 +00:00
parent 6b343681a5
commit dff245c37f
4 changed files with 6 additions and 6 deletions

BIN
dist/renamer-0.5.6-py3-none-any.whl vendored Normal file

Binary file not shown.

View File

@@ -1,6 +1,6 @@
[project] [project]
name = "renamer" name = "renamer"
version = "0.5.5" version = "0.5.6"
description = "Terminal-based media file renamer and metadata viewer" description = "Terminal-based media file renamer and metadata viewer"
readme = "README.md" readme = "README.md"
requires-python = ">=3.11" requires-python = ">=3.11"

View File

@@ -179,9 +179,9 @@ Do you want to proceed with renaming?
if event.button.id == "rename": if event.button.id == "rename":
try: try:
logging.info(f"Renaming {self.old_path} to {self.new_path}") logging.info(f"Renaming {self.old_path} to {self.new_path}")
self.old_path.rename(self.new_path) self.old_path.rename(self.old_path.with_name(self.new_path)) # type: ignore
# Update the tree node # Update the tree node
self.app.update_renamed_file(self.old_path, self.new_path) # type: ignore self.app.update_renamed_file(self.old_path, self.old_path.with_name(self.new_path)) # type: ignore
self.app.pop_screen() self.app.pop_screen()
except Exception as e: except Exception as e:
# Show error # Show error
@@ -229,9 +229,9 @@ Do you want to proceed with renaming?
# Trigger rename # Trigger rename
try: try:
logging.info(f"Hotkey renaming {self.old_path} to {self.new_path}") logging.info(f"Hotkey renaming {self.old_path} to {self.new_path}")
self.old_path.rename(self.new_path) self.old_path.rename(self.old_path.with_name(self.new_path)) # type: ignore
# Update the tree node # Update the tree node
self.app.update_renamed_file(self.old_path, self.new_path) # type: ignore self.app.update_renamed_file(self.old_path, self.old_path.with_name(self.new_path)) # type: ignore
self.app.pop_screen() self.app.pop_screen()
except Exception as e: except Exception as e:
# Show error # Show error

2
uv.lock generated
View File

@@ -342,7 +342,7 @@ wheels = [
[[package]] [[package]]
name = "renamer" name = "renamer"
version = "0.5.5" version = "0.5.6"
source = { editable = "." } source = { editable = "." }
dependencies = [ dependencies = [
{ name = "langcodes" }, { name = "langcodes" },