NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public NextPVR Support v
« Previous 1 … 31 32 33 34 35 … 43 Next »
Using PostPocessing to move recordings

 
  • 0 Vote(s) - 0 Average
Using PostPocessing to move recordings
ballfam
Offline

Member

Australia
Posts: 132
Threads: 11
Joined: Jul 2020
#1
2020-07-23, 06:33 PM
I'm running NextPVR on Linux, and I'm integrating it with Plex. So nextPVR makes the recordings in to a folder monitored by Plex. I'm also running Plex auto-optimization on the recordings to convert them from a .ts format to .mp4. All good, except that NextPVR seems to occasionally close off the file during the recording, I guess to save existing contextnt, and this kicks in the Plex auto-optimization and I end up with an optimized version that only contains part of the recording.

Seems like the way to fix this is to have NextPVR record to a location not moniored by Plex, and then move the recording the the Plex location when it is done. It appears I can do that by creating a PostProcessing.sh script in the scripts directory. Somehow, this seems like it would be a relatively common task, does anyone know if there is a script (or template) for Linux sh (not a bat file) out there that I can use to do a move at the end of the recording?

I understand shell scripting enough to be dangerous, but it would probably take me a few tries to get this right, and it would be nice if I could use something someone already coded.

Thanks
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 52,905
Threads: 955
Joined: May 2006
#2
2020-07-23, 06:39 PM
First are you sure NextPVR is reopening recordings that are in-progress? I didn't even think that is possible. I suspect it is a more an issue with Plex monitoring kicking in while recording is in progress.

Martin
ballfam
Offline

Member

Australia
Posts: 132
Threads: 11
Joined: Jul 2020
#3
2020-07-23, 07:11 PM
The Plex people think that the file is being closed and reopened. In fact what I think is happening is that there is some buffering out. Just to complicate matters, I'm running Plex on Windows, and then I mount one of the drives to the Linux machine using SAMBA; NextPVR is running on the Linux box and writing to the drive mounted from Windows. What I notice when monitoring it on Windows is that occasionally, the file jumps in size. I don't know is this is a side-effect of SAMBA, or just that NextPVR is occasionally moving the end-of-file marker along without actually closing the file. Whatever it is, it is causing a problem with Plex, which now believes there is some non-zero sized file that it can re-code.

So, I'm stuck dealing with the situation, and it appears that the only good solution is to make the file visible to Plex (i.e. move it in to a location monitored by Plex) only after the recording has finished. Looks like PostProcessing.sh can do that for me.
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 52,905
Threads: 955
Joined: May 2006
#4
2020-07-23, 07:44 PM
Of course the size will not be zero as it grows and flushes. You will see the same thing if you copy it after recording though so not sure it solves your problem entirely.

There are a few PostProcessing.sh examples on the forum but if you aren't comfortable with bash scripting sounds like you made a mistake not just keeping NextPVR with your Plex server on Windows.

Martin
ballfam
Offline

Member

Australia
Posts: 132
Threads: 11
Joined: Jul 2020
#5
2020-07-23, 07:57 PM (This post was last modified: 2020-07-23, 07:58 PM by ballfam.)
Actually, I'm more conformable with shell scripting than bat files. I develop on Linux for a living, and if it wasn't for some applications which must run under Windows on my server, I would run everything on Linux. If you asked me to write a C program to process this, I could do it in 5 minutes flat, unfortunately I don't write shell scripts much; I can do it, but it may take me a few tries to work out parameter processing correctly.

As it happens, I'm just moving the file to the same drive in a different location, not actually copying it across drives, so this will always happen instantaneously since it just needs to update the directory index with the new location. I don't think I'll have any issue with Plex.

let me see if I can find something, otherwise I'll code something up at the weekend when I have some time. If it works, I'll post it back to the forum.
daphatty
Offline

Posting Freak

Posts: 1,032
Threads: 85
Joined: Feb 2005
#6
2020-07-23, 08:03 PM
The easy part of this is the cp command. The hard part is knowing which files need to be passed to your script in order to copy them from A to B.
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 52,905
Threads: 955
Joined: May 2006
#7
2020-07-23, 08:33 PM
Sounds like a mv not cp but it is going to be something like

Code:
plex=/folder/one/
mv "$1" "$plex"
plexfile=$plex"$(basename "$1")"
/opt/dotnet/dotnet /opt/nextpvr/system/NScriptHelper.dll  -rename "$1" "plexfile"

Martin
ballfam
Offline

Member

Australia
Posts: 132
Threads: 11
Joined: Jul 2020
#8
2020-07-23, 10:11 PM
Yup, it will be an mv, not a cp. I code shell scripts so rarely that I always forget the subtle differences between csh, sh, and bash, and I have to run it to test it because there is no compiler Sad

Thanks for the quick start, I'll take a run at it over the weekend. Does the script need to be executable (u+x), or does NextPVR run it under "sh <script>?
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 52,905
Threads: 955
Joined: May 2006
#9
2020-07-23, 10:13 PM
Yes scripts need to be executable.

Martin
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,684
Threads: 767
Joined: Nov 2003
#10
2020-07-23, 10:59 PM
(2020-07-23, 07:11 PM)ballfam Wrote: The Plex people think that the file is being closed and reopened.
You guys are already well past this, but just for confirmation - it only opens the file once, writes to the file until the recording is complete, then closes the file. No closing and reopening.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (2): 1 2 Next »


Possibly Related Threads…
Thread Author Replies Views Last Post
  Recurring recording creates multiple recordings of same event txinga 2 360 2025-03-29, 12:33 AM
Last Post: txinga
  Recurring Recordings Not Working After Merging Channels BrettB 2 264 2025-02-06, 04:00 AM
Last Post: mvallevand
  Moving recordings to a fileserver SickBoy 1 258 2025-02-01, 02:39 PM
Last Post: mvallevand
  recordings prematurely 'stop' moonmeat 3 456 2025-01-24, 02:08 PM
Last Post: mvallevand
  What would happen if I change file locations and names of the recordings? Luisy44 4 587 2024-10-15, 01:15 AM
Last Post: Luisy44
  Why are my recordings not recording completely? Luisy44 6 892 2024-10-12, 07:01 PM
Last Post: Luisy44
  Recordings import issue Jaggy 4 578 2024-08-25, 12:03 AM
Last Post: Jaggy
  Recurring recordings not getting scheduled ginge6000 1 400 2024-07-12, 10:58 AM
Last Post: mvallevand
  Audio Format of Recordings (AAC LC SBR) jayg30 5 1,795 2023-12-08, 04:10 AM
Last Post: jayg30
  IPTV Recordings not finishing - Too many retries...giving up Ade_AV 3 849 2023-12-05, 07:08 AM
Last Post: Ade_AV

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode