DVR moving files from .grab bug

I was not sure how to even search the forum for my issue to see if other people have had this so I am sorry if this has been discussed.

Background

I am running a DVR post-processing script to transcode DVR files to h264, extract subtitles, etc. Everything with my script is working fine, however, Plex does not seem to like the new files I create.

My script does leave the original recording as I know Plex doesn’t like when you delete that, and I thought that Plex would simply move all the files within the .grab/randomhash/ directory to where it wants to put them, however that is not what is happening

The problem

From looking at the logs (see below), Plex moves the first file it finds in the .grab/randomhash/ directory correctly; in this case a .srt file my script created. However, when it goes to move the next file from the grab directory, a .mp4 file, Plex tries to put it in a directory in the destination with the name of the .srt file. This issue is further compounded with the last file, the .ts file, which Plex tries to put in a directory tree of srt_file.srt/mp4_file.mp4/.

Seems like the output directory is changed to the location where the file is to be moved, which would mean the next file to be moved would go in a directory with the name of the last moved file. Pretty easy mistake to do coding wise (have done it myself), so shouldn’t be too hard to fix.

Version info

  • Plex server Version 1.15.3.858
  • Raspbian GNU/Linux 9 (stretch)
  • Raspberry Pi 3 Model B

Log info

Apr 06, 2019 15:58:24.237 [0x57afc450] DEBUG - DVR:Grabber: Postprocessing, we're going to put `Monster Truck Adventures - Episode` in `/mnt/Media_6TB/TV Shows/Monster Truck Adventures (2013)/Season 2019/Monster Truck Adventures (2013) - 1900-01-01 00 00 00 - Episode.ts`
Apr 06, 2019 15:58:24.237 [0x57afc450] DEBUG - DVR:Grabber: Moving "/mnt/Media_6TB/TV Shows/.grab/834c1748377f77ef5f8bac5bb3b2ee9dcff6d294/1900-01-01 00 00 00 - Episode.480p.x264.EN_AAC..0.srt" to "/mnt/Media_6TB/TV Shows/Monster Truck Adventures (2013)/Season 2019/1900-01-01 00 00 00 - Episode.480p.x264.EN_AAC..0.srt"
Apr 06, 2019 15:58:24.238 [0x57afc450] DEBUG - DVR:Grabber: Moving "/mnt/Media_6TB/TV Shows/.grab/834c1748377f77ef5f8bac5bb3b2ee9dcff6d294/1900-01-01 00 00 00 - Episode.480p.x264.EN_AAC..mp4" to "/mnt/Media_6TB/TV Shows/Monster Truck Adventures (2013)/Season 2019/1900-01-01 00 00 00 - Episode.480p.x264.EN_AAC..0.srt/1900-01-01 00 00 00 - Episode.480p.x264.EN_AAC..mp4"
Apr 06, 2019 15:58:24.238 [0x57afc450] ERROR - Couldn't rename file "/mnt/Media_6TB/TV Shows/.grab/834c1748377f77ef5f8bac5bb3b2ee9dcff6d294/1900-01-01 00 00 00 - Episode.480p.x264.EN_AAC..mp4" to "/mnt/Media_6TB/TV Shows/Monster Truck Adventures (2013)/Season 2019/1900-01-01 00 00 00 - Episode.480p.x264.EN_AAC..0.srt/1900-01-01 00 00 00 - Episode.480p.x264.EN_AAC..mp4": Not a directory
Apr 06, 2019 15:58:24.238 [0x57afc450] DEBUG - DVR:Grabber: Moving "/mnt/Media_6TB/TV Shows/.grab/834c1748377f77ef5f8bac5bb3b2ee9dcff6d294/Monster Truck Adventures (2013) - 1900-01-01 00 00 00 - Episode.ts" to "/mnt/Media_6TB/TV Shows/Monster Truck Adventures (2013)/Season 2019/1900-01-01 00 00 00 - Episode.480p.x264.EN_AAC..0.srt/1900-01-01 00 00 00 - Episode.480p.x264.EN_AAC..mp4/Monster Truck Adventures (2013) - 1900-01-01 00 00 00 - Episode.ts"
Apr 06, 2019 15:58:24.238 [0x57afc450] ERROR - Couldn't rename file "/mnt/Media_6TB/TV Shows/.grab/834c1748377f77ef5f8bac5bb3b2ee9dcff6d294/Monster Truck Adventures (2013) - 1900-01-01 00 00 00 - Episode.ts" to "/mnt/Media_6TB/TV Shows/Monster Truck Adventures (2013)/Season 2019/1900-01-01 00 00 00 - Episode.480p.x264.EN_AAC..0.srt/1900-01-01 00 00 00 - Episode.480p.x264.EN_AAC..mp4/Monster Truck Adventures (2013) - 1900-01-01 00 00 00 - Episode.ts": Not a directory
2 Likes

