Tool that syncs downloaded series from a seedbox, to a local player.
It scans the source directory for valid series to copy over. On the player, it scans for folders that resemble the series name by running the levenshtein algorithm against the folder names. If the season directory does not exist, it is created.
You'll need:
- Go >= 1.14
- SSH agent running on both machines, with support for public/private key authentication
- A folder to where the downloads are copied once complete - the tool can't work against a directory in which the downloads are progressing
- A MySQL/MariaDB installation in case you want to define a
dbblock in the configuration file (tested with MariaDB 10.4), otherwise fallsback to the local SQLite3 file
go build
cp sample.db storage.db
cp sample.seedboxsync .seedboxsyncEdit the configuration file .seedboxsync which is already populated with some sample configuration parameters.
db (optional) block with information to connect to a remote MySQL database
host hostname or IP address of the machine
port port to where the SSH agent is listening
user user with which the application should login
key location of the private key to use to SSH
dir root directory where the contents are read/written
seedbox - represents the location of where the completed downloads are found
player - represents the root of where the series should be placed
temp_dir temporary directory to where the rar'd/zip'd files should be extracted prior to be transferred (only applies to the seedbox block)
IMPORTANT The files should be placed on the directory once they're completely downloaded. This application does not know if a download is in progress or not.
You need to add the private keys used to SSH into both the seedbox and the player machine. You also need to have them already added to your ~/.ssh/known_hosts file. So make sure that you've at least SSH'd to those machines once through your terminal (easier way to add them to the file).
$ ./seedboxsync
2020-04-10T22:16:21+01:00 DBG Loaded configuration .seedboxsync={"player":{"dir":"/home/example/series","host":"player.example.com","key":"keys/player","port":22,"user":"player"},"seedbox":{"dir":"/home/example/downloads","host":"example.com","key":"keys/seedbox","port":2222,"temp_dir":"/temp","user":"example"}}
2020-04-10T22:16:22+01:00 INF Adding to queue item=XXX.XXX.S16E21.1080p.WEB.H264-iNSiDiOUS
2020-04-10T22:16:22+01:00 INF Adding to queue item=XXX.XXX.S11E19.1080p.HDTV.x264-TWERK
2020-04-10T22:16:22+01:00 INF Copying item=XXX.XXX.S16E21.1080p.WEB.H264-iNSiDiOUS
2020-04-10T22:16:22+01:00 INF Copying item=XXX.XXX.S11E19.1080p.HDTV.x264-TWERK
2020-04-10T22:16:27+01:00 INF Copying complete item=XXX.XXX.S16E21.1080p.WEB.H264-iNSiDiOUS
2020-04-10T22:16:27+01:00 INF Hashing data=/home/example/downloads/XXX.XXX.S16E21.1080p.WEB.H264-iNSiDiOUS/
2020-04-10T22:16:27+01:00 INF Copying complete item=XXX.XXX.S11E19.1080p.HDTV.x264-TWERK
2020-04-10T22:16:27+01:00 INF Hashing data=/home/example/downloads/XXX.XXX.S11E19.1080p.HDTV.x264-TWERK/
2020-04-10T22:16:28+01:00 INF Refreshing player's library
2020-04-10T22:16:28+01:00 INF Done