Results 1 to 8 of 8

Thread: NScriptHelper Q

  1. #1
    Join Date
    Jul 2011
    Location
    VA US
    Posts
    82

    NScriptHelper Q

    I'm trying to do a little post processing logic and only want specific shows processed. Is it possible, and if so, how would I go about getting just the recording title as a variable? I know I can use "%1" to get the full path and file name, but is there a easy way to just get the title?

    I've searched light and low and I'm just not finding it... maybe it's not possible? or maybe my search skills lack?

    Snag
    NPVR 3.3.8/Win7ProX64/Intel Core 2 Quad Yorkfield 3.0 GHz/HDHR/AVerMedia H826 Hybrid/HVR-950/Schedules Direct

  2. #2
    Join Date
    Sep 2008
    Location
    California
    Posts
    5,838
    http://forums.gbpvr.com/showthread.p...127#post414127

    to get the title into the variable 'title' you'd do:
    Code:
    FOR /F "tokens=*" %%i in ('%NSHelper% -title "%~f1"') do SET title=%%i
    (edit: I forgot to mention that command assumes you have the variable 'NSHelper' set to the full path and file name of NScriptHelper.exe)
    Last edited by johnsonx42; 2012-04-13 at 10:55 PM.
    NPVR Tech Support Sticky - - http://forums.gbpvr.com/showthread.p...931#post480931
    ---------------------------
    my config: NPVR 3.3.8/Win7Pro/Athlon II X3-440/radeon hd4550/hvr-2250/hvr-850/TimeWarner QAM, OTA ATSC (if I ever get my antenna working right again)/Schedules Direct

  3. #3
    Join Date
    Jul 2011
    Location
    VA US
    Posts
    82
    No joy ,bat files aren't my strong point obviously.

    When I tired a stripped stripped down script with that code it craps out on the code. the write to the log only shows "ECHO is off.", it never gets to the next line echo "-----". I tired it without the single quotes too with the same result. Could it be because I'm using Win7x64? Here's the stripped down code I'm testing with.
    Code:
    @ECHO off
    set DBPath="C:\Users\Public\NPVR\npvr.db3"
    set NSHelper=C:\Program Files (x86)\NPVR\NScriptHelper.exe
    set title=
    
    ECHO >> postprocessing.log
    FOR /F "tokens=*" %%i in ('%NSHelper% -title "%~f1"') do SET title=%%i
    ECHO ------------------------------------------------------------ >> postprocessing.log
    ECHO Recorded show title is - "%title%" >> postprocessing.log
    ECHO ------------------------------------------------------------ >> postprocessing.log
    ECHO Recorded channel is "%2" >> postprocessing.log
    ECHO ------------------------------------------------------------ >> postprocessing.log
    ECHO Post processing script for recording "%~f1" completed at %time% >> postprocessing.log
    :END
    Thanks for bearing with me

    Snag
    Last edited by snagglewest; 2012-04-14 at 02:22 AM.
    NPVR 3.3.8/Win7ProX64/Intel Core 2 Quad Yorkfield 3.0 GHz/HDHR/AVerMedia H826 Hybrid/HVR-950/Schedules Direct

  4. #4
    Join Date
    Sep 2008
    Location
    California
    Posts
    5,838
    try the set command this way:
    Code:
    set NSHelper=C:\Progra~1\NPVR\NScriptHelper.exe
    (though on a 64-bit system, program files (x86) might be Progra~2. You can verify it at a command prompt by typing "dir c:\ /x")
    NPVR Tech Support Sticky - - http://forums.gbpvr.com/showthread.p...931#post480931
    ---------------------------
    my config: NPVR 3.3.8/Win7Pro/Athlon II X3-440/radeon hd4550/hvr-2250/hvr-850/TimeWarner QAM, OTA ATSC (if I ever get my antenna working right again)/Schedules Direct

  5. #5
    Join Date
    Jul 2011
    Location
    VA US
    Posts
    82
    I used "Progra~2" which is what DOS says it is, and even tried replacing the NSHelper variable with the full path. It's at least running now, but it's still not returning a title, just "".

    Code:
    FOR /f "tokens=*" %%i in ('C:\Progra~2\NPVR\NScriptHelper.exe -title "%~f1"') do SET title=%%i
    ECHO title is - "%title%" >> postprocessing.log
    I'm stumped

    Snag
    NPVR 3.3.8/Win7ProX64/Intel Core 2 Quad Yorkfield 3.0 GHz/HDHR/AVerMedia H826 Hybrid/HVR-950/Schedules Direct

  6. #6
    Join Date
    Sep 2008
    Location
    California
    Posts
    5,838
    here's my old renaming batch file, it does work 99% of the time, see what you can get from it:
    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 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
    echo file open... waiting...
    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
    NPVR Tech Support Sticky - - http://forums.gbpvr.com/showthread.p...931#post480931
    ---------------------------
    my config: NPVR 3.3.8/Win7Pro/Athlon II X3-440/radeon hd4550/hvr-2250/hvr-850/TimeWarner QAM, OTA ATSC (if I ever get my antenna working right again)/Schedules Direct

  7. #7
    Join Date
    Aug 2005
    Location
    Houston
    Posts
    4,395
    @for /f "delims=_" %%f in ("%~1") do @echo "%%~nf"

    gives you title from the filename... [all chars of filename up to first _, which should be dos safe chars already]
    1. C2D 1.6ghz XPPro, ATI HD4650lowprofile,Cat 8.11, Aver M780, KWorld PCI 120, MVP, GBpvr 1.4.7, Comm. Skin. VFD, Imon plugin w/SmartieLCD[custom]
    2. C2D 2.53, XPPro, ATI HD3450, Kworld 330U, Comm. Skin, GBpvr 1.4.7
    Author: Pvrx2 utils- Simple Archiver.bat, NTFSLinker [Junction gui]
    Universal Util: MCE Remote no-software trick and Shutdown Protector
    3. Zotac Mini ITX G41[$84] + ati 650pro pcie[$29], Celeron duo[$22] BDRom drive [$48]

  8. #8
    Join Date
    Jul 2011
    Location
    VA US
    Posts
    82
    Arrrrrggggg!

    Well, I've been playing with this for 2 days and testing it a hundred times using a 1 minute "manual" recording. Much to my chagrin I just discovered a "manual" recording, while showing "Default" as the title, actually returns a title of "". Apparently NPVR shows "Default" whenever there is no actual title.

    Hopefully I can save someone in the future from loosing a little hair

    Snag
    NPVR 3.3.8/Win7ProX64/Intel Core 2 Quad Yorkfield 3.0 GHz/HDHR/AVerMedia H826 Hybrid/HVR-950/Schedules Direct

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •