diff --git a/.gitignore b/.gitignore index 50bbbbf..90aa8dc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,9 +2,6 @@ __pycache__/ *.py[oc] build/ -!dist/*.whl -!dist/.gitignore -dist/ wheels/ *.egg-info diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 0000000..edc95ca --- /dev/null +++ b/INSTALL.md @@ -0,0 +1,171 @@ +# Installation Guide for Renamer + +Renamer is a terminal-based media file renamer and metadata viewer built with Python and Textual. + +## Prerequisites + +- Python 3.11 or higher +- UV package manager (recommended) or pip + +## Installation Methods + +### Method 1: UV Tool Install (Recommended) + +This is the easiest way to install and use Renamer globally on your system. + +#### Install UV (if not already installed) +```bash +# On Linux/macOS +curl -LsSf https://astral.sh/uv/install.sh | sh + +# On Windows +powershell -c "irm https://astral.sh/uv/install.sh | iex" +``` + +#### Install Renamer +```bash +# From the built wheel (if available) +uv tool install dist/renamer-0.2.0-py3-none-any.whl + +# Or from PyPI (when published) +uv tool install renamer +``` + +#### Usage +```bash +renamer # Scan current directory +renamer /path/to/directory # Scan specific directory +``` + +### Method 2: pip Install from Wheel + +If you have the wheel file, you can install it with pip. + +```bash +# Install the wheel +pip install dist/renamer-0.2.0-py3-none-any.whl + +# Or install globally (may require sudo) +sudo pip install dist/renamer-0.2.0-py3-none-any.whl +``` + +### Method 3: Development Installation + +For development or if you want to run from source: + +#### Clone and Setup +```bash +git clone +cd renamer + +# Install dependencies +uv sync + +# Run directly +uv run python main.py +uv run python main.py /path/to/directory +``` + +#### Install in Development Mode +```bash +uv sync +uv tool install --editable . +``` + +### Method 4: Direct Python Execution + +If you prefer not to install globally: + +```bash +# Ensure you have Python 3.11+ +python3 --version + +# Install dependencies +pip install textual mutagen pymediainfo python-magic langcodes + +# Run the application +python3 main.py +python3 main.py /path/to/directory +``` + +## System Requirements + +### Linux +- Python 3.11+ +- MediaInfo library (for detailed media analysis) + ```bash + # Ubuntu/Debian + sudo apt install libmediainfo-dev + + # Fedora/CentOS + sudo dnf install libmediainfo-devel + + # Arch Linux + sudo pacman -S libmediainfo + ``` + +### macOS +- Python 3.11+ (via Homebrew or official installer) +- MediaInfo (automatically handled by pymediainfo) + +### Windows +- Python 3.11+ (official installer) +- MediaInfo (automatically handled by pymediainfo) + +## Verification + +After installation, verify it works: + +```bash +renamer --help +# or +python3 main.py --help +``` + +You should see the help text for the Renamer application. + +## Troubleshooting + +### Common Issues + +1. **"Command not found"** + - Ensure UV bin directory is in your PATH + - Try `uv tool install` again + +2. **Import errors** + - Ensure all dependencies are installed + - Try `uv sync` or `pip install -r requirements.txt` + +3. **Permission errors** + - Use `sudo` for system-wide pip installs + - Or use UV tool install which handles permissions + +4. **MediaInfo not found** + - Install system MediaInfo library + - Or use basic mode (limited functionality) + +### Getting Help + +If you encounter issues: +1. Check the [README.md](README.md) for usage instructions +2. Verify your Python version: `python3 --version` +3. Check UV installation: `uv --version` + +## Uninstallation + +### UV Tool Uninstall +```bash +uv tool uninstall renamer +``` + +### pip Uninstall +```bash +pip uninstall renamer +``` + +### Development Uninstall +```bash +uv tool uninstall renamer +# Remove the cloned directory if desired +``` +/home/sha/bin/renamer/INSTALL.md \ No newline at end of file diff --git a/dist/renamer-0.2.2-py3-none-any.whl b/dist/renamer-0.2.2-py3-none-any.whl new file mode 100644 index 0000000..94e1ed1 Binary files /dev/null and b/dist/renamer-0.2.2-py3-none-any.whl differ diff --git a/pyproject.toml b/pyproject.toml index 21a78b9..dd127de 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "renamer" -version = "0.2.0" +version = "0.2.2" description = "Terminal-based media file renamer and metadata viewer" readme = "README.md" requires-python = ">=3.11" @@ -14,7 +14,7 @@ dependencies = [ ] [project.scripts] -renamer = "renamer.main:main" +renamer = "main:main" [tool.uv] package = true diff --git a/renamer/app.py b/renamer/app.py index 8cac7a4..c549166 100644 --- a/renamer/app.py +++ b/renamer/app.py @@ -13,9 +13,6 @@ from .formatters.proposed_name_formatter import ProposedNameFormatter from .formatters.text_formatter import TextFormatter -VERSION = "0.2.0" - - class RenamerApp(App): CSS = """ #left { diff --git a/renamer/formatters/proposed_name_formatter.py b/renamer/formatters/proposed_name_formatter.py index 5488d64..ab910ae 100644 --- a/renamer/formatters/proposed_name_formatter.py +++ b/renamer/formatters/proposed_name_formatter.py @@ -16,7 +16,6 @@ class ProposedNameFormatter: self.__frame_class = extractor.get("frame_class") or None self.__hdr = f",{extractor.get('hdr')}" if extractor.get("hdr") else "" self.__audio_langs = extractor.get("audio_langs") or None - # self.__special_info = f" [{SpecialInfoFormatter.format_special_info(extractor.get('special_info'))}]" if extractor.get("special_info") else "" self.__special_info = f" \[{SpecialInfoFormatter.format_special_info(extractor.get('special_info'))}]" if extractor.get("special_info") else "" self.__extension = extractor.get("extension") or "ext" diff --git a/renamer/screens.py b/renamer/screens.py index 32b4a97..0d0e00d 100644 --- a/renamer/screens.py +++ b/renamer/screens.py @@ -33,9 +33,14 @@ class OpenScreen(Screen): class HelpScreen(Screen): def compose(self): - from .app import VERSION + try: + from importlib.metadata import version + app_version = version("renamer") + except Exception: + app_version = "unknown" + help_text = f""" -Media File Renamer v{VERSION} +Media File Renamer v{app_version} A powerful tool for analyzing and renaming media files with intelligent metadata extraction.