Your setup is not so "extraordinary", many people have multiple tvheadend servers and would like to share recordings. I have two servers, each at a different location. I am not in a big hurry for most of the recordings, so up until recently I just rsynced the files about once a week and then copied over the corresponding dvr/log files manually. Now I have setup a more automatic process.
This thread and Dave P's wiki were helpful.
https://tvheadend.org/d/5128-documentation-for-api-access-programming
https://github.com/dave-p/TVH-API-docs/wiki/
specifically:
https://github.com/dave-p/TVH-API-docs/wiki/Dvr
First, I created a script to be run on the recording tvheadend server after each recording completes, here are probably the interesting parts for you:
/home/hts/export_json.sh
#!/bin/bash
file=$1
uuid=$2
printf "conf=" | cat - "/home/hts/.hts/tvheadend/dvr/log/$uuid" >"$file".import.json
Then call it in with "Post-processor command:"
/home/hts/export_json.sh "%f" %U
This uses the uuid of the new recording to get the dvr/log file and prepends the needed "conf=" to it and saves it in the recording folder.
Then once a day a cron job rsyncs the recordings and json files to my other server. (after rsyncing I remove the local json file)
Another cron job on my receiving server runs a few hours later and "imports" the json files into tvheadend using the dvr/create web api.
For each json file it executes:
curl -q --data @file.import.json 'http://user:pass@localhost:9981/api/dvr/entry/create'
Then, on success I remove the json file. (on error, I move it to a tmp folder to be examined manually later.)
For your setup, since you do not need to rsync files, your export script could include the curl command, connecting to the play2.
A few things to note:
1. Both my servers use the exact same path to the recordings directory, so I do not have to modify the filename. If your paths are different, you could use something like sed to fix the filename in the json file before importing.
2. I used to grep through all the dvr/log files to find the one with the filename (%f), but the brand new option (%U) makes it much easier.
(commit from sept. 26
https://github.com/tvheadend/tvheadend/commit/6e8c4691993e09d43a7e894f2a023bc390512022 )
So, if you have an older version, you would have to resort back to grepping the dvr/log files to find the one you need.
something like:
logfile=$(grep -l "$file" /home/hts/.hts/tvheadend/dvr/log/*)
printf "conf=" | cat - "$logfile" >"$file".import.json
3. As noted in the wiki, the dvr/create function is there to create new scheduled recordings, using it this way is not supported and could change at any time!!!
4. I end up with a copy of the recording on each server, so later moving/deleting is not a problem. Since both of your servers will point to the same file, if you delete it on one, it will affect the other server...
5. While testing the dvr/create api I managed to crash my server many times with bad data, so beware. If I find some time this week, I will try to fix (hack...) the tvheadend code to make some better checks on the submitted data, or at least write a detailed bug report.
Again, big thanks to Dave Pickles for his wiki and "ullix tv" for his example!