BeyondTVLibrary
From Tallus LLC Wiki
Contents |
About
This is an update to DaWanderer's Beyond TV SDK addition for developers. This version requires Beyond TV 4.8 or later and .Net Framework 2.0 (it is not backward compatible).
All Beyond TV 4.81 web services classes have been implemented. Having these classes removes the necessity of adding web references and changing namespaces as shown in the SDK tutorials.
Helper classes for property bags and collection of property bags have been added.
Motivation
Starting with BTV 4.8, SnapStream introduced multiple security levels. Accordingly, the BTV API had to be modified to make use of those security levels, otherwise any BTV addons would always be executed with administrator rights. Practically, this means that the new logon method is:
PVSPropertyBag bag = BTVLicenseManager.Logon(networkLicense, username, password);
so you now need to provide a username (i.e. "" or "administrator"). It now returns a property bag with two properties, "UserID" and "AuthTicket". The "AuthTicket" property will be required by every web service calls after this, and it is used to identify your client's session.
bool isRenewed = BTVLicenseManager.RenewLogon(AuthTicket);
Sends a keep alive to the authentication manager. Resets the 15 minute timeout period for the given authorization ticket.
Changes to PropertyBagHelper
- In the previous version, the PropertyBagHelper inherited from ICollection, while this one inherits from a generic list of PVSProperty (List<PVSProperty>).
- Only one PropertyValue can be associated with one PropertyName (a few methods dealing with multiple values have been removed).
- When creating a "new PropertyBagHelper(PVSPropertyBag)", the PVSPropertyName with a blank PVSPropertyValue will not be added.
- When creating a "new PropertyBagHelper(PVSPropertyBag)", a renormalization is performed to use some more generic PVSPropertyName. SearchDisplayTitle and SeriesDisplayTitle are assigned to DisplayTitle, SeriesDescription and EpisodeDescription are assigned to Description, TargetDuration is assigned to Duration, TargetStart is assigned to Start, TMSChannel is assigned to Channel. A DisplayedChannelID is also added (if missing) when setting up a Channel. It makes it easier to perform operations on a PropertyBagHelper without having to consider which method produced it.
- There is one way to bypass the two previous points, use bagHelper.Add(PVSProperty), this will not renormalize the PVSPropertyName and will accept an empty PVSPropertyValue.
- IsOverLapping(bagHelper) compares the Start and Duration of both PropertyBagHelper to see if they overlap.
- GenericID() will return the EPGID with the last four digits set to 0. Generic episodes are actually showing up like that.
Added a SuperBags class
- This new class is a generic list of PropertyBagHelper (List<PropertyBagHelper>) with a few extra methods.
- ToPropertyBags() will convert an instance of that class, so you can feed it back as a parameter of a BTV API method.
- IndexOf() (and its overloads) makes it possible to find the Index of the PropertyBagHelper containing a specific PVSPropertyName, PVSPropertyValue pair. Special property names are recognized: GenericID will compare both GenericID, GenericID- will compare both Generic while skipping the first two characters (sometimes EP or SH can be used on the same series) and finally "FULL" will compare the EPGID, Start and UniqueChannelID (which should be enough to confirm you are dealing with the same show).
- Contains() is based on IndexOf() but will simply return a true or false value.
- Helper() is based on IndexOf() and will return the actual PropertyBagHelper of that match.
- ShowInConflict(bagHelper) will return the DisplayTitle of the first show with a positive IsOverLapping(bagHelper). You could use this, for example, to find out if it is safe to reboot the PC, by checking that no upcoming recordings are within the next 10 minutes...
- Sort(property, order {, IsANumber}) will sort the SuperBags for one property. When sorting by something like the channels, use IsANumber = true (otherwise just omit it).
- GetSortType() returns the current property and order used to sort the SuperBags.
- FromChannelXML(textXML) fills the SuperBags from a list of channels (i.e. from GetUserChannels).