hmmm…
I need the path that the recording is being copied to, and the name that it will be given… That is not in there?
I assume that the variables you are listing are the path in .grab?
and if I extract the SRT there, will the SRT be copied to the final location?
@jwaltrip4 said:
hmmm…
I need the path that the recording is being copied to, and the name that it will be given… That is not in there?
I assume that the variables you are listing are the path in .grab?
and if I extract the SRT there, will the SRT be copied to the final location?
The name it will be is there, but not the final destination.
if I extract the SRT, will it be copied with the show to its final location?
@jwaltrip4 said:
if I extract the SRT, will it be copied with the show to its final location?
Not with the current versions of PMS
grrr…
any thought on how I can make extracting the CC part of post processing?
OK… anything in the temp directory under .grab gets copied to the final desitination
It is a little more messy… I created a txt file in the temp directory, and it looks like Plex assigned that as the file name for the show in the library. easy enough to fix with a refresh, but seems to be an issue with the logic being used to move things.
@jwaltrip4 said:
grrr…
any thought on how I can make extracting the CC part of post processing?
That kinda depends on if you leave it in .TS format before you do any processing to it.
Right now, at least with the CONNECT if you have Plex either REMUX or TRANSCODE the recording to an MKV the subtitles are stripped.
OK. test run with TS file, extract to SRT in .grab directory.
Plex then copies the files to final location.
It copies the SRT file, and it shows everything correctly in the library.
@jwaltrip4 said:
grrr…
any thought on how I can make extracting the CC part of post processing?
I’m testing out ccextractor later today. I’ll report back with my results.
OK… I have it working… I run ccexractor during post processing and it creates the SRT file. I adjusted some settings and it seems to be picked up OK by clients, All looks good there.
Only issue I see, and this is not related to ccextraxctor or even post processing.
If I go do delete a show, only the TS file is removed. the SRT is left in place.
Actually, even without an SRT file only the TS is deleted leaving the directory intact.
This is going to be problematic… what happens after a year of watching and deleting… Now we have hundreds of empty directories. UNCLEAN!
- Plex should remove the directory the show is in, and any contents.
I can’t seem to get the postprocessingScript variable set.
I’ve found my token, my dvr device identifier, and ran the curl -X PUT command to no avail. My dvr listing does not show a value in the XML listing.
<Dvr key=“2” …
<Device parentID=“2” key=“1” …
Valid token was used but removed from the following command. I receive a 404 error. Changing the token changes the error to access denied so I feel like the token is definitely authenticating. Any thoughts?
curl -X PUT “http://localhost:32400/livetv/dvrs/2/prefs?postprocessingScript=N:/Comskipdonator/PlexPostProcessing.bat&X-Plex-Token=XXXXXXXXXXXXXXXX”
OK… so here is what I would like to do next:
- remux the TS file to MKV
- as part of that, add the SRT cc file
- output is MKV with subtitles.
Any thoughts about how to do that?
@jwaltrip4 said:
OK… so here is what I would like to do next:
- remux the TS file to MKV
- as part of that, add the SRT cc file
- output is MKV with subtitles.
Any thoughts about how to do that?
Have you tried to use mkvmerge? I found this example:
mkvmerge -o myouput.mkv myinput.mkv --language “0:en” --track-name “0:mytrackname” mynewsubtitles.srt
Sidenote… If anyone is interested I’ve added auto cropping and transcoding the MPEG2 mkv to x264 mkv to the PlexComskip.py script. I’m not very proficient with python (more of a nodejs guy) but it works great.
I have something figured out. I take the string passed, and parse off the .TS and then pass that to mkvmerge.
will let you know how it tests out
Had a bit of a hiccup with getting this going.
-
Comskip was definitely a pain in the ass. Luckily, there is a yum repo (CentOS here) that has it pre-packaged as an RPM, along with all of the other utilities. I had compilation errors trying to build from the GIT repo.
a) Repo is here if anyone else needs it. This is Red Hat / CentOS / etc only. Debian-based distributions need another solution.
b) Also note, I disable this repo after I get what I need. It conflicts with some other popular repos, such as RPMFusion. I get everything from anywhere else and use it as a last resort.
-
Monkeying around with the key (page 2 of this thread) - finally figured that out. Can’t wait to actually have this in the GUI.
-
Tested the script using a test file that already had commercials. Worked great after tinkering with the paths in the .conf file.
-
Ran it a few times, recordings kept failing (details below).
The show would record, however after about 5-10 minutes I would see an error in the Recording Scheduler that the show hit an error during post-processing, and it failed to add the show.
On Linux, plex uses the “plex” account to do all of this work. My script exists in my home directory, which had 700 permissions. I figured this out after looking in the logs for Plex, like below.
So if you hit that roadbump, remember to check the Plex logs to see what happened!
About to do my final test now.
Thanks to @hthighway for doing the lion’s share of the magic!
[root@mediasrv jasonmicron]# cd /<plexhomedir>/Library/Application\ Support/Plex\ Media\ Server/Logs
[root@mediasrv Logs]# grep -i postprocess *
Plex Media Server.2.log:Sep 25, 2016 14:00:00.667 [0x7f0e313fd700] ERROR - MediaRecorder: Postprocessing script '/shared/home/jasonmicron/bin/skipcom.sh' doesn't exist, skipping.
Plex Media Server.2.log:Sep 25, 2016 14:00:01.196 [0x7f0e23bfa700] WARN - MediaGrabber: Final status was 5, not going to postprocess.
Plex Media Server.3.log:Sep 25, 2016 13:38:46.167 [0x7f2f24fff700] ERROR - MediaRecorder: Postprocessing script '/shared/home/jasonmicron/bin/skipcom.sh' doesn't exist, skipping.
Plex Media Server.4.log:Sep 25, 2016 13:35:35.490 [0x7f2abc7f5700] ERROR - MediaRecorder: Postprocessing script '/shared/home/jasonmicron/bin/skipcom.sh' doesn't exist, skipping.
Plex Media Server.4.log:Sep 25, 2016 13:35:36.416 [0x7f2ac0ffe700] WARN - MediaGrabber: Final status was 5, not going to postprocess.
Plex Media Server.log:Sep 25, 2016 14:30:00.829 [0x7f0e253fd700] ERROR - MediaRecorder: Postprocessing script '/shared/home/jasonmicron/bin/skipcom.sh' doesn't exist, skipping.
Plex Media Server.log:Sep 25, 2016 14:30:02.733 [0x7f0e23bfa700] WARN - MediaGrabber: Final status was 5, not going to postprocess.
Plex Media Server.log:Sep 25, 2016 15:00:01.030 [0x7f0e1e7ff700] ERROR - MediaRecorder: Postprocessing script '/shared/home/jasonmicron/bin/skipcom.sh' doesn't exist, skipping.
Plex Media Server.log:Sep 25, 2016 15:00:02.737 [0x7f0e11bff700] WARN - MediaGrabber: Final status was 5, not going to postprocess.
So - a bit of another hiccup.
The script does get called when a show is recorded. However, commercials remained.
I set my script to debug mode and output all messages to a log file for debugging. However, I am not a Python guy, and I don’t know what this means exactly. It appears to be a possible bad environment in the Python script itself - or the python script you created is expecting things where they aren’t actually located on my system.
Again, the script runs perfectly fine when running it manually, so I am really confused.
Here is what is in the log file that I had created when the script is executed:
[root@mediasrv Logs]# cat /shared/tmp/processing.log
The file is being analyzed.
The changes are written to the file.
Done.
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
And here is the script being called:
#!/bin/bash
set -x
echo -e "
““Setting Language…””
" &>> /shared/tmp/processing.log
/usr/bin/mkvpropedit “$1” --edit track:a1 --set language=eng --edit track:v1 --set language=eng &>> /shared/tmp/processing.log
echo -e "
““Sleeping for 5 seconds…””
" &>> /shared/tmp/processing.log
sleep 5
echo -e "
"“Removing commercials…” &>> /shared/tmp/processing.log
/usr/local/bin/python /home/jasonmicron/PlexComskip/PlexComskip.py “$1” &>> /shared/tmp/processing.log
exit 0
And here is my python version:
[root@mediasrv Logs]# python --version
Python 2.7.5
I did notice that if I do a “which python”, it shows up as under /usr/local/bin/python, and the script you created calls /usr/bin/python. They appear to be the same via symlinks. I adjusted the script to look under /usr/local/bin/python rather than the one you had set, and another show will finish in about 10 minutes. I’ll report back if that fixed it or not. But it’s just weird.
Update:
This is definitely in the python script. After another try, this is what is in the log file I have created each time a show is processed, based on your script:
Setting Language...
The file is being analyzed.
The changes are written to the file.
Done.
Sleeping for 5 seconds...
Removing commercials...
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
Anyone have any suggestions? Since the script executes as the “plex” user, and I haven’t done any weird things with that account, is that something to consider? Other than this beta and script setup, I have not messed with my Plex installation at all. It’s all stock.