• On Septemer 25, 2018, the VideoReDo message board was moved to the Xenforo forum software. If you encounter any issues, please email us at support@videoredo.com.

NextPVR - Three questions concerning VAP and having it Parse from XML files. Thanks!

#61
I sent you the wrong file. Not sure were the original XML went. So, I am not going to worry about it. Maybe I am mistaken and NPVR never generated one.


OK some kind of mix up here with the VAP executable you're running. Two indications are:

1. When I run with exactly the same input xml for your "burden of proof …" example, I get the uid and recordingFileName elements in the output
2. In my output the season and episode numbers are 2-digits whereas they are single digits in your output.

So either one of two things has happened:
1. I provided the wrong executable in VAPexe138T2.zip
(or)
2. You didn't get the new executable installed in the runtime folder. Before any further changes, run VAP and see what version is displayed at the top.

Windows can make it tricky to replace files in the Program Files (86) folder tree. To be absolutely sure I usually force delete the .exe being replaced, which will require admin permission. Then copy in the new .exe.

Since I can't absolutely rule out that I provided a bogus .exe, I have placed a new one, Ver. 1.38T3, at this download link:
https://vap.videoredo.net/VAPexe138T3.zip
I doubled check. VAP is saying 138T2. I'll go ahead and re-replace the files using your method and VAPexe.138T3.


On a separate question, its been forever since I tried to write anything in Visual Basic. Im trying to eventually build a simple VB.net writer app that will load in and fix some of the older btvxml files in my library. I've completely forgotten how to build the <Project Name=> attribute from VB. I wrote this as a sample test script to write an XML that matches your older .btv format. Here is a script sample.



Dim XmlWrt As XmlWriter = XmlWriter.Create("C:\Users\Jamest\Desktop\Visual basic\MyName.xml", settings)

With XmlWrt

' Write the Xml declaration.
.WriteStartDocument()

' Write the root element.
.WriteStartElement("episode-properties")

' The Show nodes.

.WriteStartElement("title")
.WriteString(txtTitle.Text.ToString())
.WriteEndElement()


.WriteStartElement("Episodetitle")
.WriteString(txtEPTitle.Text.ToString())
.WriteEndElement()
 
Last edited:
#62
VAP is programmed in C# (.net) so I know very little about VB. The structure of your code looks very similar to C# code to write the XML. I can post a snippet of my C# code if you think that would help.

If you could avoid making major replacement-style edits on your posts, I would appreciate it. I find it confusing to go back and find the post is nothing like I remembered. My preference is to make only edits that add something, and prefaced by "EDIT:" to make clear what has changed. Another factor is that I subscribe to this thread to get email when a new post occurs. Just editing an old post doesn't trigger the email so there is the possibility I will miss the new info entirely.
 
Last edited:
#63
Sorry about that. I Didn't realize you were checking the site so frequently.

As far as the C# code, sure. I would like to see what I'm missing. I haven't actually picked a language yet, so I am not fixed on VB. -Merely just experimenting and trying to shake off the rust.

So far, the new exe? I tested it and it looks like its working very well. VAP is crashing on one of the computers, but that started before we started making changes. I thought it was a Videoredo error first. I'm posting that problem on a separate thread.

I do notice that some elements like season, Episode, channel, station and uid in the btv XML disappear if NPVR fails to provide an XML file. I'm going to contact NPVR's creator and look into why its not generating that XML file for some of the live recordings.
 
#64
Here is the code snippet:

