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:-
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.
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.