-
-
Notifications
You must be signed in to change notification settings - Fork 8
Configuration
Make sure to edit the .env
file before running the script. Below are the configurable variables used in the script, along with their descriptions and default values:
Variable | Description | Default Value |
---|---|---|
SOURCE_DIR |
The directory path where the source files are located. Multiple directories can be specified, separated by commas. Use \ for Windows paths. |
/path/to/files |
DESTINATION_DIR |
The path to the destination directory where the symlinks or files will be placed. Use \ for Windows paths. |
/path/to/destination |
LOG_LEVEL |
Defines the level of logging. Available options: DEBUG , INFO , WARNING , ERROR , CRITICAL . |
INFO |
CINESYNC_LAYOUT |
Files will be separated only into 'Movies' and 'Shows' directories under the destination path | `false' |
CUSTOM_SHOW_FOLDER |
Custom folder name for TV shows. This will be used only if CINESYNC_LAYOUT=true. Leave empty to use the default path. | ` CineSync/Shows' |
CUSTOM_MOVIE_FOLDER |
Custom folder name for movies. This will be used only if CINESYNC_LAYOUT=true. Leave empty to use the default path. | `CineSync/Movies' |
USE_SOURCE_STRUCTURE |
The original folder structure from the source directory will be preserved | `false' |
RENAME_ENABLED |
Enable or disable file renaming functionality based on TMDb data. | false |
RENAME_TAGS |
Specify which tags from predefined categories to include in the filename. Categories include: VideoCodec, AudioCodec, AudioAtmos, DynamicRange, AudioChannels, Resolutions, MovieVersions, StreamingServices, ValidLanguages Leave empty to disable additional tag inclusion in filenames. | Resolutions |
RCLONE_MOUNT |
The system will verify if directories are properly mounted via rclone and wait for mount points to become available before processing. This is useful when working with remote storage mounted via rclone | false |
TMDB_API_KEY |
Your TMDb API key (short version, not the full read access token). Obtain this key from your TMDb account settings. | your-api-key |
ANIME_SCAN |
The system will apply specialized rules for identifying and processing anime files. | false |
TMDB_FOLDER_ID |
Uses TMDB folder id structure. | false |
IMDB_FOLDER_ID |
Uses IMDB folder id structure. | false |
TVDB_FOLDER_ID |
Uses TVDB folder id structure. | false |
MOVIE_COLLECTION_ENABLED |
Enable or disable separating movie files based on collections. When true, movies will be organized into folders according to their collections (e.g., Harry Potter series). | false |
RELATIVE_SYMLINK |
Create relative symlinks instead of absolute symlinks. When true, symlinks will use relative paths. | false |
MAX_PROCESSES |
Set the maximum number of parallel processes for creating symlinks. Increase this number to speed up processing if you have a multi-core CPU. Set to 1 for single-threaded processing to minimize system load. | 1 |
SKIP_EXTRAS_FOLDER |
Enable or disable the creation and processing of extras folder files. When true, files meant for the 'Extras' folder will be skipped. | true |
EXTRAS_MAX_SIZE_MB |
Maximum allowed file size for extras in MB. Files larger than this limit will not be considered as extras. | 250 |
SLEEP_TIME |
Sleep time (in seconds) for real-time monitoring script. Determines how frequently the script checks for changes in watch directories. | 60 |
RCLONE_MOUNT |
Enable or disable rclone mount verification. When true, the system will verify if directories are properly mounted via rclone and wait for mount points to become available before processing. Useful for remote storage. | false |
MOUNT_CHECK_INTERVAL |
Interval (in seconds) for checking rclone mount availability. Only relevant when RCLONE_MOUNT=true . |
30 |
SKIP_ADULT_PATTERNS |
Enable or disable skipping specific file patterns. When true, files matching patterns defined in utils/keywords.json will be excluded. |
true |
ENABLE_PLEX_UPDATE |
Enable or disable Plex library updates. When true, Plex will be notified to scan for new content after files are processed. | false |
PLEX_URL |
URL of your Plex Media Server. Example: http://localhost:32400 or https://plex.example.com:32400
|
your-plex-url |
PLEX_TOKEN |
The authentication token for your Plex Media Server. Obtain this token from the Plex settings. | your-plex-token |
Variable | Description | Default Value |
---|---|---|
DB_THROTTLE_RATE |
Throttle rate for database operations (requests per second). Higher values may increase performance but also resource usage. | 100 |
DB_MAX_RETRIES |
Maximum number of retries for database operations in case of failure. Set to 0 to disable retries. | 10 |
DB_RETRY_DELAY |
Delay (in seconds) between retry attempts for database operations. | 1.0 |
DB_BATCH_SIZE |
Batch size for processing records from the database. Increasing this value can improve performance but may use more memory. | 1000 |
DB_MAX_WORKERS |
Maximum number of parallel workers for database operations. Adjust this value based on your system’s capabilities. | 4 |
-
SOURCE_DIR
: Full path to the directory containing input files- Example:
/mnt/media/incoming
orC:\Downloads\Media
- Example:
-
DESTINATION_DIR
: Full path where processed files will be organized- Example:
/mnt/media/library
orD:\Media\Organized
- Example:
- Type: Boolean
-
Default:
false
- Description: Determines file organization method
-
Options:
-
true
: Preserves original folder structure from source -
false
: Organizes files into predefined resolution-based folders
-
- Type: Boolean
-
Default:
false
- Description: Simplified directory organization
-
Options:
-
true
: Separates files into 'Movies' and 'Shows' directories -
false
: Uses more detailed organization method
-
Example Configurations:
# Preserve original structure
USE_SOURCE_STRUCTURE=true
# Simple Movies/Shows layout
CINESYNC_LAYOUT=true
- Description: Controls verbosity of application logging
-
Options:
-
DEBUG
: Most detailed logging -
INFO
: Standard information messages -
WARNING
: Only warnings and errors -
ERROR
: Critical errors only -
CRITICAL
: Extremely severe errors
-
Example:
LOG_LEVEL="INFO" # Recommended for most users
- Type: Boolean
- Description: Enables verification of remote storage mount points. Prevents symlink deletion if mount suddenly disconnects.
- Use Case: Useful for cloud storage or network-mounted drives
- Type: Integer (seconds)
- Description: Frequency of checking mount point availability
- Recommendation: Balance between responsiveness and system load
Example Configuration:
RCLONE_MOUNT=true
MOUNT_CHECK_INTERVAL=30 # Check every 30 seconds
- Description: API key for accessing TMDb services
- Requirement: Must obtain from TMDb Developer Portal
- Type: Boolean
- Description: Enables specialized scanning for anime files
- Useful for: Anime collections with unique naming conventions
-
TMDB_FOLDER_ID
: Organize folders using TMDb IDs -
IMDB_FOLDER_ID
: Organize folders using IMDb IDs -
TVDB_FOLDER_ID
: Organize folders using TVDB IDs for shows -
RENAME_ENABLED
: Enable file renaming based on metadata
- Description: Specify additional tags to include in filename
-
Available Categories:
-
VideoCodecs
: e.g., x264, x265, H.264 -
AudioCodecs
: e.g., AAC, DTS, AC3 -
AudioAtmos
: Dolby Atmos indicator -
DynamicRange
: HDR, SDR -
AudioChannels
: 5.1, 7.1 -
Resolution
: 720p, 1080p, 4K -
MovieVersions
: Director's Cut, Extended -
StreamingServices
: Netflix, Amazon -
Languages
: EN, FR, JP, etc ..
-
Rename Tag Examples:
RENAME_TAGS=TMDB
RENAME_TAGS=VideoCodec,DynamicRange,AudioChannels
RENAME_TAGS=VideoCodec,AudioCodec,AudioAtmos,DynamicRange,AudioChannels,Resolution,Languages,TMDB/IMDB (Use either tmdb or imdb based on folder id)
Bird.Box.Barcelona.2023.1080p.NF.WEB-DL.ENGLISH.HINDI.DDP5.1.Atmos.HDR-DV.H.265-GOPI SAHI.mkv
-
Output:
'Bird Box Barcelona (2023) {tmdb-805320}.mkv'
- Description: Uses only TMDb ID, stripping most original metadata
-
Output:
Bird Box Barcelona (2023) [1080P].mkv
- Description: Highlights the video resolution
3. Comprehensive Configuration: RENAME_TAGS=VideoCodec,DynamicRange,AudioCodec,AudioChannels,StreamingServices,Languages
-
Output:
Bird Box Barcelona (2023) [H265] [HDR] [ATMOS] [DDP5.1] [NF] [EN+HI].mkv
-
Breakdown:
-
H.265
: Video Codec -
HDR-DV
: Dynamic Range (HDR with Dolby Vision) -
DDP5.1
: Audio Codec and Channels (Dolby Digital Plus 5.1) -
NF
: Streaming Service (Netflix) -
[EN+HI]
: Languages
-
-
Output:
Bird Box Barcelona (2023) [EN+HI].mkv
- Description: Emphasizes language and source details
- Type: Boolean
- Description: Organize movies into collection folders
- Example: Harry Potter series files in a dedicated folder
- Type: Boolean
- Description: Create symlinks with relative paths
-
Recommended:
true
for better portability
- Type: Integer
- Description: Maximum parallel symlink creation processes
-
Recommendations:
- Multi-core CPU: Higher values (4-8)
- Single-core/Low-power: Keep at 1-2
-
SKIP_EXTRAS_FOLDER
: Skip processing of extras files -
EXTRAS_MAX_SIZE_MB
: Maximum file size considered as an extra
-
SKIP_ADULT_PATTERNS
: Filter out specific content types using predefined patterns
-
SLEEP_TIME
: Interval between directory change checks
-
DB_THROTTLE_RATE
: Database operation rate limit -
DB_MAX_RETRIES
: Retry attempts for failed operations -
DB_BATCH_SIZE
: Record processing batch size -
DB_MAX_WORKERS
: Parallel database processing threads
- Description: Controls the rate at which database operations are performed, measured in requests per second.
-
Example:
- If
DB_THROTTLE_RATE
is set to1
, the script will make one database operation every second. - This helps control the load on the database, especially in cases where it's accessed over a network.
- If
- Description: Defines the number of records to process at once during each database operation.
-
Example:
- If
DB_BATCH_SIZE
is set to10
, the script will process 10 records at once in each database operation. - Larger batch sizes increase performance but require more memory.
- If
- Description: Defines how many times the script will retry a failed database operation.
-
Example:
- If
DB_MAX_RETRIES
is set to10
, the script will attempt to retry a failed operation up to 10 times. - If set to
0
, no retries will occur.
- If
- Description: The time in seconds to wait before retrying a failed database operation.
-
Example:
- If
DB_RETRY_DELAY
is set to1.0
, the script will wait 1 second before retrying the operation.
- If
- Description: Defines how many parallel workers the script will use to perform database operations.
-
Example:
- If
DB_MAX_WORKERS
is set to4
, up to four parallel workers will handle database operations, speeding up processing on systems with multiple CPU cores.
- If
DB_THROTTLE_RATE = 1 # Limits the processing to one batch per second.
DB_BATCH_SIZE = 1 # Only one file is processed per batch.
-
Outcome:
- The system will process 1 file every second, with a retry limit of 1 and a 1-second delay between retries.
DB_THROTTLE_RATE = 1 # Limits the system to one batch per second.
DB_BATCH_SIZE = 10 # Each batch contains 10 files, so 10 files are processed per second.
-
Outcome:
- The system processes 10 files per second in a single batch, with retries and delays applied as configured.
By adjusting DB_THROTTLE_RATE
and DB_BATCH_SIZE
, you can:
- Control the rate at which data is processed.
- Manage system load on both the database and the script itself.
- Optimize performance by balancing speed with resource usage.
Adjusting DB_MAX_WORKERS
and DB_MAX_RETRIES
can help in achieving optimal parallel processing and ensuring that temporary failures are handled effectively.
Pro Tip: Always test configurations in a controlled environment before full deployment!