Code:
                XmlWriterSettings settings = new XmlWriterSettings();
                settings.Indent = true;

                using (XmlWriter writer = XmlWriter.Create(path, settings))
                {
                    writer.WriteStartElement("episode-properties");

                    writer.WriteStartElement("property");
                    writer.WriteAttributeString("name", "EpisodeDescription");
                    writer.WriteValue(description);
                    writer.WriteEndElement();

                    writer.WriteStartElement("property");
                    writer.WriteAttributeString("name", "Title");
                    writer.WriteValue(title);
                    writer.WriteEndElement();

                    writer.WriteStartElement("property");
                    writer.WriteAttributeString("name", "DisplayTitle");
                    writer.WriteValue(displayTitle);
                    writer.WriteEndElement();

                    if (!String.IsNullOrEmpty(epTitle))
                    {
                        writer.WriteStartElement("property");
                        writer.WriteAttributeString("name", "EpisodeTitle");
                        writer.WriteValue(epTitle);
                        writer.WriteEndElement();
                    }

                    if (tfd.movieYear.Length > 0)
                    {
                        writer.WriteStartElement("property");
                        writer.WriteAttributeString("name", "MovieYear");
                        writer.WriteValue(tfd.movieYear);
                        writer.WriteEndElement();
                    }

                    if (!String.IsNullOrEmpty(oAirDate))
                    {
                        writer.WriteStartElement("property");
                        writer.WriteAttributeString("name", "OriginalAirDate");
                        writer.WriteValue(oAirDate);
                        writer.WriteEndElement();
                    }

                    writer.WriteStartElement("property");
                    writer.WriteAttributeString("name", "TargetStart");
                    writer.WriteValue(targetStart);
                    writer.WriteEndElement();

                    if (!String.IsNullOrEmpty(genre))
                    {
                        writer.WriteStartElement("property");
                        writer.WriteAttributeString("name", "Genre");
                        writer.WriteValue(genre);
                        writer.WriteEndElement();
                    }

                    if (!String.IsNullOrEmpty(callSign))
                    {
                        writer.WriteStartElement("property");
                        writer.WriteAttributeString("name", "StationCallSign");
                        writer.WriteValue(callSign);
                        writer.WriteEndElement();
                    }

                    if (!String.IsNullOrEmpty(channelNumber))
                    {
                        writer.WriteStartElement("property");
                        writer.WriteAttributeString("name", "Channel");
                        writer.WriteValue(channelNumber);
                        writer.WriteEndElement();
                    }

                    if (!String.IsNullOrEmpty(tfd.uid) )
                    {
                        writer.WriteStartElement("property");
                        writer.WriteAttributeString("name", "uid");
                        writer.WriteValue(tfd.uid);
                        writer.WriteEndElement();
                    }

                    if (!String.IsNullOrEmpty(tfd.recordingFileName))
                    {
                        writer.WriteStartElement("property");
                        writer.WriteAttributeString("name", "recordingFileName");
                        writer.WriteValue(tfd.recordingFileName);
                        writer.WriteEndElement();
                    }

                    if (!String.IsNullOrEmpty(tfd.seasonNumber))
                    {
                        writer.WriteStartElement("property");
                        writer.WriteAttributeString("name", "season");
                        writer.WriteValue(tfd.seasonNumber);
                        writer.WriteEndElement();
                    }

                    if (!String.IsNullOrEmpty(tfd.episodeNumber))
                    {
                        writer.WriteStartElement("property");
                        writer.WriteAttributeString("name", "episode");
                        writer.WriteValue(tfd.episodeNumber);
                        writer.WriteEndElement();
                    }


                    writer.WriteEndElement();
                    writer.Close();
 
#65
………. I do notice that some elements like season, Episode, channel, station and uid in the btv XML disappear if NPVR fails to provide an XML file. I'm going to contact NPVR's creator and look into why its not generating that XML file for some of the live recordings.
Could there be a delay between when a file finishes recording and the creation of the xml file? If so there is an option in VAP that should help. Look on the "Other" tab of the Advanced Configuration screen, "Delay time after detection before processing a file …"
 
#66
Thanks for the code sample. I see what I was missing.


Could there be a delay between when a file finishes recording and the creation of the xml file? If so there is an option in VAP that should help. Look on the "Other" tab of the Advanced Configuration screen, "Delay time after detection before processing a file …"
Possibly. I sent my log files to them. So we'll see what happens. The uid element is very important. Maybe if a source xml file is missing when VAP is processing or if the uid is missing in the source xml, we can have VAP just copy the "TargetStart" into the uid with a header "mis- ". So if the TargetStart displays 131677146000000000, then the uid can read "mis-131677146000000000". Basically having a backup, just in case.

Thank you. :)
 
