NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public NextPVR Support Legacy (v4.x and earlier) v
« Previous 1 … 312 313 314 315 316 … 433 Next »
File in use problem

File in use problem
ttfitz
Offline

Senior Member

Posts: 285
Threads: 46
Joined: Sep 2008
#1
2012-03-20, 03:52 AM
I'm running into this problem with ImageGrabLite, but since it's not so much a problem with the plug-in but the circumstances, I thought I'd post here for more general assistance. If I have erred, please accept my apologies and move to the appropriate area.

A while back, during the renaming phase of ImageGrabLite, I had an error with the rename because the file was in use("The process cannot access the file because it is being used by another process"). I figured comskip still had the file open (being run in parallel), so I put some coding in my batch file to wait if the comfix files weren't available, and I thought that took care of it. But recently I've had the problem pop up again, and then twice tonight. After I saw the first one, I added the following code to my batch, but it happened a second time tonight after the change:

Code:
REM try renaming the file to the same name, see if gets an error
:checkopen
ren %1 "%~nx1"
if errorlevel 1 goto waitandcheck
goto grab
:waitandcheck
REM if we got here, the rename failed so wait a bit and try again
ping 1.1.1.1
goto checkopen

:grab

So, anyone have an idea why the file might be otherwise in use? I can think of nothing outside the NPVR universe that should be messing with the file, and it seems that this should catch if it is open there (okay, I stole it from someone else's batch file I found here).

Thanks.
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 53,205
Threads: 958
Joined: May 2006
#2
2012-03-20, 04:17 AM (This post was last modified: 2012-03-20, 04:23 AM by mvallevand.)
There is a useful command line tool that is part of the SysInternals suite called handle.exe that will tell you the process id and name. In Systernals there is also Process Explorer if you want a GUI, these might help with the mystery.

Right now I am working on a version that will queue up all failed renames and do them all as part of the nightly imageGrabLite --updateEPG

Martin.
johnsonx42
Offline

Posting Freak

Posts: 7,298
Threads: 189
Joined: Sep 2008
#3
2012-03-20, 04:20 AM
hmmm... who's batch file could it have been that you STOLE from... hmmm.... :mad:
just kidding, all are welcome to anything I post (that's why I post it), and it's not like I came up with the idea of renaming a file to the same name as a file-open test all on my own.

I'm not sure what else could be messing with the file. maybe comskip opens and closes it again one extra time at the end? perhaps if you add one more delay after the :grab tag to make sure everything is really done.
server: NextPVR 5.0.7/Win10 2004/64-bit/AMD A6-7400k/hvr-2250 & hvr-1250/Winegard Flatwave antenna/Schedules Direct
main client: NextPVR 5.0.7 Desktop Client; LG 50UH5500 WebOS 3.0 TV
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 53,205
Threads: 958
Joined: May 2006
#4
2012-03-20, 04:32 AM
Thanking about the batch file and the handle program I confirmed it returns 0 if the file is in use and 1 if not, so you could use

Code:
:checkopen
handle %1
if errorlevel 1 goto grab
timeout 20
goto checkopen

:grab

Martin
ttfitz
Offline

Senior Member

Posts: 285
Threads: 46
Joined: Sep 2008
#5
2012-03-20, 05:41 AM
mvallevand Wrote:Thanking about the batch file and the handle program I confirmed it returns 0 if the file is in use and 1 if not, so you could use

Code:
:checkopen
handle %1
if errorlevel 1 goto grab
timeout 20
goto checkopen

:grab

Martin

Just trying to run Handle in a cmd window, I found it has to have administrative privileges to run. I'm often unclear about such things, but will whatever process that runs postprocessing.bat have the proper privileges?
johnsonx42
Offline

Posting Freak

Posts: 7,298
Threads: 189
Joined: Sep 2008
#6
2012-03-20, 05:50 AM
postprocessing.bat will run as local system. that should have the needed priveleges. I know Martin has posted a method previously that will let you get a command prompt running under the local system account for testing like this, but I don't recall how to do it. google will probably be your friend here, as always.
server: NextPVR 5.0.7/Win10 2004/64-bit/AMD A6-7400k/hvr-2250 & hvr-1250/Winegard Flatwave antenna/Schedules Direct
main client: NextPVR 5.0.7 Desktop Client; LG 50UH5500 WebOS 3.0 TV
ttfitz
Offline

Senior Member

Posts: 285
Threads: 46
Joined: Sep 2008
#7
2012-03-20, 05:51 AM
johnsonx42 Wrote:hmmm... who's batch file could it have been that you STOLE from... hmmm.... :mad:
just kidding, all are welcome to anything I post (that's why I post it), and it's not like I came up with the idea of renaming a file to the same name as a file-open test all on my own.

I was too lazy to go back and find where exactly I had copied that, or I would have given a shout-out, like the kids used to say.

johnsonx42 Wrote:I'm not sure what else could be messing with the file. maybe comskip opens and closes it again one extra time at the end? perhaps if you add one more delay after the :grab tag to make sure everything is really done.

Wellllll - I left it out, but I actually had a second delay loop after that one (my original one), which looks for the VPrj file that comskip creates that I use, to see if it exists before finally calling ImageGrabLite. I thought for sure if (1) I did the rename thing to see if the TS file was free, and (2) looked for the comskip file to make sure comskip was finished, that I would have gotten past the locked file time. Guess not. Looking at the comskip log, it says "Time at end of run: Mon Mar 19 23:01:20 2012", which is 4 seconds after the comskip EDL file was created, and right around 4 seconds after ImageGrabLite has the Read Error.
ttfitz
Offline

Senior Member

Posts: 285
Threads: 46
Joined: Sep 2008
#8
2012-03-20, 06:10 AM
johnsonx42 Wrote:postprocessing.bat will run as local system. that should have the needed priveleges. I know Martin has posted a method previously that will let you get a command prompt running under the local system account for testing like this, but I don't recall how to do it. google will probably be your friend here, as always.

Thanks - I found a method just as you proposed, and handle did run, so we'll see how this goes tomorrow.
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 53,205
Threads: 958
Joined: May 2006
#9
2012-03-20, 12:06 PM
ttfitz Wrote:Wellllll - I left it out, but I actually had a second delay loop after that one (my original one), which looks for the VPrj file that comskip creates that I use, to see if it exists before finally calling ImageGrabLite. I thought for sure if (1) I did the rename thing to see if the TS file was free, and (2) looked for the comskip file to make sure comskip was finished, that I would have gotten past the locked file time. Guess not. Looking at the comskip log, it says "Time at end of run: Mon Mar 19 23:01:20 2012", which is 4 seconds after the comskip EDL file was created, and right around 4 seconds after ImageGrabLite has the Read Error.

Perhaps you stumbled on the problem that the file that was locked was not the .ts file Consider using

handle %~dpn1

to check for all the files.

Martin
ttfitz
Offline

Senior Member

Posts: 285
Threads: 46
Joined: Sep 2008
#10
2012-03-20, 09:37 PM
mvallevand Wrote:Perhaps you stumbled on the problem that the file that was locked was not the .ts file Consider using

handle %~dpn1

to check for all the files.

Martin

Good point. I think I will do just that. Thanks.
« 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
  incorrect frequency in adelaide .ini file spin35 5 3,202 2023-02-01, 05:40 PM
Last Post: sub
  NPVR4 and MPC-HC problem The Solutor 29 7,639 2021-07-27, 03:45 PM
Last Post: The Solutor
  ts file shows length too long? SuttonWillow 2 2,065 2021-03-15, 01:56 PM
Last Post: mvallevand
  Problem locking on to a tuner? time_lord 7 3,375 2021-01-09, 12:06 PM
Last Post: Graham
  EPG XMLTV problem DBHall 8 4,023 2021-01-01, 12:34 PM
Last Post: Graham
  Problem with Intel 4600 graphics driver pol098 1 1,545 2020-12-01, 12:44 PM
Last Post: romdl
  Unhandled Exception: file name too long (idiots at pbs made it super long) jobby99 1 1,510 2020-10-29, 09:40 PM
Last Post: mvallevand
  Problem setting up recording for some programmes LeoL 5 2,206 2020-10-21, 09:34 PM
Last Post: LeoL
  ts file shows length too long SamM 4 2,464 2020-10-06, 02:45 AM
Last Post: Ehrlichia
  Replayed recording problem Tj.2 25 10,119 2020-09-22, 04:51 PM
Last Post: baj1

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

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

Linear Mode
Threaded Mode