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 … 397 398 399 400 401 … 433 Next »
Is there a way to auto rename recorded files?

Is there a way to auto rename recorded files?
GSpanFan
Offline

Junior Member

Posts: 47
Threads: 10
Joined: Apr 2005
#1
2010-09-16, 04:11 AM
Does anyone have a way to rename a recorded file name to include other program information such as the episode name or number? I used to use the addepisode or renamerecording utilities in GBPVR and this is the one item of functionality that I miss after migrating to NPVR, since I often stream recordings to my PS3. The default file naming scheme with the recorded dates and times is not always helpful when browsing through the recordings.

I've tinkered a bit with SQL to see if I could pull this information from the NPVR database, rename the file, and then update the database to point to the new file name. However, I am not the greatest programmer (I was trying to create a batch file to do this in post-processing) and don't want to reinvent the wheel if someone else has already developed a way to do this.

Any ideas?
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 53,205
Threads: 958
Joined: May 2006
#2
2010-09-16, 04:20 AM
NPVR no longer uses traditional database practice and instead embeds XML so this kind of operation is not trivial. If sub puts the series and episode number back in the XML I would like to create a utility to do this.

Martin
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#3
2010-09-16, 03:25 PM
huh?
i was seeing some odd things in db too...trying to edit an entry..
any info on the new db architecture?
where is stuff stored now?
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#4
2010-09-16, 03:57 PM
nm...i now see where the embedded data is, and the epg event stuff...
kinda cumbersome in a db editor cuz of multilines, but i understand why it's needed..
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
JimF
Offline

Member

Posts: 217
Threads: 19
Joined: Oct 2005
#5
2010-10-14, 06:55 PM
I hope sub can support you on this, since I need automatic renaming in order to include sub-titles too. Otherwise, NPVR is not of much use to me.
HDHomeRun Prime, Win7 64-bit, NPVR 3.4.8
martint123
Offline

Posting Freak

UK, East Yorkshire
Posts: 4,658
Threads: 208
Joined: Nov 2005
#6
2010-10-14, 07:39 PM
I guess XML has been out for quite a time now, are there any simple tools for querying/update embedded XML within a database?
Wouldn't it be handy to have an extension to SQL to make XML appear as pseudo fields ??
Northpole
Offline

Senior Member

Posts: 333
Threads: 34
Joined: Aug 2007
#7
2010-10-14, 09:50 PM (This post was last modified: 2010-10-16, 05:35 PM by Northpole.)
I put together a batchfile that I have setup to run everynight that renames the files with title (date recorded) sub-title. Also renames the folder.jpg artwork and creates a show information xml file that npvr can read. It moves the files up one directory tree and deletes the subdirectory that NPVR created.

Can't take any credit for the sql queries which came from http://forums.gbpvr.com//showthread.php?...n-NPVR.db3

