Sortier is capable to sort any kind of tv-shows that one has ripped or downloaded. During the process, all video files will be renamed, sorted into folders named after the season they’re belonging to and saved wherever you desire. By that, it is possible to upload the files to your media server like Plex, Emby or others. These media centers need the correct naming convention in order to find all the metadata like posters, background images and other informations.
The seasons need to be in a folder called after the season.
For example:
Season 01
Also, the videos itself need to follow these kind of conventions. Files need to be named like this:
My New Show (2011) s01e01.mkv.
This very tool does all that for you.
- What it does
- Tested Operation Systems
- Installation
- Usage
- Commands
- Options
- Flags
- Configuration file
- The future
- Contributing to Sortie
- We Develop with Github
- We Use Github Flow, So All Code Changes Happen Through Pull Requests
- First Contribution
- Any contributions you make will be under the GNU-GPL-V3 Software License
- Report bugs using Github’s issues
- Write bug reports with detail, background, and sample code
- Use a Consistent Coding Style
- License
- References
- License
- About the name
Sortier is actual only tested with Mac OSX Catalina.
But should be running on any OS.
Tester wanted!
To install Sortier just copy the following line to your Terminal or command line:
pip3 install git+https://github.com/michaelgrossklos/sortier.git
I assume you have Python >= 3.7 already installed on your machine. If not, go to https://www.python.org/ and follow the instructions there.
First of all, it is important to know, that you always can use the
--help
option.
This will print something like this:
Usage: sortier [OPTIONS] COMMAND [ARGS]... Sorting your ripped or downloaded tv-shows into folders named after the seasons they're belonging to (f.e.: Season 01). Renames all files like "Name Of Show s01e01.ext" for direct use in your media center like Plex or Emby. So it can find all meta data needed. Options: -l, --language TEXT Sets the language for season names --debug / --no-debug Turn debug mode on --delete-folders BOOLEAN Delete the source folder after copying the file --help Show this message and exit. Commands: addextensions Extends the list of file extensions. destpath Changes the destination path permanently oripath Changes the origin path permanently settings Shows the actual settings titles The titles of the shows to be sorted.
As you can see in the first line, you first (and always) need to call the program itself by using sortier
.
After that you can specify options which usually begins with --
(two dashes).
Or (in some cases) also with just one -
.
This is just the short hand version of it.
The effect will be exactly the same.
For example -l
is the same as --language
.
All options are, well… optional ;)
Some of them requiring arguments to be passed in, some do not.
--delete-folders
for example is one that does not need any arguments.
Therefor it is called a flag.
Whereas --origin-path
in fact needs the path where all the video files are located.
On the other hand there are commands.
Those need to be typed after the options (if you’ve specified one).
Some of them are requiring arguments.
Some do not.
For Example settings
does not need any argument.
If you set one, you would get an error.
A complete line for using Sortier could look something like this:
sortier -l=en --delete-folders titles "my first show" "my second show"
sortier titles "my fisrt show" "my second show"
if you wouldn’t use any options.
❗
|
Important to know is, that you can’t use two commands at the same time, whereas you are able to use more than one option at ones. The order in which you specify the options does not matter. |
As you are able to change most of the settings, you need to know the actual state they’re in. Just type
sortier settings
without any arguments, and something like the following will get printed on the screen:
ACTUAL SETTINGS FOR SORTIER:
Regex for seasons: (s([0-9]{2})e[0-9]{2})
Origin/Source path: Downloads/extracted
Destination path: Downloads/extracted/SORTED
File extensions available: ['.mkv', '.avi', '.mp4', '.mov']
Languages available: ['de', 'en', 'es', 'fr', 'it', 'ru']
Language set: en
Season is called: Season
You can find more information on:
https://github.com/michaelgrossklos/sortier
The files to be renamed are only the video files that get stored into the destination folder.
In order to rename - and more importantly - find the right files, you need to provide the titles of the show. This command also starts the whole process. Any other command won’t.
You use it by typing:
sortier titles "My tv show 1" "My tv show 2"
Don’t use any placeholders for spaces. Write the title like you want the files get named. Capitalization will be ignored for finding the video files. But, it is important for the file and folder naming. The way you specify the titles here, the files and folder will get named.
Notice, that you are able to specify just one, or an unlimited amount of titles. You just need to wrap each title into quotation marks followed by a space. The order in which you define the titles is irrelevant.
This also means, that you can have multiple tv-shows including multiple seasons in your source folder.
As long as each episode is contained in its own folder and this folder is somehow named after the show.
For example:
/The.Show.S02E01.COMPLETE.English.DL.720p.BluRay.x264-UTOPiA/ /345-my.tv.show_2/ /dim-mytvshow.3-IFRIM/
The characters in between the words of the title itself, and surrounding it are not relevant at all. Sortier will find the title anyways.
How the video file itself is named, does not matter, as long as it holds the season and episode count.
For example
The.Show.S02E01.COMPLETE.English.DL.720p.BluRay.x264-UTOPiA.mkv
In which S02E01
means season 2, episode 1. Without that, Sortier is incapable of sorting the episodes and will stop running with printing out an error message.
Capitalization will be ignored.
Not always, but most of the time, are the provided default file extensions sufficient. If that is not the case you can extend the list of file extensions by using the commmand
sortier addextensions ".mpeg" ".webm"
Like the command title, you can specify just one or an unlimited amount of extensions. You just need to put a dot in front of the extension itself and wrap each extension into quotation marks followed by a space. The order in which you define those, is irrelevant.
The extension you’re adding, will get saved permanently. So, you don’t need to set them the next time you use Sortier.
There are two paths to be set. The origin path and the destination path.
This is the path where the ripped or downloaded files are to find at.
In the settings you’ll see the whole path.
Which by default is set to
Downloads/extracted
That is the relative path (from the users home directory) to your source folder, where all the files are in. You can set this path to any location under your users home directory, as long as one won’t need administrator rights to read from it. Most of the time, it will be your downloads folder or any subfolders beneath it. You just need to provide the parent folder that contains the folders of the video files.
Your folder structure could look something like this (assuming you’re on Mac OSX):
└── Users/ └── <user name>/ └── Downloads/ └── extracted/ ├── The.Show.S02E01.COMPLETE.English.DL.720p.BluRay.x264-UTOPiA/ │ └── The.Show.S02E01.COMPLETE.English.DL.720p.BluRay.x264-UTOPiA.mkv ├── The.Show.S02E02.COMPLETE.English.DL.720p.BluRay.x264-UTOPiA/ │ └── The.Show.S02E02.COMPLETE.English.DL.720p.BluRay.x264-UTOPiA.mkv ├── The.Show.S02E03.COMPLETE.English.DL.720p.BluRay.x264-UTOPiA/ │ └── The.Show.S02E03.COMPLETE.English.DL.720p.BluRay.x264-UTOPiA.mkv ├── Another.Show.S02E01.COMPLETE.English.DL.720p.BluRay.x264-UTOPiA/ │ └── Another.Show.S02E01.COMPLETE.English.DL.720p.BluRay.x264-UTOPiA.mkv ├── Another.Show.S02E02.COMPLETE.English.DL.720p.BluRay.x264-UTOPiA/ │ └── Another.Show.S02E02.COMPLETE.English.DL.720p.BluRay.x264-UTOPiA.mkv ├── ...└── Another.Show.S02E02.COMPLETE.English.DL.720p.BluRay.x264-UTOPiA.mkv
In which extracted
is the parent folder of all the video files.
All the video files will be copied to this path.
This path by default is set to
<your home directory>/Downloads/extracted/SORTED
It’s the same principal as of the origin path.
As mentioned above, the files will be sorted into folders named after the show and subfolders named after the seasons. This could look something like this:
└── Users/ └── <user name>/ └── Downloads/ └── extracted/ ├── The.Show.S02E01.COMPLETE.English.DL.720p.BluRay.x264-UTOPiA/ │ └── The.Show.S02E01.COMPLETE.English.DL.720p.BluRay.x264-UTOPiA.mkv ├── The.Show.S02E02.COMPLETE.English.DL.720p.BluRay.x264-UTOPiA/ │ └── The.Show.S02E02.COMPLETE.English.DL.720p.BluRay.x264-UTOPiA.mkv ├── The.Show.S02E03.COMPLETE.English.DL.720p.BluRay.x264-UTOPiA/ │ └── The.Show.S02E03.COMPLETE.English.DL.720p.BluRay.x264-UTOPiA.mkv ├── Another.Show.S02E01.COMPLETE.English.DL.720p.BluRay.x264-UTOPiA/ │ └── Another.Show.S02E01.COMPLETE.English.DL.720p.BluRay.x264-UTOPiA.mkv ├── Another.Show.S02E02.COMPLETE.English.DL.720p.BluRay.x264-UTOPiA/ │ └── Another.Show.S02E02.COMPLETE.English.DL.720p.BluRay.x264-UTOPiA.mkv ├── ... └── SORTED/ ├── The Show/ │ ├── Season 01/ │ │ ├── The Show - s01e01.mkv │ │ ├── The Show - s01e02.mkv │ │ ├── The Show - s01e03.mkv │ │ └── ... │ └── Season 02/ │ ├── The Show - s02e01.mkv │ ├── The Show - s02e02.mkv │ ├── The Show - s02e03.mkv │ └── ... └── Another Show/ └── Season 02/ ├── Another Show - s02e01.mkv ├── Another Show - s02e02.mkv └── ...
If you set the language, it really is not much what changes.
The only thing that changes is how the folder for the seasons gets named.
In English, it will be Season
.
In German Staffel
and in french Saison
and so on.
You can set the language by either use the long or the short version of this option.
--language en
or -l en
The default is German.
Abbreviation | Language | Season |
---|---|---|
en |
English |
Season |
de |
German |
Staffel |
fr |
French |
Saison |
it |
Italian |
Stagione |
ru |
Russian |
Sezon |
es |
Spanish |
Temporada |
💡
|
Actually, there is no functionality to permanently set the language. So you have to use it every time you use Sortier. |
According to this part of the Plex support site, one can use dates in tv-show titles if needed. This is the case for remakes for example. Or maybe for shows like Star Trek.
Those dates could be written with:
-
Dashes (2011-11-15)
-
Periods (2011.11.15)
-
Spaces (2011 11 15)
To actually use these the right way in the titles, you need to use:
--date "<date>"
In which <date>
gets substituted with the actual date.
The outcome looks like this:
SORTED/ └── Show Title - 2011-09-01/ └── Season 01/ ├── Show Title - s01e01 - 2011-09-01.mkv ├── Show Title - s01e02 - 2011-09-01.mkv ├── Show Title - s01e03 - 2011-09-01.mkv └── ...
❗
|
You only can use this for the whole tv-show. Not for single seasons or episodes. |
Flags are a kind of options. Unlike options, they don’t reseive any arguments. You just use the flag like so
--flag
If you use the flag
--delete-folders
all source folders will get deleted after the video file was copied.
|
Use this functionality with caution. |
During the installation, Sortier saves a small configuration file. The file format is JSON.
This is what it looks like initally:
{
"default_paths": {
"ORIGIN_PATH": "Downloads/extracted",
"DESTINATION_PATH": "Downloads/extracted/SORTED"
},
"FILE_EXTENSIONS": [
".mkv",
".avi",
".mp4",
".mov"
],
"LANGUAGES": {
"de": "Staffel",
"en": "Season",
"es": "Temporada",
"fr": "Saison",
"it": "Stagione",
"ru": "Sezon"
},
"REGEX": "(s([0-9]{2})e[0-9]{2})"
}
The default installation path is:
<users home directory>/.config/sortier/sortier.json
Where <users home directory>
gets substituted with the path to your users home directory.
The path depends on the operating system you are using.
On Windows for example, the path could look like this
C:\Users\<current user name>\.confing\sortier\sortier.json>
To change anything, you just need to open the file in a text editor. It doesn’t matter which one. But beforehand, you should know a little bit about JSON itself. You can find planty of informations here: https://www.json.org/json-en.html
If you don’t know what regex is, you’re probably not able to change that part. Because, if you do something wrong, Sortier won’t work anymore. This regex is the "code" that finds the seasons.
Normaly, one does not need to change that part.
Other than the regex, you pretty much can change anyting. Adding languages for example. As you already know, the file extentions can be changed via a command. But if you want, you can do it in this file. Afterwards it still is possible to use the commmand to change it.
|
Please do not change the location of the file. Because Sortier won’t work anymore. |
Well, after the launch is before the launch, isn’t it? So there are some additional features planed for future versions.
The TV Database (TheTVDB) is a free Service which provides lots of informations about tv-shows. Media centers like Plex getting there data (like posters, background images, descriptions, actors a.s.f.) from that website.
Luckily for us, it also has an API. So we are capable to get this data too. But the only thing we really need, is the correct title. Since the media server needs the right one according to TheTVDB, the tool could search for a title, given by the user and find the right one to be used for the folder and file names.
We love your input! We want to make contributing to this project as easy and transparent as possible, whether it’s:
-
Reporting a bug
-
Discussing the current state of the code
-
Submitting a fix
-
Proposing new features
-
Becoming a maintainer
We use github to host code, to track issues and feature requests, as well as accept pull requests.
We Use Github Flow, So All Code Changes Happen Through Pull Requests
Pull requests are the best way to propose changes to the codebase (we use Github Flow). We actively welcome your pull requests:
-
Fork the repo and create your branch from
master
. -
If you’ve added code that should be tested, add tests.
-
If you’ve changed APIs, update the documentation.
-
Ensure the test suite passes.
-
Make sure your code lints.
-
Issue that pull request!
To contribute to Sortier:
-
Clone the repository to your local machine:
git clone https://github.com/michaelgrossklos/sortier.git
-
Check out the
/master
branch:git checkout main
-
Create a new working branch for your changes:
git checkout -b branchname
-
Ensure the tests are passing.
-
Add the updated files to your commit:
git add .
-
Commit your changes:
git commit -m "Commit message here"
-
Push your changes:
git push
If git prompts you to set an upstream in order to push, use this command:
git push --set-upstream origin <branchname>
-
Create a pull request (PR) by navigating to github.com/michaelgrossklos/sortier/pulls and clicking on
New Pull Request
. Write an informative commit message detailing your changes and save your PR. If you haven’t yet finished the work you want to do, make sure you create a Draft PR by selecting it from the drop down box in the github web UI. This lets the reviewer know that you haven’t finished work yet, while still being transparent about what you are working on, and making sure we all understand current progress.
In short, when you submit code changes, your submissions are understood to be under the same GNU-GPL-V3 that covers the project. Feel free to contact the maintainers if that’s a concern.
Report bugs using Github’s issues
We use GitHub issues to track public bugs. Report a bug by [opening a new issue](); it’s that easy!
This is an example of a bug report briandk wrote, and I think it’s not a bad model. Here’s another example from Craig Hockenberry, an app developer.
Great Bug Reports tend to have:
-
A quick summary and/or background
-
Steps to reproduce
-
Be specific!
-
Give sample code if you can.
-
What you expected would happen
-
What actually happens
-
Notes (possibly including why you think this might be happening, or stuff you tried that didn’t work)
People love thorough bug reports. I’m not even kidding.
I’m again borrowing these from Facebook’s Guidelines
-
We’re using the PEP8 Style Guide for Python, with the following exceptions:
-
4 spaces for indentation rather than tabs
-
120 character line length
-
By contributing, you agree that your contributions will be licensed under its GNU-GPL-V3 License.
This document was adapted from the open-source contribution guidelines for Facebook’s Draft
Sortier: Sorting ripped or downloaded tv-shows into folders Copyright (C) 2021 Michael Grossklos ([email protected]) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see
Sometimes one asks: why this name?
In this case it is very simple and unspectacular.
"Sortieren" in German means "to sort".
So Sortier is so to speak, the noun for that.
Even thou, a noun for that verb does not exist in German.
One could see it a little different from that. Because "Tier" (SorTIER) in German means "animal". Which could be seen as "sorting animal", with a bit of phantasy.