#67
I asked about the TargetStart item in an earlier post and you replied it wasn't important. This item doesn't exist in the NPVR files so VAP could not "copy" it into the output xml file. Currently the value being output is a WAG based on one of two time parameters available to VAP. Should TargetStart be computed from the startTime element in the NPVR file? If so, the BTV definition (quoted in my earlier post) for TargetStart says it's a UTC time whereas the time format of startTime in the NPVR file indicates it is local time (no 'Z' at the end). -- thus it appears it should be converted from local to universal time. No problem to do that, just want you to be aware of the issues -- or tell me to ignore them.

Creating the "mis-#####" for uid when the NPVR uid is missing will be no problem once the proper formulation for TargetStart is agreed upon.
 
#68
I asked about the TargetStart item in an earlier post and you replied it wasn't important. This item doesn't exist in the NPVR files so VAP could not "copy" it into the output xml file. Currently the value being output is a WAG based on one of two time parameters available to VAP. Should TargetStart be computed from the startTime element in the NPVR file? If so, the BTV definition (quoted in my earlier post) for TargetStart says it's a UTC time whereas the time format of startTime in the NPVR file indicates it is local time (no 'Z' at the end). -- thus it appears it should be converted from local to universal time. No problem to do that, just want you to be aware of the issues -- or tell me to ignore them.

Creating the "mis-#####" for uid when the NPVR uid is missing will be no problem once the proper formulation for TargetStart is agreed upon.

Ugh! I see what you are talking about and I do see some conflict. I looked more carefully and I found "targetstart" was duplicated more often than I had hoped (now that I see how it works). My idea was to create a fake and temporary "uid" and then (somewhere down the road) have a custom app of my creation search out and replace the fake uid with the real one from a epg source and/or theTVDB. That's the idea behind the "mis-" so that parsing was simple. Would it be too much trouble to do something like "mis.(first 6 characters of the title).targetstart". We can use periods instead.
 
#69
So this fake uid still has a TargetStart (a number) as part of its makeup? Which leads me back to the question of how should VAP compute the TargetStart? (See post #67.) It's easy to create the fake uid you want once the TargetStart value is known.
 
#70
So this fake uid still has a TargetStart (a number) as part of its makeup? Which leads me back to the question of how should VAP compute the TargetStart? (See post #67.) It's easy to create the fake uid you want once the TargetStart value is known.
Sorry, I'm a little lost on the question. Doesn't the BTV xml already containing a completed targetstart tag element? I see it in every btv XML file VAP generates, whether NPVR provides a source XML or not.
 
#71
Sorry, I'm a little lost on the question. Doesn't the BTV xml already containing a completed targetstart tag element? I see it in every btv XML file VAP generates, whether NPVR provides a source XML or not.
Please refer to post #56 for the definition of what a BTV TargetStart element is supposed to be. I mentioned in another earlier post that what VAP is currently putting in that element is NOT that, rather just something put together from another time stamp available to VAP from other metadata sources.

Where could VAP get the intended start time for a video -- as is required per the BTV specification? I don't see where but if meeting the BTV spec exactly is not critical then perhaps VAP could use the (actual recording) startTime element contained in the NPVR file to compute TargetStart.
 
#72
Please refer to post #56 for the definition of what a BTV TargetStart element is supposed to be. I mentioned in another earlier post that what VAP is currently putting in that element is NOT that, rather just something put together from another time stamp available to VAP from other metadata sources.

Where could VAP get the intended start time for a video -- as is required per the BTV specification? I don't see where but if meeting the BTV spec exactly is not critical then perhaps VAP could use the (actual recording) startTime element contained in the NPVR file to compute TargetStart.


I see what you are saying. I'm not sure yet, but more than likely, how VAP is creating that "targetstart" is not critical.

Tell you what. Lets simplify things by taking a different approach and not using the "TargetStart." We'll make up our own naming convention that's easy.

How about we start with a "Mis.", then we take the first 6 characters from the "title" and then we add just the recording date and time to the end. No spaces allowed. No special characters allowed (outside of "." and "_". I believe VAP already converts "&" to "and").

So if we have: Animal Kingdom_20180821_21002201, we have the following code:

MIS.ANIMA.20180821_21002201


Oh, I keep forgeting to ask you if you could remove the date code from the "EpisodeTitle" element. Its not in the original. Thank you. :)
 
Last edited:
#73
I see what you are saying. I'm not sure yet, but more than likely, how VAP is creating that "targetstart" is not critical.

Tell you what. Lets simplify things by taking a different approach and not using the "TargetStart." We'll make up our own naming convention that's easy.

How about we start with a "Mis.", then we take the first 6 characters from the "title" and then we add just the recording date and time to the end. No spaces allowed. No special characters allowed (outside of "." and "_". I believe VAP already converts "&" to "and").

So if we have: Animal Kingdom_20180821_21002201, we have the following code:

MIS.ANIMA.20180821_21002201
You say "not using the TargetSTart" ?? What BTV element is the new naming convention going to go in then? And you don't want any TargetStart element in the BTV output at all?

Also you say no spaces allowed, but what if the first six chars of the title include a space? Or what if the title is less than six chars long?

Oh, I keep forgeting to ask you if you could remove the date code from the "EpisodeTitle" element. Its not in the original. Thank you. :)
What is "the original" ? I was following the example you provided in post #51:

