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 … 319 320 321 322 323 … 433 Next »
NScriptHelper -rename making me insane

NScriptHelper -rename making me insane
johnsonx42
Offline

Posting Freak

Posts: 7,298
Threads: 189
Joined: Sep 2008
#1
2011-07-30, 11:45 AM
ok, I have literally been up all night trying to rename a recording file using NScriptHelper. no matter what I do, the recording I try to rename just disappears from the database. I've set <AutoRemoveMissingRecordings> to false in config.xml, and they still disappear. I'm running out of recordings to try this with.

all I'm trying to do is insert the subtitle (episode name) into the file name... this shouldn't be hard.

My most recent failure:
Code:
ren "f:\Recordings\Family Guy\Family Guy_20110728_01000130.ts" "Family Guy-Peter's Progress-20110728_01000130.ts"
C:\Progra~1\NPVR\NScriptHelper.exe -rename "f:\Recordings\Family Guy\Family Guy_20110728_01000130.ts" "f:\Recordings\Family Guy\Family Guy-Peter's Progress-20110728_01000130.ts"

the file rename itself works just fine, but once I run the nscripthelper command the recording is gone. i've tried without double-quotes as well, but I'm pretty sure they're needed.

what the *(%$(# am I doing wrong?
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
b00sfuk
Offline

Senior Member

Posts: 319
Threads: 26
Joined: Mar 2005
#2
2011-07-30, 12:47 PM
I had this problem and fixed it with 2 things (been using a modified version of JimF's batch file from http://forums.nextpvr.com/showthread.php...post415037)

1. Both these needed:
<AutoRemoveMissingRecordings>false</AutoRemoveMissingRecordings>
<CheckForRenamedRecordings>false</CheckForRenamedRecordings>

2. Not 100% certain on this but make sure that both versions of the file exist (I.E. "Family Guy_20110728_01000130.ts" AND "Family Guy-Peter's Progress-20110728_01000130.ts") when you do the rename (otherwise got this error "Unable to file existing recording with filename...." in the nscripthelper.log). I.E. copy file to new filename, run nscripthelper and then delete the old file (don't just rename the file).

It all works for me now though except for the problem where if I have 2 or more recordings finish at the same time then only one recording is renamed and the other is not touched (although postprocessing is started in the NPVR logs for both).
Silverstone LC10M with iMON
Gigabyte 780G+4850e, AMD 6570
Blackgold BGT3620, Harmony 555 Remote
Win7 32-bit, SAF
johnsonx42
Offline

Posting Freak

Posts: 7,298
Threads: 189
Joined: Sep 2008
#3
2011-07-30, 06:11 PM
ah, I didn't even realize that there was a log file. sure enough, I got "2011-07-30 04:22:03.682 [ERROR][1] Unable to file existing recording with filename: f:\Recordings\Family Guy\Family Guy_20110728_01000130.ts"

however, for a prior attempt on a different file I got: "2011-07-30 04:16:05.319 [DEBUG][1] Changed recording filename from f:\Recordings\Family Guy\Family Guy_20110727_17001730.ts to f:\Recordings\Family Guy\Family Guy-Jungle Love-20110727_17001730.ts". so that one appears to have been successful, but the recording disappeared from the database just the same.

regarding your suggestion #2 to make sure both files exist at the same time before doing the rename, that'd be fine if I was transcoding or copying the file, but all I'm doing is renaming the file. in his original notes on the -rename function, sub advised renaming the file first.

sub, can you shed any light on why I'm having such a hard time with this?
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
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,740
Threads: 767
Joined: Nov 2003
#4
2011-07-30, 06:55 PM
What was the general sequence of events? ie, was the file on disk renamed before or after the after NScriptHelper.exe was called?
johnsonx42
Offline

Posting Freak

Posts: 7,298
Threads: 189
Joined: Sep 2008
#5
2011-07-30, 09:14 PM
I was renaming the file first, then calling NScriptHelper -rename, per your instructions.

However, I've now discovered it works only if I call NScriptHelper -rename first, then rename the file.
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
johnsonx42
Offline

Posting Freak

Posts: 7,298
Threads: 189
Joined: Sep 2008
#6
2011-07-30, 10:08 PM (This post was last modified: 2011-07-31, 07:47 PM by johnsonx42.)
ok, now that I have this working, I see that a recording renamed this way loses it's Watched indicator and Resume point. Could you maybe pretty please enhance NScriptHelper so that it preserves this?

by the way, in case anyone is curious, here's what I've come up with to add the episode name to a recording file in postprocessing.bat, while ensuring that comskip is finished with the file first (which runs in parallelprocessing.bat), and that no one is watching the file:
Code:
@echo off
cd \users\public\npvr\scripts

set NSHelper=C:\Progra~1\NPVR\NScriptHelper.exe

REM check if comskip has run on this file; if not this must be a pbs channel where comskip doesn't run, so just skip to renaming
:checkcomskip
if not exist "%~dpn1.log" goto makename

REM ok, comskip has run, but could still be running so wait til the .edl shows up, then continue
:checkedl
sleep 30
if not exist "%~dpn1.edl" goto checkedl

REM get rid of excess comskip files... we only need the .edl
del "%~dpn1.log"
del "%~dpn1.txt"
del "%~dpn1.logo.txt"

:makename

REM now let's get the show title and subtitle, then sanitize them
set subtitle=?
FOR /F "tokens=*" %%i in ('%NSHelper% -title "%~f1"') do SET title=%%i
FOR /F "tokens=*" %%i in ('%NSHelper% -subtitle "%~f1"') do SET subtitle=%%i
set title=%title:?=-%
set title=%title:/=-%
set title=%title:\=-%
set title=%title::=-%

set subtitle=%subtitle:?=-%
set subtitle=%subtitle:/=-%
set subtitle=%subtitle:\=-%
set subtitle=%subtitle::=-%

REM pull the original timestamp
echo %1 > %3.tmp
For /F "eol=; tokens=1,2,3* delims=_,." %%i in (%3.tmp) Do SET timestamp=%%j_%%k
del %3.tmp

REM now make a new name
set newname=%title%-%subtitle%-%timestamp%

REM ok, ready to rename the file... but first check to make sure no one is watching it!
REM try renaming the file to the same name, see if gets an error
:checkopen
ren %1 "%~nx1"
if errorlevel 1 goto waitandcheck
goto rename
:waitandcheck
REM if we got here, the rename failed so wait a minute and try again
sleep 60
goto checkopen

:rename
REM update the database and rename the files
%NSHelper% -rename %1 "%~dp1%newname%%~x1"
ren "%~f1" "%newname%%~x1"
ren "%~dpn1.edl" "%newname%.edl"

type ..\logs\nscripthelper.log >> rename.log
some bits are lifted from SANGER_A2's batch files (thanks!). like all my batch code, some bits may do things the hard or ugly way because I just don't write all that much batch code. I honestly do not completely understand the bit of code that gets the timestamp out of the original file name, but it works.
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
johnsonx42
Offline

Posting Freak

Posts: 7,298
Threads: 189
Joined: Sep 2008
#7
2011-08-02, 03:40 AM
sub, I'm not sure if you saw this little request:
johnsonx42 Wrote:...I see that a recording renamed this way loses it's Watched indicator and Resume point. Could you maybe pretty please enhance NScriptHelper so that it preserves this?
no problem if it's not something you can do easily, just wanted to make sure you saw it.
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
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,740
Threads: 767
Joined: Nov 2003
#8
2011-08-02, 03:45 AM
Busy with day job stuff right now, but remind me in a few days and I'll add it.
johnsonx42
Offline

Posting Freak

Posts: 7,298
Threads: 189
Joined: Sep 2008
#9
2011-08-02, 03:46 AM
cool, thanks.
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
johnsonx42
Offline

Posting Freak

Posts: 7,298
Threads: 189
Joined: Sep 2008
#10
2011-08-30, 06:00 AM
forgot to remind you about the request above... Perhaps now that 2.2.6 is out and you have nothing at all to occupy your time? Wink
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
« 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
  how to get NextPVR to rename the recordings to S01E01 bader515 3 1,329 2019-04-21, 01:42 AM
Last Post: pkscout
  Skinning question - Adding more listings, making it fit Rage321 3 1,501 2019-04-21, 01:05 AM
Last Post: Rage321
  NScriptHelper Question scJohn 1 1,089 2018-06-12, 05:56 PM
Last Post: sub
  NScriptHelper KNet 2 1,463 2016-07-31, 12:29 AM
Last Post: KNet
  Easy way to rename channels rykr 2 1,440 2015-10-24, 04:39 PM
Last Post: rykr
  Rename to mkv extension removes recording listing Esteban 1 1,403 2015-10-11, 05:42 AM
Last Post: sub
  NScriptHelper documentation? Reddwarf 7 2,740 2015-09-06, 09:29 PM
Last Post: Reddwarf
  nscripthelper -rename removed recording from db NYPlayer 2 1,755 2014-11-18, 08:08 PM
Last Post: NYPlayer
  Rename or move based on Genre kitehigh 3 1,604 2014-03-10, 06:49 PM
Last Post: sub
  Add -start_time option to NScriptHelper??? rglover 1 1,138 2013-10-04, 11:40 PM
Last Post: sub

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

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

Linear Mode
Threaded Mode