How I synced two directories

I’d like to share what I have done on my Vero2.
I 've a plugin that can download TV shows links in a specific addon’s settings directory and I cannot change it.
I undestood OSMC cannot change the media directories like “TV Shows”.
The only way to solve it, for me was to sync the two directories.
I connect my Vero through ssh and I did as follow.

a) sudo apt-get update
b) sudo apt-get install lrsyncd vim

after lrsyncd, vim and all dependencies were installed:
c) mkdir /etc/lsyncd
d) mkdir /var/log/lsyncd
e) touch /var/log/lsyncd/{lsyncd.log,lsyncd-status.log}

and then the configuration:
f) sudo vim /etc/lsyncd/lsyncd.conf.lua

and I did something like this:

settings {
    logfile = "/var/log/lsyncd/lsyncd.log",
    statusfile = "/var/log/lsyncd/lsyncd-status.log",
    statusintervall = 20,
nodaemon = false,
maxProcesses = 5,
maxDelays = 0
}

sync{
        default.direct,
        delete=false,
        source="_/your source dir_",
        target="/home/osmc/TV\ Shows/",
        rsync = {
                archive = true,
                verbose = true,
                hard_links = true
        }
}

I saved the file and quit.

I finally started lrsyncd:

g) lsyncd /etc/lsyncd/lsyncd.conf.lua

Everything seems working. Now, when I download something in the source directory, this is copied into the /home/osmc/TV\ Shows/.

I hope this could be useful.

Season’s greatings.

I’m not sure why this is necessary. When adding a source in Kodi for TV Shows or any other media type, any directory on the system may be choosen. It should be no problem to point it at your “specific addon’s settings directory”.

lsyncd can be pretty useful, but I’ve seen some problems with it if the connection is not completely reliable. It’s probably good enough for a home environment.

Assuming you just wanted to change the location of a file, or the perceived location, you could use a symbolic link, which would save you a lot of space and work just as well.

1 Like

@Giubeca
In addition to what @ActionA said…

You can also configure MULTIPLE directories under a single source.

For example:
To keep things organized on my drives, I have homemade videos, workout videos, movies, etc. in separate directories.
While most of my files are on a networked drive, I’ve also got a few files on a local drive.

I have the multiple directories the contain the Workout videos and homemade videos, configured as a single source setup as a TV shows.

http://kodi.wiki/view/Adding_video_sources