<property name="EpisodeTitle">20180814 Hot Streak</property>

Are you saying that was incorrect and should have been just;

<property name="EpisodeTitle">Hot Streak</property>
 
Last edited:
#74
You say "not using the TargetSTart" ?? What BTV element is the new naming convention going to go in then? And you don't want any TargetStart element in the BTV output at all? Also you say no spaces allowed, but what if the first six chars of the title include a space? Or what if the title is less than six chars long?
Actually, I am going to put the brakes on this whole idea temporarily. I ran some tests and there are some unforeseen flaws. I'm going to work out this idea and provide you with a proper variety of NPVR XML materials. I'll have a complete solution for you tomorrow that should be simple.



What is "the original" ? I was following the example you provided in post #51:

<property name="EpisodeTitle">20180814 Hot Streak</property>

Are you saying that was incorrect and should have been just;

<property name="EpisodeTitle">Hot Streak</property>

When I established the examples in #51, I completely overlooked that the "EpisodeTitle" had included a date code. So that was my oversight. I kept seeing it pop up and I kept forgetting to mention it. So, yes, it should just be <property name="EpisodeTitle">Hot Streak</property>. In the original NPVR XML, there is no date code. So I assume this is part of the original BTV format.

I'll get back to you with a complete solution that should finalize these changes and a variety of sample NPVR XML files to test.
 
#75
Actually, for now, I am not going to make any new additions. However, if you could correct that "episode title" issue that I missed before, that would be great. That's the issue where the OAD date is appearing as a header in the "episode title"

original Example:

<property name="EpisodeTitle">20180830 Mario Lopez, Kathryn Hahn and BTS</property>


It should just be:


<property name="EpisodeTitle">Mario Lopez, Kathryn Hahn and BTS</property>


Thank you.
 
#76
Actually, for now, I am not going to make any new additions. However, if you could correct that "episode title" issue that I missed before, that would be great. That's the issue where the OAD date is appearing as a header in the "episode title"

original Example:

<property name="EpisodeTitle">20180830 Mario Lopez, Kathryn Hahn and BTS</property>


It should just be:


<property name="EpisodeTitle">Mario Lopez, Kathryn Hahn and BTS</property>


Thank you.
OK, done in new release Ver. 1.38
 
Top