Coder Social home page Coder Social logo

tvshoworganizer's Introduction

TV Show Organizer

This is a little ruby tool to automatically rename TV Show video files (according to my naming preference) and move them to the appropriate directory (appropriate for XBMC/Kodi).

Features

This took takes an input folder and output folder, then it:

  • looks for files with extension mp4,m4v,avi or mkv in the input folder (discarding filenames containing Sample)
  • parses the file name to extract the TVShow name, season number and episode number.
    (To do that, it expects the file name to match Show.Name.S01E02.Anything.ext)
  • fetches the name of the episode using TheTVDB API
  • renames the file to Show Name - 1x02 - Episode Title.ext and moves it to the subfolder Show Name/Season 1/ of the output folder.

Once every video files of the input folder have been moved and renamed appropriately, it finally uses Kodi's JSON-RPC API to refresh the Kodi database, so that those shows appear in your Kodi library.

Usage

  1. the TheTVDB API needs an API Key to use it. You need to get one and write it to a file named thetvdb.apikey saved next to the other files so that the script can use it.
  2. Then use tvshows_organizer.rb as the entry point, invoked either from ruby code (using TVShowsOrganizer module) or from the command line

Invoke from ruby

require 'tvshows_organizer'
# Search the TheTVDB's show ID of a given show
TVShowsOrganizer::run_query(:query => 'Game of Thrones')
# Add a show to the shows.yml database
TVShowsOrganizer::add_show(:name => 'Game of Thrones', :id => '121361')
# Move video files to destination, renaming them appropriately.
TVShowsOrganizer::move_files(source_dir, dest_dir, :interactive => true, :kodi_auth => 'login:pass')

Invoke from the command line

Use tvshows_organizer.rb --help to know how to use it and which options are available.

# Search the TheTVDB's show ID of a given show
$ ./tvshows_organizer.rb -q "House of Cards"
# Add a show to the shows.yml database: use query + interactive mode
$ ./tvshows_organizer.rb -qi "House of Cards"
# Move video files to destination, renaming them appropriately.
$ ./tvshows_organizer.rb -i source_dir dest_dir --kodi login:pass

tvshoworganizer's People

Contributors

alisoftware avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

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.