I’m think I"m encountering the same thing. I was going crazy trying to figure out why my recordings started to fail. I scheduled a test recording and saw this in the logs:

Apr 07, 2019 09:04:11.811 [26020] DEBUG - DVR:Grabber: Postprocessing, we're going to put `According to Jim - E3 - We Have a Bingo` in `Z:\Plex\Recorded TV\TV Shows\According to Jim (2001)\Season 03\According to Jim (2001) - S03E03 - We Have a Bingo.mkv`
Apr 07, 2019 09:04:11.812 [26020] DEBUG - DVR:Grabber: Moving "Z:\Plex\Recorded TV\TV Shows\.grab\008e8c13a6af6ea9e2331532020db4561eb4b70d\According to Jim (2001) - S03E03 - We Have a Bingo.edl" to "Z:\Plex\Recorded TV\TV Shows\According to Jim (2001)\Season 03\According to Jim (2001) - S03E03 - We Have a Bingo.edl"
Apr 07, 2019 09:04:11.814 [26020] DEBUG - DVR:Grabber: Moving "Z:\Plex\Recorded TV\TV Shows\.grab\008e8c13a6af6ea9e2331532020db4561eb4b70d\According to Jim (2001) - S03E03 - We Have a Bingo.mkv" to "Z:\Plex\Recorded TV\TV Shows\According to Jim (2001)\Season 03\According to Jim (2001) - S03E03 - We Have a Bingo.edl\According to Jim (2001) - S03E03 - We Have a Bingo.mkv"
Apr 07, 2019 09:04:11.815 [26020] ERROR - Couldn't rename file "Z:\Plex\Recorded TV\TV Shows\.grab\008e8c13a6af6ea9e2331532020db4561eb4b70d\According to Jim (2001) - S03E03 - We Have a Bingo.mkv" to "Z:\Plex\Recorded TV\TV Shows\According to Jim (2001)\Season 03\According to Jim (2001) - S03E03 - We Have a Bingo.edl\According to Jim (2001) - S03E03 - We Have a Bingo.mkv": The parameter is incorrect
Apr 07, 2019 09:04:11.815 [26020] DEBUG - DVR:Grabber: Moving "Z:\Plex\Recorded TV\TV Shows\.grab\008e8c13a6af6ea9e2331532020db4561eb4b70d\According to Jim (2001) - S03E03 - We Have a Bingo.xml" to "Z:\Plex\Recorded TV\TV Shows\According to Jim (2001)\Season 03\According to Jim (2001) - S03E03 - We Have a Bingo.edl\According to Jim (2001) - S03E03 - We Have a Bingo.mkv\According to Jim (2001) - S03E03 - We Have a Bingo.xml"
Apr 07, 2019 09:04:11.816 [26020] ERROR - Couldn't rename file "Z:\Plex\Recorded TV\TV Shows\.grab\008e8c13a6af6ea9e2331532020db4561eb4b70d\According to Jim (2001) - S03E03 - We Have a Bingo.xml" to "Z:\Plex\Recorded TV\TV Shows\According to Jim (2001)\Season 03\According to Jim (2001) - S03E03 - We Have a Bingo.edl\According to Jim (2001) - S03E03 - We Have a Bingo.mkv\According to Jim (2001) - S03E03 - We Have a Bingo.xml": The system cannot find the path specified

