Skip to content

hanshsieh/media_renamer

Repository files navigation

Plex Media Renamer (Flutter)

A cross-platform Flutter application for renaming TV show video and subtitle files to Plex-compliant format.

Features

  • Batch rename media files to Plex naming convention
  • Support custom file pattern matching using Regular Expressions
  • Episode offset support (e.g., episode N → N + 12)
  • Custom naming format with named groups
  • Preview functionality before executing rename
  • Support for video and subtitle modes
  • Auto-save preferences
  • Multi-language support (Traditional Chinese, Simplified Chinese, English)

Platforms

  • Windows
  • macOS
  • Linux

Project Structure

lib/
├── main.dart                          # Application entry point
├── config/                            # Application configuration
│   └── dependencies.dart              # Dependency injection (Riverpod providers)
├── domain/                            # Domain Layer - Business logic core
│   ├── models/                        # Domain models
│   │   ├── rename_config/            
│   │   │   └── rename_config.dart
│   │   └── file_rename_operation/
│   │       └── file_rename_operation.dart
│   ├── services/                      # Domain services
│   │   └── plex_naming_util.dart
│   └── use_cases/                     # Use cases
│       └── rename/
│           ├── preview_renames_use_case.dart
│           └── execute_rename_use_case.dart
├── data/                              # Data Layer
│   ├── repositories/                  # Repositories
│   │   └── preferences_repository.dart
│   └── services/                      # Data services
│       └── file_renamer_service.dart
├── routing/                           # Routing configuration
│   └── router.dart
└── ui/                                # UI Layer
    ├── rename/                        # Rename feature UI
    │   ├── rename_view.dart
    │   ├── view_models/
    │   │   └── rename_viewmodel.dart
    │   └── widgets/                   # UI widgets
    │       ├── mode_selector_widget.dart
    │       ├── directory_selector_widget.dart
    │       ├── file_pattern_field_widget.dart
    │       ├── show_name_field_widget.dart
    │       ├── title_format_field_widget.dart
    │       ├── subtitle_fields_widget.dart
    │       ├── season_offset_fields_widget.dart
    │       ├── action_buttons_widget.dart
    │       ├── error_message_widget.dart
    │       └── preview_table_widget.dart
    └── core/                          # Core UI components
        ├── themes/
        │   └── theme.dart
        └── localization/
            └── strings.i18n.dart      # Generated by slang

Architecture

This project follows MVVM (Model-View-ViewModel) architecture with Clean Architecture principles:

  • Domain Layer: Business logic, domain models, and use cases
  • Data Layer: Repositories and data services
  • UI Layer: Views, ViewModels, and widgets
  • Config Layer: Dependency injection configuration

Getting Started

Prerequisites

  • Flutter SDK (>=3.0.0)
  • Dart SDK

Installation

  1. Navigate to the project directory:
cd media_renamer
  1. Install dependencies:
flutter pub get
  1. Generate slang localization files:
dart run slang
  1. Generate freezed and json_serializable code:
flutter pub run build_runner build --delete-conflicting-outputs
  1. Run the app:
flutter run -d windows  # or macos, linux

Localization

Supported languages:

  • Traditional Chinese (繁體中文)
  • Simplified Chinese (简体中文)
  • English

Localization files are located in assets/translations/ and generated code is in lib/ui/core/localization/.

Technologies Used

  • Flutter - UI framework
  • hooks_riverpod - State management
  • flutter_hooks - React-like hooks for Flutter
  • freezed - Code generation for immutable classes
  • slang - Localization
  • go_router - Routing
  • shared_preferences - Local storage

Import Guidelines

  • Third-party packages: Use package: imports
  • Internal files: Use relative path imports

Example:

// Third-party
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';

// Internal - relative path
import '../../core/localization/strings.i18n.dart';
import '../view_models/rename_viewmodel.dart';

License

This project is for personal use only.

About

A simple tool to help you rename the video files for Plex

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors