Code Monkey home page Code Monkey logo

mto's Introduction

MTO is the "Magic" Torrent Organiser.


ARGUMENT

I wrote MTO to solve the problems that I experienced trying to get torrents into XBMC without ongoing manual intervention. My family have their torrents download on a headless Ubuntu machine in the roof, and a handful of XBMC machines around the house use this as a media source.

For XBMC to pull your torrents into the video library, at a minimum it needs the movies, TV shows, etc. to be separate. All GUI media managers that I have found, have a similar limitation. Even worse, torrents often have tricky naming schemes that XBMC will not recognise without custom regular expressions set. A pain! MTO is my attempt at filling the need for a "fully-automatic" media organiser that operates between your BitTorrent client and your media centre (XBMC!) or even just you when you use a file browser.


OVERVIEW

MTO looks at one or more downloaded torrents (or really any file or directory), and classifies each individual file in the torrent based on its name and path. It then creates symlinks to each classified file in the directories specified on the command line, leaving the originals untouched.

Leaving a torrent intact allows the BitTorrent client to continue seeding it while also sorting it into a predictable structure. The naming scheme used by MTO is easy on the eyes, preserves a lot of the information in the original filename, and is easily understood by XBMC with its default settings.

When run without the "--deletion-sandbox" option, MTO will delete all files in the "out" directories that it did not just classify. This means that if you just want to classify one new torrent into your destination without deleting all your existing symlinks, you should definitely use "--deletion-sandbox". If in doubt, use it anyway.


COOL THINGS

Some things that I think make MTO good:
- It leaves original torrents untouched.
- It is very flexible about naming schemes: very few false positives and false negatives.
- It works nicely on unfinished multi-file torrents, and can complete its work as more files are downloaded.
- It orphaned symlinks if you delete a torrent, change the naming policy, etc.
- It can run on a single torrent (e.g. as a Transmission torrent completion script).
- It can run on all the torrents in your downloads folder (e.g. as an hourly scheduled task).
- It uses regular expressions to extract usable information from every component of a file's path.
- It is structured around the easily-understood TorrentChild class, which should easily allow anyone familiar with Ruby to extend its capabilities.


USAGE

mto.rb is run from the command line using the arguments below. Apologies: the command line argument parsing is a bit delicate. You should be sure that you don't have any important files in the "out-dirs" before you tinker with MTO.

mto.rb [--creation-sandbox] [--deletion-sandbox] [--out-dir-X dir] torrent . . .

--creation-sandbox
	Don't create or replace any symlinks. Target paths are still calculated.

--deletion-sandbox
	Don't go through the destination directories looking for orphaned symlinks or misc files to delete. This should ALWAYS be used unless you are using MTO to classify ALL your torrents at once.

--out-dir-X dir
	Specifies that you want media of type X to be symlinked to in dir. Currently only --out-dir-movies and -out-dir-shows are supported. If a destination for a media type is not specified, then the symlinks are created in a directory called "movies" or "shows" in the current working directory.

Put the torrents themselves at the end of the command line. If you want to classify all the torrents in a folder, then use shell completion (*), as in the following example.


EXAMPLE 1 -- enough to get you started -- but cd to the program directory before you run

./mto.rb /path/to/downloads/*


EXAMPLE 2 -- try fiddling with the options a bit

./mto.rb --deletion-sandbox --out-dir-movies ~/Movies --out-dir-shows ~/Shows ~/Downloads/*

mto's People

Contributors

elliotnunn avatar

Stargazers

Daniel Grossmann-Kavanagh avatar akuiraz avatar

Watchers

 avatar

mto's Issues

A small clarification needed.

I just want to double check that I would use mto if I was running it manually and I use the mto-torrent for a script on Transmission as a finished script correct? Do they both need to exist, and do they need to be by each other?

Thanks for the great work!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.