It does seem like a moving file issue?

I’ve just noticed this bug as well. It started occurring after upgrading to 1.15.3.876. I have removed my post processing script in the meantime.

See also: [Bug] Plex recordings being deleted and have wrong path

I have the same issue. Does anyone know how to fix it?

The only thing we can do is wait for Plex to fix it.

What I don’t like about this issue is that I reported it during Beta (see thread linked by kwodz) and it still made it to Public.

In the meantime, I have activated the MCEBuddy archive so I can re-run the conversion and move the files manually.

Quick update, just installed latest version and does NOT fix this issue:

Version: 1.15.4.919-8e2884e4b

I guess I’ll be following this thread. Modified MCEbuddy to archive just like Silars.

Version 1.15.4.993 still does not fix the issue.

Is there any way to bring this bug some attention from Plex employees?

Not fixed in version 1.15.4.994

Not fixed in version 1.15.5.994.

My script moves the recorded file to a temp folder, extracts .srt and transcodes to .mp4. Then I move both the .srt and .mp4 back to the .grab folder and archive the original .ts file. This has worked flawlessly up until a few weeks ago when I must have done a PMS upgrade.

It seems to be concatenating the .srt file name along with the .mp4 file name on the final copy. The .srt file makes it to the final destination, but the .mp4 file just disappears. I suspect that if I only put the .mp4 file back to the .grab folder, that it will work ok (just without subtitles). I will try that on my recordings this week as a workaround until this issue gets fixed.

You’re exactly right and your proposed work around should work perfectly.

What I’m assuming is happening is in their code the output directory variable is over written with the output file path. This is fine for the first file, but any subsequent file breaks as the output directory is now the file that was just moved.

It’s a fairly trivial programming bug that I have done myself, I just wish they would fix it…

It started occurring after upgrading to 1.15.3.876. hence i went back to factory reset.

Bug still exists in server version 1.15.6.1079

Got a reply from Plex after contacting them through the contact form :

Apr 29, 11:32 AM PDT

Hi,

Our server/DVR team is aware of that issue and is investigating, but no specific details to share right now. Apologies for any inconvenience.

Thanks for using Plex!

Still not fixed in Beta Version 1.15.8.1163 (released today) though…

Starting to think that message was just some PR. Can’t be too hard to investigate with everything that is listed in the OP.

Do we have full debug log files for this issue ?

Would like that to look into the issue.

See
https://support.plex.tv/articles/201643703-reporting-issues-with-plex-media-server/
https://support.plex.tv/articles/200250417-plex-media-server-log-files/

I have attached the logs from my server; sorry I did not do this sooner.

I tried recording a show on May 27, 2019 at 18:00.

Information from the Plex Server for this time are in the Plex Media Server.4.log file.

I have just scheduled another recording and will upload the new log files after it is done.

Thank you for looking into this!!!

Path information

My TV Show library is set pointed to /mnt/Media_6TB/TV Shows/, with the DVR set to record to this location. Thus, when a new recording starts, it goes into /mnt/Media_6TB/TV Shows/.grab/somehash/. My post processing script creates an .mp4 file, and one or more .srt files if subtitles can be extracted. After recording is complete, Plex will try to move files to /mnt/Media_6TB/TV Shows/Name of Show/Season XX/, or where ever it sees fit.

Log files

Plex Media Server Logs_2019-05-31_07-46-28.zip (3.3 MB)

Thank you. The logs have now been referred to the development team.

Does the problem arise if there are no subtitles ? It appears that the first file gets renamed correctly but subsequent files end up with the wrong path

Just noticed you actually explained the bug precisely in your OP.

Did this start with version 1.15.3 ?

If version 1.15.3.858 is the first 1.15.3 version, then yes. However, I may have missed an update or two in between when it was working and when the bug was introduced. Perhaps another user can confirm the exact version the bug was introduced?

I can confirm that if there are NO extra files (i.e., .srt or .mp4), Plex does everything correctly. The show I just tried recording actually cause my post-processing script to fail, so there was only the .ts file to move and everything worked fine.

Trying another show to recreate the bug and will upload logs when done.