Giter VIP home page Giter VIP logo

kodisync's Introduction

Kodisync

This is a hacky Node script which attempts to sync playback of two or more Kodi instances.

It will wait until all Kodi instances have the same TV show episode loaded (by matching show name, season number, episode number if available; otherwise media title or filename) and then pause everybody's playback and seek them all to the earliest position among the viewers.

From there it checks intermittently for state changes (play, pause, seek), and attempts to sync them to the other instances.

Status

Rough around the edges.

The main issue is that without any kind of event-driven API we have to resort to polling.

Operation

When any instance seeks while playing or presses play from a paused state, we pause all instances temporarily, including the one where the action took place. The other instances are then told to seek to that position. However, seeking in Kodi seems to be inaccurate even when two instances are playing exactly the same file, and so they may not be in exactly the same positions. To mitigate this, the commands to play are staggered based on the newly-reported position of each instance.

When an instance is paused or seeks while paused, all other instances are told to pause and seek to that position.

Requirements

It expects to talk to each Kodi instance's JSON-RPC server, so each Kodi instance must have this enabled and you must have network access to it.

In Kodi you should only need to switch on settings → service settings → control → allow remote control via HTTP; no need for "application control".

You could set up an SSH tunnel or ngrok if you need to get through firewalls or similar.

As for dependencies, you can install them with npm install.

Running

Invoke the script and give the hosts (and ports if not 8080) of the Kodi servers as arguments.

node kodisync.js localhost my.friends.server:1234

You can also use Docker:

sudo docker build -t kodisync .
sudo docker run --rm -it --init kodisync 172.17.0.1 my.friends.server:1234 #172.17.0.1 is the loopback IP address of docker.

It will automatically add http:// if no protocol is given, and will add /jsonrpc if no path is given.

kodisync's People

Contributors

tremby avatar lpapadakos avatar rubennl 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.