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 … 353 354 355 356 357 … 433 Next »
Manipulating "recording-backup.xml"

Manipulating "recording-backup.xml"
SANGER_A2
Offline

Member

Posts: 51
Threads: 8
Joined: Nov 2007
#1
2011-07-11, 08:45 PM
I want to be able to rename my recorded files based on the episode subtitle eg "American Chopper_20110530_20002100.mp4" (after processing) becomes "American Chopper - Fire Bike (Part 1)".

Of course, I'll also need to update the db3 and xml file afterwards. I played around with the db3 file and realised that the episode information for recordings is not stored in there, but in the "recording-backup.xml" file (Sub correct me if I'm wrong here) using the Subtitle tag for the episode title.

So basically, after my postprocessing.bat has finished encoding with handbrake I want it to:-
Code:
search in npvr.db3 for %~f1 & replace it with %~dpn1.mp4
[COLOR="blue"]search in recording-backup.xml for %~f1 & replace it with %~dpn1.mp4
search in recording-backup.xml for %~dpn1.mp4 and output [showname] to a txt file
search in recording-backup.xml for %~dpn1.mp4 and output [subtitle] it to a txt file[/COLOR]
check if the subtitle txt file is empty and if it is end the bat file
get the showname from the txt file and into %showname% variable
get the subtitle from the txt file and into %subtitle% variable
Put "%~dp1%showname% - %subtitle%.mp4" into %newfilename% variable
Check if %newfilename% already exists, if so, put (2) after it
rename recording to %newfilename%

search in npvr.db3 for  %~dpn1.mp4 & replace it with %newfilename%
[color=blue]search in recording-backup.xml for  %~dpn1.mp4 & replace it with %newfilename%[/color]

The commands in blue are the ones I'm not sure how to do! Any help would be awesome.

I've had a look into "XMLStarlet", but I wanted to know if there was anything easier to use or that's recommended. I've used sqlite3.exe with no issues, but not tried to manipulate XML files before.
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,789
Threads: 769
Joined: Nov 2003
#2
2011-07-11, 08:48 PM
NPVR never looks at recordings-backup.xml. It is effectively a back up of what is in the database, and only used for reimporting you recordings if (for example) you database became corrupt and you had to start again from an empty database.
SANGER_A2
Offline

Member

Posts: 51
Threads: 8
Joined: Nov 2007
#3
2011-07-11, 09:09 PM
sub Wrote:NPVR never looks at recordings-backup.xml. It is effectively a back up of what is in the database, and only used for reimporting you recordings if (for example) you database became corrupt and you had to start again from an empty database.
Thanks a lot Sub. That makes it easier! I just had a look in "event_details" and saw all the data in there. Pity it's in XML format, but I'm sure there is some clever XML that can get just the data I want depending on the tags.

Sub, I'm assuming you're an SQL guru as well as coding guru! Do you already do something like this and you can drop a few hints to get me started? Or should I start googling? Smile I'm not new to SQL so I'm sure there is a way, even if I have to do a search for title> and file the char position and use mid etc etc!
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,789
Threads: 769
Joined: Nov 2003
#4
2011-07-11, 09:12 PM
Sorry, I'm no SQL guru. Pretty much all my stuff is done from code, and only uses simple SQL queries.
SANGER_A2
Offline

Member

Posts: 51
Threads: 8
Joined: Nov 2007
#5
2011-07-11, 09:27 PM
sub Wrote:Sorry, I'm no SQL guru. Pretty much all my stuff is done from code, and only uses simple SQL queries.
Unfortunately I'm used to MS-SQL and SQLite doesn't have as many functions as that. It doesn't even have an Instr. I'll have to output the event_details to a text file, use a VBS to edit it and get out data as I wish and then edit the text file to have SQLite update the database. Annoying really but not majorly hard to do! I want it all to be pretty transparent as to what is being done in case anyone else want to use it and also so I can make changes easily myself later on.