This batchfile requires ssed.exe from the above link (Post #3) and sqlite3.exe. Also credit goes to pBS for the registry query. Put the batchfile, ssed and sqlite3 together in any subdirectory.

heres the batchfile:

Code:
@echo off
title Automatic TS File Rename

set progdir=%~dp0
for /f "usebackq skip=4 tokens=1,2,*" %%i in (`reg query hklm\SOFTWARE\npvr /v "DataDirectory"`) do set db=%%~k\npvr.db3
"%progdir%\sqlite3.exe" "%db%" "SELECT filename from SCHEDULED_RECORDING where status = '2';" > "%progdir%\fname.txt"

:checkfname
if not exist "%progdir%fname.txt" ping 1.1.1.1 -n 1 -w 2000 >NUL & goto :checkfname
for /f "usebackq tokens=*" %%i in ("%progdir%fname.txt") do call :Convert "%%i"

"C:\Program Files\NPVR\NextPVR.exe" -updateepgonly
goto :eof

:Convert

set sdrive=""
set spath=""
set sname=""
set sdate=""
set smonth=""
set sday=""
set syear=""
set npvrname=""
set npvrsub=""
set tmpname=%random%

for /f %%i in ("%~t1") do set sdate=%%i
for /f "tokens=1,2,3 delims=/" %%i in ("%sdate%") do set smonth=%%i& set sday=%%j& set syear=%%k
for /f "tokens=1,2,3 delims=\" %%i in ("%~1") do set sdrive=%%i& set spath=%%j& set sname=%%k

"%progdir%sqlite3.exe" "%db%" "SELECT event_details from SCHEDULED_RECORDING where status = '2' and filename = '%~1';" | "%progdir%ssed.exe" "s/'//g" > "%progdir%details1.txt"

:checkdetails1
if not exist "%progdir%details1.txt" ping 1.1.1.1 -n 1 -w 2000 >NUL & goto :checkdetails1
"%progdir%ssed.exe" "s/://g" < "%progdir%details1.txt" > "%progdir%details2.txt"

:checkdetails2
if not exist "%progdir%details2.txt" ping 1.1.1.1 -n 1 -w 2000 >NUL & goto :checkdetails2
"%progdir%ssed.exe" "s/?//g" < "%progdir%details2.txt" > "%progdir%details3.txt"

:checkdetails3
if not exist "%progdir%details3.txt" ping 1.1.1.1 -n 1 -w 2000 >NUL & goto :checkdetails3
"%progdir%ssed.exe" "s/*//g" < "%progdir%details3.txt" > "%progdir%details.txt"

:checkdetails
if not exist "%progdir%details.txt" ping 1.1.1.1 -n 1 -w 2000 >NUL & goto :checkdetails
"%progdir%ssed.exe" -n -e "s/.*<Title>\(.*\)<\/Title>.*/\1/p" < "%progdir%details.txt" > "%progdir%title.txt"
"%progdir%ssed.exe" -n -e "s/.*<SubTitle>\(.*\)<\/SubTitle>.*/\1/p" < "%progdir%details.txt" > "%progdir%subtitle.txt"

:checktitle
if not exist "%progdir%title.txt" ping 1.1.1.1 -n 1 -w 2000 >NUL & goto :checktitle
for /f "usebackq tokens=*" %%i in ("%progdir%title.txt") do set npvrname=%%i

set fname=%sname%

echo ^<Title^> > "%~dpn1.xml"
echo ^<FullTitle^> >> "%~dpn1.xml"
"%progdir%\sqlite3.exe" "%db%" "SELECT name from SCHEDULED_RECORDING where status = '2' and filename = '%~1';" >> "%~dpn1.xml"
echo ^</FullTitle^> >> "%~dpn1.xml"

if "%fname%" NEQ "%npvrname%" goto :blank

:checksub
if not exist "%progdir%\subtitle.txt" ping 1.1.1.1 -n 1 -w 2000 >NUL & goto :checksub
for /f "usebackq tokens=*" %%i in ("%progdir%\subtitle.txt") do set npvrsub=%%i

if ""==%npvrsub% goto :nosub

set fname=%sname% (%syear%-%smonth%-%sday%) %npvrsub%

echo ^<SubTitle^> >> "%~dpn1.xml"
"%progdir%sqlite3.exe" "%db%" "SELECT event_details from SCHEDULED_RECORDING where status = '2' and filename = '%~1';" | "%progdir%ssed.exe" -n -e "s/.*<SubTitle>\(.*\)<\/SubTitle>.*/\1/p" >> "%~dpn1.xml"
echo ^</SubTitle^> >> "%~dpn1.xml"
goto :desc

:nosub
echo ^<SubTitle^>^</SubTitle^> >> "%~dpn1.xml"

:desc
echo ^<Description^> >> "%~dpn1.xml"
"%progdir%sqlite3.exe" "%db%" "SELECT event_details from SCHEDULED_RECORDING where status = '2' and filename = '%~1';" | "%progdir%ssed.exe" -n -e "s/.*<Description>\(.*\)<\/Description>.*/\1/p" >> "%~dpn1.xml"
echo ^</Description^> >> "%~dpn1.xml"
goto :finish

:blank
echo ^<SubTitle^>^</SubTitle^> >> "%~dpn1.xml"
echo ^<Description^>^</Description^> >> "%~dpn1.xml"

:finish
echo ^</Title^> >> "%~dpn1.xml"

if exist "%sdrive%\%spath%\%fname%.ts" rename "%sdrive%\%spath%\%fname%.ts" "%fname%-%tmpname%.ts"
if exist "%sdrive%\%spath%\%fname%.jpg" rename "%sdrive%\%spath%\%fname%.jpg" "%fname%-%tmpname%.jpg"
if exist "%sdrive%\%spath%\%fname%.xml" rename "%sdrive%\%spath%\%fname%.xml" "%fname%-%tmpname%.xml"

move %1 "%sdrive%\%spath%"
rename "%sdrive%\%spath%\%~n1.ts" "%fname%.ts"

move "%~dpn1.xml" "%sdrive%\%spath%"
rename "%sdrive%\%spath%\%~n1.xml" "%fname%.xml"

if exist "%~dp1folder.jpg" move "%~dp1folder.jpg" "%sdrive%\%spath%"
if exist "%sdrive%\%spath%\folder.jpg" rename "%sdrive%\%spath%\folder.jpg" "%fname%.jpg"

rd "%sdrive%\%spath%\%sname%

if exist "%progdir%fname.txt" del "%progdir%fname.txt"
if exist "%progdir%details.txt" del "%progdir%details.txt"
if exist "%progdir%details1.txt" del "%progdir%details1.txt"
if exist "%progdir%details2.txt" del "%progdir%details2.txt"
if exist "%progdir%details3.txt" del "%progdir%details3.txt"
if exist "%progdir%title.txt" del "%progdir%title.txt"
if exist "%progdir%subtitle.txt" del "%progdir%subtitle.txt"

goto :eof

Works for WinXP MCE. Hope this help.

Haven't got around to looking into updating the npvr sql database after the file is moved.
carpeVideo
Offline

Posting Freak

Posts: 824
Threads: 23
Joined: Dec 2006
#8
2010-10-14, 10:14 PM (This post was last modified: 2010-10-14, 10:20 PM by carpeVideo.)
guidePlus will do it on a nightly basis for either gbpvr on npvr including season and episode depending on your epg source. For npvr it does require an additional table and trigger(which it will create for you) in the database and an epg delete / refresh to get the currently scheduled recordings renamed. With gbpvr it will rename existing recordings but for npvr it will not rename recordings finished before you add the trigger.

http://gbpvr.com/pmwiki/pmwiki.php/Utility/GuidePlus

If you don't want the guide part then you could always just ignore the generated XML file and use it as a rename / mover only
Northpole
Offline

Senior Member

Posts: 333
Threads: 34
Joined: Aug 2007
#9
2010-10-14, 10:27 PM
carpeVideo Wrote:guidePlus will do it on a nightly basis for either gbpvr on npvr including season and episode depending on your epg source. For npvr it does require an additional table and trigger(which it will create for you) in the database and an epg delete / refresh to get the currently scheduled recordings renamed. With gbpvr it will rename existing recordings but for npvr it will not rename recordings finished before you add the trigger.

http://gbpvr.com/pmwiki/pmwiki.php/Utility/GuidePlus

If you don't want the guide part then you could always just ignore the generated XML file and use it as a rename / mover only


Thanks, I'll check that out.
Lastchoice
Offline

Junior Member

Posts: 2
Threads: 0
Joined: Oct 2010
#10
2010-10-26, 08:29 PM
I've been looking for this exact same capability and guidePlus looks like what I need, however it throws a SQLite exception on my 64-bit Windows 7 instance.

I can get the app to run on seperate 32-bit PC, however it fails to find the nPVR database on the remote HTPC.

Does guidePlus work on 64-bit machines? If not is there a way to run it on a PC seperate from the nPVR installation?

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
  Auto Update EPG not running as scheduled? BairStrokes 2 1,892 2021-03-26, 12:02 PM
Last Post: NumberFive
  Auto Update EPG not running as scheduled Bobbybear 10 3,942 2020-10-24, 09:24 AM
Last Post: Bobbybear
  Possible to record in different format than .ts files? gadgetgaz 29 13,720 2020-10-04, 03:05 PM
Last Post: Ehrlichia
  Log files Brucek2839 1 1,280 2020-03-23, 02:37 AM
Last Post: mvallevand
  Import recorded tv shows to NPVR mattman1968 9 6,300 2020-03-03, 12:57 PM
Last Post: Jimixter
  Will not play recorded video on 1st computer but will play same video on second compu Krepps 5 2,270 2020-02-28, 05:33 PM
Last Post: Krepps
  Auto delete recordings Brucek2839 3 1,889 2020-01-20, 09:12 PM
Last Post: mvallevand
  Artwork for Recorded Shows ChrisI 6 2,638 2020-01-12, 08:57 PM
Last Post: sub
  Generate missing thumbnails for video files imported into NextPVR Jimixter 7 3,278 2019-12-17, 01:32 PM
Last Post: mvallevand
  auto populate EPG source KarterJK 6 3,303 2019-12-03, 05:03 PM
Last Post: KarterJK

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

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

Linear Mode
Threaded Mode