NextPVR Forums
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 13 14 15 16 17 … 93 Next »
(Yet Another) Rename Helper script for GBPVR & NPVR

 
  • 0 Vote(s) - 0 Average
(Yet Another) Rename Helper script for GBPVR & NPVR
pvruser
Offline

Member

Posts: 230
Threads: 42
Joined: May 2007
#1
2011-07-18, 01:10 AM (This post was last modified: 2011-10-06, 04:00 AM by pvruser.)
I'm still using 1.4.7 and experimenting with 2.1.x for an upgrade, so I've written a perl script that I'm using in Postprocessing or whenever something goes wrong and I need to manually update the recording name and DB. You'll obviously need perl on your system and run it with:

perl renamehelper.pl <args>

Features:
* rename a recording using replacement vars similar to WizRenameRecording and works for NPVR (WizRenameRecording doesn't).
* allows moving files to a different drive or network disk (which is one of the main reasons I wrote it).
* updates the metadata.xml with the correct new path for the renamed file.
* uses metadata.xml, if present and the file isn't found in the DB. There's an import feature for files missing from the DB, it will call the command line for *pvr to do the import.
*goes online to TVRage.com and gets some extra data to allow renaming files with the season and episode number (you'll need to create a sqlite DB using the attached sql table structure).

Since this is still somewhat of a work in progress, I STRONGLY suggest you first experiment with it on your dev machine (or copy the DB to another folder and use the DB option) before using it on your actual TV collection!

EDIT: it's been 2 months since the script has been running without intervention and renaming recordings from tvrage so i'd say it's quite stable.

Enjoy!
GBPVR 1.4.7
3 x HVR-950Q USB OTA ATSC HD TUNER
T2250 @ 2.5 GB RAM + ASUS Moca-AR Calcite
Roku HD + XD
pvruser
Offline

Member

Posts: 230
Threads: 42
Joined: May 2007
#2
2011-07-18, 01:25 AM (This post was last modified: 2011-07-20, 01:07 AM by pvruser.)
Usage in Postprocessing:

Quote:if exist "%dvr_dir%" (
perl renamehelper.pl -v 2 -n -s "%%%~n1%%" -x mp4 -p "%dvr_dir%" -o "%oid%"
) else (
perl renamehelper.pl -v 2 -n -s "%%%~n1%%" -x mp4 -o "%oid%"
)

%dvr_dir% is the optional path to the external/network drive. Always a good idea to check whether it's mounted/plugged in before making the rename call.
GBPVR 1.4.7
3 x HVR-950Q USB OTA ATSC HD TUNER
T2250 @ 2.5 GB RAM + ASUS Moca-AR Calcite
Roku HD + XD
pvruser
Offline

Member

Posts: 230
Threads: 42
Joined: May 2007
#3
2011-07-22, 01:27 AM (This post was last modified: 2011-10-16, 07:47 PM by pvruser.)
Here's the script that I'm using as a scheduled task to move files that couldn't be moved because the network drive was unavailable. This is tweaked for NPVR, but gbpvr will work too as long as you remove the -v 2 argument and update the correct paths.

Quote:rem this needs to be a scheduled task
rem it moves files from the internal drive to the network/usb drive
rem this is normally done automagically in post processing
rem but sometimes it can't be done at that time so we use this

set gbpvr_dir=%ProgramFiles%\NPVR
set utils_dir="%gbpvr_dir%\Third Party\utils"

set user_dir=C:\Users\Public\NPVR
set db="%user_dir%\NPVR.DB3"
set logfile="%user_dir%\logs\move.log"

rem internal drive
set source_dir=D:\temp\npvr
rem external drive
set dvr_dir=O:\temp\dvr

if exist "%dvr_dir%" (

pushd %source_dir%

rem get mp4 files but exclude temp files
rem todo also check for date to avoid touching files still in post processing
for /F "tokens=*" %%i in ('dir /a:-d /b /s /o:d "%source_dir%\*.mp4" ^| findstr /v /i /r /c:"temp\.mp4$"') do call :movefiles "%%i"

popd

rem need this for Roku which runs off the remote machine
copy %db% "%dvr_dir%"

) else (
echo %dvr_dir% unavailable, not moving file
echo %dvr_dir% unavailable, not moving file >> %logfile%

)

goto end


:movefiles

pushd "%user_dir%\scripts"
perl renamehelper.pl -v2 -n -s "%%%~n1%%" -x mp4 -m -p "%dvr_dir%" -e >> %logfile% 2>&1
rem perl renamehelper.pl -v2 -n -s "%%%~n1%%" -x mp4 -p "%dvr_dir%" -o "%oid%" -t -e

rem if file still exists then force move it (might have been unlinked in the DB)
if exist %1 (
perl renamehelper.pl -v2 -n -s "%%%~n1%%" -f %1 -x mp4 -m -p "%dvr_dir%" -e >> %logfile% 2>&1
)
popd

goto end

:end
GBPVR 1.4.7
3 x HVR-950Q USB OTA ATSC HD TUNER
T2250 @ 2.5 GB RAM + ASUS Moca-AR Calcite
Roku HD + XD
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Way to tell programmatically if channel load in from NPVR has finished... gdogg371 3 1,249 2021-03-11, 03:59 PM
Last Post: mvallevand
  Plugins and NPVR. Where do we start? sub 80 59,564 2020-11-26, 10:02 PM
Last Post: mandai
  Test/Development environment for npvr.db3 scJohn 10 2,287 2020-09-04, 09:14 PM
Last Post: scJohn
  Script Helper Utility JavaWiz 2 1,546 2020-05-25, 11:00 AM
Last Post: Graham
  How to extract M3U8 and get matching XMLTV guide data from NPVR almightyj 0 2,139 2018-10-23, 07:24 AM
Last Post: almightyj
  ios app to control npvr ui idea jnbooker15 4 2,809 2015-09-21, 10:19 PM
Last Post: sub
  ios app to control npvr ui idea jnbooker15 0 2,025 2015-09-21, 06:39 PM
Last Post: jnbooker15
  TitanTv Remote Schedule For GBPVR UncleJohnsBand 51 29,283 2015-08-20, 05:11 PM
Last Post: sub
  Couple of questions about hacking npvr.db3 drmargarit 6 3,431 2014-09-08, 02:22 AM
Last Post: sub
  high res (256x256+) npvr icon? reven 15 4,174 2013-09-01, 05:13 AM
Last Post: psycik

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

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

Linear Mode
Threaded Mode