I know this is totally off-topic, but I'm totally chuffed about it. I just won my replacement NPVR machine for £30 and will be picking it up soon. Once I've pinched some RAM from work and slotted in an old SATA HDD it will run much better than my current P4 with DDR1 RAM!Smile
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,789
Threads: 769
Joined: Nov 2003
#6
2011-07-11, 09:38 PM
Here is a utility that might help you.

Get the title of recording from a filename:
NScriptHelper.exe -title <filename>

Get the subtitle of recording from a filename:
NScriptHelper.exe -subtitle <filename>

Get the description of recording from a filename:
NScriptHelper.exe -description <filename>

Change the filename of a recording the database:
NScriptHelper.exe -rename <original_filename> <new_filename>

This last one only updates the filename in database. Its up to you to rename the file on the filesystem. Probably best to rename the file before calling this.
SANGER_A2
Offline

Member

Posts: 51
Threads: 8
Joined: Nov 2007
#7
2011-07-12, 05:35 AM
sub Wrote:Here is a utility that might help you.

Get the title of recording from a filename:
NScriptHelper.exe -title <filename>

Get the subtitle of recording from a filename:
NScriptHelper.exe -subtitle <filename>

Get the description of recording from a filename:
NScriptHelper.exe -description <filename>

Change the filename of a recording the database:
NScriptHelper.exe -rename <original_filename> <new_filename>

This last one only updates the filename in database. Its up to you to rename the file on the filesystem. Probably best to rename the file before calling this.
Wow! You just saved me hours of messing around there! Smile Assuming it works okay on my system anyway! Thanks alot Sub.
JimF
Offline

Member

Posts: 217
Threads: 19
Joined: Oct 2005
#8
2011-07-13, 08:00 PM (This post was last modified: 2011-07-13, 08:08 PM by JimF.)
SANGER_A2 Wrote:Wow! You just saved me hours of messing around there! Smile Assuming it works okay on my system anyway! Thanks alot Sub.
Will you make that available for download? That would be very interesting for a lot of people in the U.S.
HDHomeRun Prime, Win7 64-bit, NPVR 3.4.8
gEd
Offline

Posting Freak

London
Posts: 3,518
Threads: 100
Joined: Jan 2005
#9
2011-07-13, 08:44 PM
make sure to check out this batch file

http://forums.nextpvr.com/showthread.php...recordings
“If this is the way Queen Victoria treats her prisoners, she doesn't deserve to have any.”
SANGER_A2
Offline

Member

Posts: 51
Threads: 8
Joined: Nov 2007
#10
2011-07-13, 09:15 PM
gEd Wrote:make sure to check out this batch file

http://forums.nextpvr.com/showthread.php...recordings
Nice. Thanks very much. That's pretty much what I would have been doing if Sub hadn't posted that app!

Whatever I end up using I'll post here. I've gotta spend the next day or two moving over to my new machine and then I can start experimenting.

Cheers.
« 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
  Recording movies / TV to XBMC directory stucture spinnaker 10 3,710 2024-06-03, 03:56 AM
Last Post: Rod Hutchinson
  Not recording errors vidwiz 4 1,085 2024-04-17, 05:39 PM
Last Post: mvallevand
  Add Series/Episode Info to Recording Metadata andrewj 2 1,148 2023-11-20, 03:42 PM
Last Post: sub
  Recording to a network drive woes. 2leftfeet 12 7,362 2022-04-05, 08:03 PM
Last Post: mvallevand
  device needed for recording David209 2 1,766 2021-04-04, 08:47 AM
Last Post: David209
  PC not going to sleep after recording LeoL 7 3,400 2021-04-01, 07:17 PM
Last Post: Handy.Man
  HDHomerun recording bizzarely not working Jean0987654321 3 2,111 2021-03-27, 03:23 PM
Last Post: Jean0987654321
Video Restrict Recording Space foucomm 1 1,362 2021-01-30, 09:25 PM
Last Post: mvallevand
  Directory dropdown on the recording edit dialog MicahMakenzie 1 1,544 2021-01-11, 04:37 PM
Last Post: Graham
  Recording service stopped or not running at scheduled time MattInetroit 3 1,943 2021-01-08, 12:03 AM
Last Post: mvallevand

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

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

Linear Mode
Threaded Mode