media-organize v2.0.0
media-organize
A CLI utility for organizing your media collections via symbolic links.
ā
Auto-detect šŗ Series, š Anime and š¬ Movies
ā
No dependencies on external web services!
ā
Extract Season/Episode Numbers
ā
File Watcher š links new files
ā
Unlinks ā deleted files
ā
Customizable Naming Format
ā
Powerful Nunjucks Templating
ā
Multiple Directory Support
ā
Logging & File Rotation
This plugin will never move or delete your media files, because that's your (or your torrent client's) job!
Installation
Requirements:
- NodeJS 12+
Install from NPM
npm i -g media-organize
Install from Source
git clone https://github.com/tgxn/media-organize
cd media-organize
npm install -g .
Usage
orgMedia
run media organization
Commands:
orgMedia run run media organization [default]
orgMedia watch start media watchers [aliases: w]
Options:
--help Show help [boolean]
--version Show version number [boolean]
-d, --data app data directory [string] [default: "~/.orgMedia"]
-l, --log enable logging to data directory [boolean] [default: true]
-q, --quiet hide console log output [boolean] [default: false]
Automatic Methods
CRON (Regular Runs)orgMedia
Watcher/Screen (creates a screen named media_watcher
watching your media)screen -S media_watcher -dm orgMedia watch
Configuration
Config file is config.json
and has the following mandatory properties:
Option | Purpose | Example |
---|---|---|
directories | Array of directories to scan | ["../series"] |
targetPath | Target directory for sorted files | ../sorted |
targetFormat | Naming format of the output links | See below for details |
And the following non-mandatory options:
Option | Default | Purpose |
---|---|---|
enabled | true | |
allowedExtensions | * | Array Extension to allow, (empty or omitted for all) |
ignoredExtensions | None | Array Extensions to ignore |
linkSubtitles | false | Should subtitle files be copied alongside media files? |
subtitleExtensions | None | Extensions to link with media |
useHighestQuality | false | Should a higher-quality release replace a lower one? |
strictType | None | Whether this config block should only accept movies or series |
allowedSize | None | Array Minimum and Maximum (if required) file sizes, in MB. [50, 5000] |
You can also specify an array of config objects if you have different file types/directories to scan.
See config.example.json
for further example configurations.
targetFormat
usable variables
This is a list of the basic metadata that should be available on each media item.
Variable | Value | Example |
---|---|---|
{{name}} | Series/Show/Movie Name | Name |
{{season}} | Season Integer | 10 |
{{episode}} | Episode Integer | 34 |
{{year}} | Year Integer | 2021 |
{{extension}} | File Extension | .mkv |
{{classifier}} | Meta The classifier used to detect the media type. |
caseFormat
filter
This filter will automatically use the Case library to format a string.
Usage:{{ name | caseFormat('capital') }}
Example:{{ 'foo_v_bar' | caseFormat('capital') }} -> 'Foo V Bar'
appendYear
filter
This filter will automatically append the year (in brackets) at the end of the given string.
Note: Always use
appendYear
aftercaseFormat
(or other filters that modify the title) so that you don't modify the year.
Usage:{{ name | appendYear }}
Example:{{ 'name' | appendYear }} -> 'name (2021)'
normal
filter
This filter will automatically strip non-filename-safe characters.
Specifically:
#%&{}/\<>^*?$!'":+|@=`