Project

General

Profile

Record to temp folder on system SSD, then move to HDD at night?

Added by m h over 1 year ago

How can I record to a temporary folder, then later move the finished recordings to an another drive?


Replies (4)

RE: Record to temp folder on system SSD, then move to HDD at night? - Added by Ben K over 1 year ago

The easiest way to do this is with a post-processing command:
  • You set the storage path for recordings to your temporary folder (under 'Configuration > Recording > Digital Video Recorder Profiles').
  • Set the 'post-processing command' (under the same settings tab) to something like:
    /usr/bin/mv %f /path/to/your/hdd
    
  • See the built-in documentation for more insight on the post-processing command option, or just hit me up below.

This would be executed immediately after the recording finishes, is it significant that it happens at night?
Additionally, this would result in your finished recordings not showing up under 'Finished Recordings' (but still on your HDD). Is this a big deal.

If the proposed solution doesn't satisfy you or you're raising any further question, always feel free to follow up.

Best regards,
Ben

RE: Record to temp folder on system SSD, then move to HDD at night? - Added by m h over 1 year ago

Thank you Ben. I'll test it.

It will not show up in "finished recordings" means
I wont be able to open files from tvh (I never do that, I'm using samba or jellyfin), but tvh will knows that this episode is recorded, so it wont record the same episode again? (With the correct duplicate handling setting)

-
I don't want to move files that are still in recording, thats why I thougth moving files at night would be a geat idea - when I'm not recording anything. Also there are some other syncing at night, which means the HDD should only spin up once for all data changes (not necessary, just fine tuning).

RE: Record to temp folder on system SSD, then move to HDD at night? - Added by Ben K over 1 year ago

I haven't actually tried using a post-processing command so I might be mistaken but to me it seems like there should be no difference to manual moving files so duplicate handling should work. I would just make sure to either set 'Recording info retention period' (in your Recorder Profile) to 'forever'.

If you want to go the extra mile to do things at night, you have basically two options, both involing writing a script:
  1. Set your post-processing command to a shell that pauses till midnight: /path/to/my/script %f
    hours_till_midnight=$((24 - date +%H))
    sleep $hours_till_midnight
    mv $1 /your/hdd
    
  2. Write a cron job that executes at midnight and checks against that TVH api to see which files can be moved (more difficult, yet more stable as 1. doesn't work if your system reboots inbetween)

RE: Record to temp folder on system SSD, then move to HDD at night? - Added by Dave Pickles over 1 year ago

There is an api function to tell Tvheadend that you have moved a file.

(untested)

wget username:[email protected]:9981/api/dvr/entry/filemoved?src=/tmp/example.ts&dst=/your/storage/example.ts

The username must have admin privilege for this to work.

    (1-4/4)