mediasort ========= Webapp for quick or automatic media sorting and integration with the Deluge torrent client. configuration ------------- Using a configuration file is recommended due to the complexity of the information needed. An example config is shown and explained below: ``` { "port": 8081, "debug": true, "library_path": "/media/raid/Media/TV/HD/", "label": "sickrage", "label_done": "sorted", "stashprefix": "Sorted", "deluges": [ { "name": "T2", "uri": "deluge://user:pass@localhost:58846", "pathmap": ["/media/storage", "/media/raid/Torrents/Torrent1"] }, { "name": "T5", "uri": "deluge://user:pass@otherhost.com:58846", "pathmap": ["/media/storage", "/media/raid/Torrents/Torrent2"] } ], "trackermap": { "empirehost.me": "ipt" }, "movedests": [ "Complete", "SBComplete", "Sorted/ipt" ] } ``` Basic options |key|meaning|example| |---|---|---| |port|http port to listen on|`8081`| |debug|run the server in debug mode|`true`| |library_path|file path to tv media library|`/data/library`| |label|deluge label to look for sortable torrents under|`"sickrage"`| |label_done|deluge label to mark sortable torrents as|`"sorted"`| |stashprefix|when stashing torrents, prefix for the stash path|`"Sorted"`| Beyond these options, mediasort has several more options to tune how it sorts your media that require more explanation. Details about client instances are list under the `deluges` key. Each client requires a deluge connection string (a uri starting with deluge://) and a pathmap. The pathmap is explained later. Next, `library_path` should be set to your media library's path. The media library must contain top level directories for each show, matchingly named. The name of the directory will be used to determine what show to put in it. In each show directory, there should be one directory per season (such as "Season 6" or "2019") within which the actual media files are placed. Per client, `pathmap` must be set to translate paths when sorting files. This would be needed if your torrent client has a different view of the filesystem than `mediasort` does, e.g. if they're running in docker containers. Consider these two paths: * `/media/storage/mylibrary/myshow/Season 5/episode.mkv` * `/data/torrents/Complete/myshow.mkv` The first is the destination path in your media library as seen by mediasort. The second is the path Deluge sees. Setting `pathmap` to `/data/torrents/:/media/storage/torrents/` gives mediasort the info it needs to resolve these paths - it translates the Deluge path by simply replacing the prefix obtained from the left half of the `pathmap` with the right. Finally, `movedests` provides a list of pre-filled destinations that Deluge may move files to after they're sorted. These paths are appended to the left side of the pathmap. After a torrent is sorted into your library, the torrent will "stashed", that is, moved to a directory other than your default download location as well as labeled as such. Within the stash directory, the torrents are placed in another subdirectory matching the hostname of the torrent's tracker. Optionally, these names can be translated to another name with the values specified in `trackermap`. For example, having the `trackermap` entry `"foo.com": "foo",` would cause the "foo.com" tracker directory to be named "foo" instead. todo ---- * support full configuration through cli flags again * support env vars in addition to command line flags for full configuration * support re-labeling sorted torrents * more options than just hard linking (soft link, copy) * support sorting season torrents * make UI pretty * support post-sort webhooks e.g. to tell plex to rescan when we add something - maybe push and email too