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 … 309 310 311 312 313 … 433 Next »
NScriptHelper Q

NScriptHelper Q
snagglewest
Offline

Senior Member

VA USA
Posts: 361
Threads: 60
Joined: Jul 2011
#1
2012-04-13, 04:47 PM
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? Smile

Snag
NextPVR V6.1.5.231022 - Ubuntu 22.04 VM / 4 core / 8Gb memory
HDHR Prime X2 / HDFX-2 /Schedule Direct / 2X Pi4 + & 3X Pi3 LibreELEC Kodi clients
Server - TrueNAS/ SuperMicro MBD-X10SL7-F MB / Xeon E3-1246 / 32Gb Unbuffered ECC / 8 X 4TB RAIDZ2
johnsonx42
Offline

Posting Freak

Posts: 7,298
Threads: 189
Joined: Sep 2008
#2
2012-04-13, 05:00 PM (This post was last modified: 2012-04-13, 09:55 PM by johnsonx42.)
http://forums.nextpvr.com/showthread.php...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)
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
snagglewest
Offline

Senior Member

VA USA
Posts: 361
Threads: 60
Joined: Jul 2011
#3
2012-04-14, 01:01 AM (This post was last modified: 2012-04-14, 01:22 AM by snagglewest.)
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 Smile

Snag
NextPVR V6.1.5.231022 - Ubuntu 22.04 VM / 4 core / 8Gb memory
HDHR Prime X2 / HDFX-2 /Schedule Direct / 2X Pi4 + & 3X Pi3 LibreELEC Kodi clients
Server - TrueNAS/ SuperMicro MBD-X10SL7-F MB / Xeon E3-1246 / 32Gb Unbuffered ECC / 8 X 4TB RAIDZ2
johnsonx42
Offline

Posting Freak

Posts: 7,298
Threads: 189
Joined: Sep 2008
#4
2012-04-14, 02:51 AM
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")
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
snagglewest
Offline

Senior Member

VA USA
Posts: 361
Threads: 60
Joined: Jul 2011
#5
2012-04-14, 05:26 PM
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 Sad

Snag
NextPVR V6.1.5.231022 - Ubuntu 22.04 VM / 4 core / 8Gb memory
HDHR Prime X2 / HDFX-2 /Schedule Direct / 2X Pi4 + & 3X Pi3 LibreELEC Kodi clients
Server - TrueNAS/ SuperMicro MBD-X10SL7-F MB / Xeon E3-1246 / 32Gb Unbuffered ECC / 8 X 4TB RAIDZ2
johnsonx42
Offline

Posting Freak

Posts: 7,298
Threads: 189
Joined: Sep 2008
#6
2012-04-14, 05:59 PM
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
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
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#7
2012-04-14, 10:38 PM
@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]
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
snagglewest
Offline

Senior Member

VA USA
Posts: 361
Threads: 60
Joined: Jul 2011
#8
2012-04-14, 11:54 PM
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 Smile

Snag
NextPVR V6.1.5.231022 - Ubuntu 22.04 VM / 4 core / 8Gb memory
HDHR Prime X2 / HDFX-2 /Schedule Direct / 2X Pi4 + & 3X Pi3 LibreELEC Kodi clients
Server - TrueNAS/ SuperMicro MBD-X10SL7-F MB / Xeon E3-1246 / 32Gb Unbuffered ECC / 8 X 4TB RAIDZ2
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  NScriptHelper Question scJohn 1 1,115 2018-06-12, 05:56 PM
Last Post: sub
  NScriptHelper KNet 2 1,513 2016-07-31, 12:29 AM
Last Post: KNet
  NScriptHelper documentation? Reddwarf 7 2,830 2015-09-06, 09:29 PM
Last Post: Reddwarf
  nscripthelper -rename removed recording from db NYPlayer 2 1,784 2014-11-18, 08:08 PM
Last Post: NYPlayer
  Add -start_time option to NScriptHelper??? rglover 1 1,175 2013-10-04, 11:40 PM
Last Post: sub
  NScriptHelper.exe functions shaunpatrick77 8 3,176 2012-12-15, 05:50 PM
Last Post: gEd
  2.3.6 - nscripthelper crash Nistrod 3 1,712 2012-03-05, 02:44 AM
Last Post: Nistrod
  NScriptHelper -rename making me insane johnsonx42 12 6,165 2012-02-09, 01:57 PM
Last Post: BTJustice

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

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

Linear Mode
Threaded Mode