KODI

Adding VIDFLTR to KODI

Because I'm a lousy (Python) programmer adding VIDFLTR to KODI (formerly known as XBMC) involves a view maybe a litlle bit unusual steps:
I implemented it as a rsync'able music video source and not as an addon, doh!

Needed addons: Vimeo, Youtube and for a few (~70) videos Dailymotion and Vevo.

As of September 2016 the Youtube- and Vimeo-Addons from the official KODI-Repository should work. You can get the Vevo- and Dailymotion-Addons from the above links (Also install script.module.t1mlib from KODI-Repo, otherwise plugin.video.myvevo doesn't work).
I prefer Vimeo over Youtube because in Germany to many music videos were are geofucked in Youtube.

The minimal steps to get the VIDFLTR library into KODI are as follows:

Login as the user running KODI to the machine where it is installed (or another machine where rsync is installed and a KODI-readable SHARE is available, really doesn't matter).

rsync --timeout=10 -caim --delete-after slashproc.org::VIDFLTR/ ~/VIDFLTR/

This will rsync the genre-folders with all the > 4000 STRM's and associated NFO's into the folder VIDFLTR in the home of the user running KODI.

I'm using the following relevant Advanced Settings:

<advancedsettings>
 <videoscanner>
   <ignoreerrors>true</ignoreerrors> <!-- Set to true to silently ignore errors while scanning videos. This prevents the error dialogue box, so you don't have to keep hitting "yes" to keep scanning.-->
 </videoscanner>
 <videolibrary>
  <cleanonupdate>true</cleanonupdate> <!-- default set to false to prevent Kodi from removing items from the database while updating.  -->
  <importwatchedstate>true</importwatchedstate> <!-- import previously exported playdate and playcount from .nfo files. Defaults to false -->
  <dateadded>1</dateadded> <!-- 0 results in using the current datetime when adding a video;
                              1 (default) results in prefering to use the files mtime (if it's valid) and only using the file's ctime if the mtime isn't valid;
                              2 results in using the newer datetime of the file's mtime and ctime -->
 </videolibrary>
</advancedsettings>

Without importwatchedstate set to true the initial (?) playcount will not be imported from the nfo's (= playcounts from me). Also dateadded should be 1 (or true, should be the same?), but that's the default anyway. Without setting cleanonupdate to true you will get dupes if I move a video to a different style/genre (what I do occasionally).

Now add the folder ~/VIDFLTR as a source for music videos in KODI. Take a look at http://kodi.wiki/view/Music_videos#Selecting_the_source on how to do this.
Important: Set the Scraper/Provider to "Local Information only" otherwise the info from the NFO-Files will NOT be used. ALL other musicvideo-scrapers are mostly useless (Yes, IMVDb also) for the music videos that are contained in VIDFLTR.
On the first run it will take maybe up to an hour (depending on your Internet-Speed) to get all the Video-Info and Thumbnails into the KODI-Library.

Now, in principle, everything is ready.
But for a in my opinion better experience I created a few special music video nodes where you can select random or sorted music videos based on criteria like often played, never played, only hits, hits from last year (grouped by style), artists grouped by A-Z and so on. To use these nodes you first have to copy the original library views from the KODI System data directory into userdata:

cp -a /usr/share/kodi/system/library/ ~/.kodi/userdata/

Now get the top node for VIDFLTR:

wget -O ~/.kodi/userdata/library/vidfltr.xml https://vidfltr.slashproc.org/kodi/vidfltr.xml

After that rsync the individual VIDFLTR nodes:

rsync -qcam slashproc.org::VIDFLTR-NODEVIEW ~/.kodi/userdata/library/video/vidfltr

To update the VIDFLTR library on a regular basis you can run the following script as a (nightly) cronjob (change RSYNC_PATH if you're not using LibreELEC. Obviously you also need to install the Network Tools addon from the LibreELEC program addons):

#!/bin/sh
# vidfltr.sh cronjob
# http://unix.stackexchange.com/questions/198563/how-can-i-check-if-rsync-made-any-changes-in-bash

RSYNC_PATH="/storage/.kodi/addons/virtual.network-tools/bin"
# Uncomment the next line to also sync the VIDFLTR Nodes View (though it doesn't change often)
# "$RSYNC_PATH"/rsync -cqam --delete-after slashproc.org::VIDFLTR-NODEVIEW/ ~/.kodi/userdata/library/video/vidfltr

RSYNC_COMMAND=$("$RSYNC_PATH"/rsync --timeout=10 -caim --delete-after slashproc::VIDFLTR/ ~/VIDFLTR/)

if [ $? -eq 0 ]; then
    # Success do some more work!
    if [ -n "${RSYNC_COMMAND}" ]; then
    # Update the library because rsync has changes
    /usr/bin/kodi-send --action='UpdateLibrary(video)' 1> /dev/null
    else
    # No changes were made by rsync
    exit 0
    fi
else
# Something went wrong!
exit 1
fi

If you're using KODI on Windows or Android you're on your own :-)
But with slight modifications (to the paths) all should work well.