Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

basic tutorial #143

Open
CouldBeThis opened this issue May 3, 2021 · 4 comments
Open

basic tutorial #143

CouldBeThis opened this issue May 3, 2021 · 4 comments

Comments

@CouldBeThis
Copy link

Hi, I wrote a short tutorial on how to use this, according to what I could figure out this evening.

I personally find it a lot easier to learn how to use things when there is a complete example rather than lists of arguments etc. You can see how everything fits together to have an effect and then how to construct whatever it is you are looking for yourself.

I'm sorry for not making a PR but I am not a developer, I struggle with basic git and I can tell that figuring out how to get through the black system would probably take me 2 days if I was lucky. No shade on your for working that way or anything it's just not for me. So if you would like to use this in any way you are welcome to it, or whatever parts of it are helpful. I can make changes if desired. I most frequently use a Mac so someone familiar with Linux/Windows should check for details. I tried to be inclusive where I was able.

I encountered a couple of problems, see strike-through and italicized.

Basic usage of mnamer

Here is a line which conforms as closely as possible to Official Kodi Wiki: Naming video files/TV shows with the caveat that it is not currently possible to obtain the year as specified. See below for explanation of each part and instructions to use followed by an example to see how files will be moved around.

mnamer "Downloads" --recurse --no-overwrite --no-guess --episode-directory "TV Shows (Organized)" --episode-format "{series}/Season {season:02}/{series} S{season:02}E{episode:02} - {title} ({date}).{extension}" --batch --test

General notes:

  • Windows users will need to change all / to \ [? I think ?]
  • If you need to stop mnamer (or any program) from running you can use - . (Mac) or ctrl - c (Linux) [windows ???] to forcibly stop it. [[actually this didn't seem to work, not sure if there is a reason or not]]

Detailed explanation

  • "Downloads" - runs the command in a folder called Downloads which is located in the current directory. The target folder must be the first argument in the line.
    • To run in the current directory itself, replace with .
  • --recurse - search for files within nested directories.
    • If you only want to tidy up loose files not already in a directory, remove this.
  • --no-overwrite - prevent relocation if it would overwrite a file.
  • --no-guess - If it's not certain about
  • --episode-directory "../TV Shows (Organized)" - set episode relocation directory relative to the working directory (in the case of this example, .). The ../ tells it to move up one level from the current directory. If the directory does not exist, it'll be created.
  • --episode-format "{series}/Season {season:02}/{series} S{season:02}E{episode:02} - {title} ({date}).{extension}" - translates as "Series Name/Season 00/Series Name S00E00 - Episode Title (YYYY-MM-DD).ext". With YYYY-MM-DD being the air date for the individual episode.
  • --batch - the program will do all it's business automatically once you let it run. Remove this and it will tell you each change it wants to make and provide an option to accept/reject the change, or quit.
  • --test - this tells the application not to actually do anything. It will instead merely print a list of changes it would make to the terminal, so you can check everything is in order. Once you are sure everything is doing what it should, run the command again with --test removed.
    • If you have a lot of files, you might want to add a limit to how many will be processed, especially when you are drafting your command. Adding --hits=10 will only process the first 10 files. You can increase the number or remove it as you become more confident. I couldn't actually get this to work.

Example

Before:

.
└── Downloads
    ├── Pose.S01E01.720p.HDTV.x264-AVS.mkv
    ├── Pose.S01E02.720p.HDTV.x264-AVS.mkv
    ├── The Kids in the Hall - S02E18 - #218.mp4
    ├── The Kids in the Hall - S02E19 - #219.mp4
    ├── The Kids in the Hall - S02E20 - #220.mp4
    ├── The Kids in the Hall - S03E01 - #301.mp4
    ├── The Kids in the Hall - S03E02 - #302.mp4
    ├── The Kids in the Hall - S03E03 - #303.mp4
    ├── The.Flight.Attendant.S01E02.WEBRip.x264-ION10
    │   ├── Subs
    │   │   └── 2_English.srt
    │   └── The.Flight.Attendant.S01E02.WEBRip.x264-ION10.mp4
    └── The.Flight.Attendant.S01E03.WEBRip.x264-ION10
        ├── Subs
        │   └── 2_English.srt
        └── The.Flight.Attendant.S01E03.WEBRip.x264-ION10.mp4

After:

.
├── Downloads
│   ├── The.Flight.Attendant.S01E02.WEBRip.x264-ION10
│   │   └── Subs
│   └── The.Flight.Attendant.S01E03.WEBRip.x264-ION10
│       └── Subs
└── TV Shows (Organized)
    ├── Pose
    │   └── Season 01
    │       ├── Pose S01E01 - Pilot (2018-06-03).mkv
    │       └── Pose S01E02 - Access (2018-06-10).mkv
    ├── The Flight Attendant
    │   └── Season 01
    │       ├── The Flight Attendant S01E02 - Rabbits (2020-11-26).en.srt
    │       ├── The Flight Attendant S01E02 - Rabbits (2020-11-26).mp4
    │       ├── The Flight Attendant S01E03 - Funeralia (2020-11-26).en.srt
    │       └── The Flight Attendant S01E03 - Funeralia (2020-11-26).mp4
    └── The Kids in The Hall
        ├── Season 02
        │   ├── The Kids in The Hall S02E18 - 218 (1991-04-16).mp4
        │   ├── The Kids in The Hall S02E19 - 219 (1991-04-23).mp4
        │   └── The Kids in The Hall S02E20 - 220 (1991-04-30).mp4
        └── Season 03
            ├── The Kids in The Hall S03E01 - 301 (1991-10-01).mp4
            ├── The Kids in The Hall S03E02 - 302 (1991-10-08).mp4
            └── The Kids in The Hall S03E03 - 303 (1991-10-15).mp4

The Downloads directory still has empty folders from "The Flight Attendant", but those can be safely deleted.

Moving forward

Once you are comfortable with the way mnamer is working, you might like to check out the wiki sections on creating a config file and automation.

@M4CC
Copy link

M4CC commented Feb 19, 2023

I just made a post about having this included in the documentation. Please consider it. Thank you for the tutorial!

@CouldBeThis
Copy link
Author

I totally forgot I ever wrote the above!

For anyone who comes across this in the search, @M4CC's related issue is #232.

@brizzbane
Copy link

brizzbane commented Feb 9, 2024

I'm new to mnamer, trying to get away from FileBot and get something open source. Is there a way to prevent deletion of original file, i.e. copy original to episode directory while leaving the original (for seeding)?

[edit]: I found I can get it to do what I want by changing

move(str(self.source), destination_path) to copy(str(self.source), destination_path) in target.py

@CouldBeThis
Copy link
Author

@brizzbane I once again forgot about this but I'm glad you reminded me because it's a problem I was trying to solve again recently. Couldn't shake the feeling I'd already found a solution but also couldn't remember what it was.

So haven't touched it in quite a while. But maybe a symlink would be a better idea? With a symlink it would appear there are 2 copies of the file but there would only actually be 1 copy so you aren't wasting your disk space by doubling everything.

What OS are you using? On linux or Mac OS symlinks are created with ln -s (file or directory) or ln (files only, not directories).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants