TunerFreeMCE Plugin Creation
It is possible to produce a plugin for TunerFreeMCE to bring in content from any source. This allows new channels to be added, and allows programs to be cached and viewed for those channels. This document describes how to produce thos plugins, using a Sling.com plugin as an example
1. Create plugin directory
Each plugin will be delivered in it's own directory, so create an appropriatly names directory. In that directory you can place all of the files required for your plugin.
2. Create plugin definition file
The primary file that defines your plugin is an xml definition file called config.xml. Create that file in your plugin directory. The contents of the file are;
- Definition of the plugin
- A list of channels provided by the plugin
- Details of how to read the list of programs
- Details of how to play the program
3. Plugin definition
The root element of the plugin document is called TunerFreePlugin. It has the following attributes;
- name. This is the name of the plugin used to display to the user which plugins are installed
- provider. This is a code used to identify the provider of the content. It should only contain a-Z, 0-9 and _.
- version. This us a number that will be used for checking for new versions
- country, This should be an ISO country code. Used for VPD switching.
- programType. Can be FLASH or WMV or WMP for a flash video page, or a .wmv stream.
e.g.
<TunerFreePlugin name="Sling" version="1.0" country="US" provider="SLING" programType="FLASH">
</TunerFreePlugin>
4. Plugin channels
A child of the root element is channels. This element contains the definition of all of your channels in the channel element. The channel element has the following attributes;
- name. This is the display name of the channel
- code. This is the internal code used to identify the channel. It should start with the provider name, and only contain a-Z, 0-9 and _.
- logo. This is a url to the logo of the TV channel that will be used on the list of channels. This can be an http://, file:// or resx:// url, or can be a filename in the plugin directory. This will be displayed at a size 244x154
- smallLogo. Optional. This is a url to the logo of the TV channel that will be displayed next to the program name. This can be an http://, file:// or resx:// url, or can be a filename in the plugin directory. This will be displayed at a size 20x20. If this is not specified, the logo url will be used.
- background. Optional. This is a url to the background that will be shown when browing this channel. This can be an http://, file:// or resx:// url, or can be a filename in the plugin directory. If this is not specified, the default TunerFree logo will be used.
- feed. This is the url which the system should go to to get a list of programs for the channel.
e.g.
<TunerFreePlugin name="Sling" provider="SLING">
<channels>
<channel name="CBS" code="sling_cbs" smallLogo="http://betaimg1.sling.com/sli/images/dyn/network/15_clip_logo/rs/120/90/15_clip_logo.jpg?v=6" logo="http://betaimg1.sling.com/sli/images/dyn/network/15_clip_logo/rs/120/90/15_clip_logo.jpg?v=6" feed="http://beta.sling.com/network/15/CBS/videos.rss"/>
<channel name="NBC" code="sling_nbc" logo="http://betaimg0.sling.com/sli/images/dyn/network/74_clip_logo/rs/120/90/74_clip_logo.jpg?v=3" feed="http://beta.sling.com/network/74/NBC/videos.rss"/>
<channel name="Fox" code="sling_fox" logo="http://betaimg1.sling.com/sli/images/dyn/network/41_clip_logo/rs/120/90/41_clip_logo.jpg?v=4" feed="http://beta.sling.com/network/41/Fox/videos.rss"/>
<channel name="Marvel" code="sling_marvel" logo="http://betaimg3.sling.com/sli/images/dyn/network/302_clip_logo/rs/120/90/302_clip_logo.jpg?v=2" feed="http://beta.sling.com/network/302/Marvel/videos.rss" background="sling-background.jpg"/>
</channels>
</TunerFreePlugin>
5. Feed tags
For feeds that are well formatted xml (e.g. rss, atom), the contents of the feed are read by specifying the tag names for each attribute that we are interested in inside the parser section of the definition. Each of those tag names is specified in one of the following definition tags;
- programTag. This specifies the name of the program top level tag
- episodeTag. Optional. This is the tag in which the episode name is held
- programTitleTag. This is the tag in which the program name is held
- programDescriptionTag. Optional. This is the tag in which the program description is held
dateTag. Optional. This is the tag in which the broadcast date is held
- linkTag. This is the tag in which the link to the web page displaying the program is held
- programIdTag. This is the tag in which a unique identifier for the program is held. This is used to track which programs have been watched, so it can be any unique text
- programIconTag. Optional. This is the tag in which the program thumbnail icon is held
- namespace. Optional. If your xml requires namespaces to parse, specify each namespace in a tag with an attribute of name to specify the namespace, e.g. <namespace name="video">http://www.google.com/schemas/sitemap-video/1.1</namespace>. You can have as many namespace tags as required.
- channelPrefixTag. If your feed contains multiple channels in one XML file, you can specify which tag contains a channel name and prefix this to the code from the channel definition to create multiple channels from one stream. You can add dummy channels with empty feed strings to the channel list to specify channel icons for each prefixed channel.
If the value you need to get from the xml is the tag value (e.g. <id>123</id>, simply specify the tag name in the definition (e.g. <programIdTag>id</programIdTag>).
If the value you need is in an attribute of the tag (e.g. <id val="123"/>), specify the attribute name in the "attr" attribute of the definition (e.g. <programIdTag attr="val">id</programIdTag>).
If there are multiple nodes with the same name in the feed, you will need to pick one of them e.g.
<link rel="self" href="http://dj.rte.ie/vodfeeds/feedgenerator/videos/show/?id=1050152" /> <link rel="alternate" href="http://www.rte.ie/player/#v=1050152" />
you tell the system which one to pick by using the findAttr and findAttrVal attributes. findAttr is the name of the attribute to look for, and findAttrVal is the value in that attribute that needs to be matched (e.g. <linkTag attr="href" findAttr="rel" findAttrVal="alternate">link</linkTag>)
To read the date format, also specify a date mask in C# .NET format, e.g. <dateFormat>ddd, dd MMM yyyy HH:mm:ss</dateFormat>. Your date string may contain information that you don't want to parse at the end, e.g a timezone. To ignore that, simply don't specify the whole date format string - the date will be truncated to the length of the format string before parsing.
an example is;
<TunerFreePlugin name="Sling" version="1.0" country="US" provider="SLING" programType="FLASH">
<channels>
<channel name="CBS" code="sling_cbs" smallLogo="http://betaimg1.sling.com/sli/images/dyn/network/15_clip_logo/rs/120/90/15_clip_logo.jpg?v=6" logo="http://betaimg1.sling.com/sli/images/dyn/network/15_clip_logo/rs/120/90/15_clip_logo.jpg?v=6" feed="http://beta.sling.com/network/15/CBS/videos.rss"/>
<channel name="NBC" code="sling_nbc" logo="http://betaimg0.sling.com/sli/images/dyn/network/74_clip_logo/rs/120/90/74_clip_logo.jpg?v=3" feed="http://beta.sling.com/network/74/NBC/videos.rss"/>
<channel name="Fox" code="sling_fox" logo="http://betaimg1.sling.com/sli/images/dyn/network/41_clip_logo/rs/120/90/41_clip_logo.jpg?v=4" feed="http://beta.sling.com/network/41/Fox/videos.rss"/>
<channel name="Marvel" code="sling_marvel" logo="http://betaimg3.sling.com/sli/images/dyn/network/302_clip_logo/rs/120/90/302_clip_logo.jpg?v=2" feed="http://beta.sling.com/network/302/Marvel/videos.rss" background="sling-background.jpg"/>
</channels>
<parser>
<programTag>item</programTag>
<episodeTag>title</episodeTag>
<dateTag>pubDate</dateTag>
<dateFormat>ddd, dd MMM yyyy HH:mm:ss</dateFormat>
<linkTag attr="href" findAttr="rel" findAttrVal="alternate">link</linkTag>
<programIdTag>media:player</programIdTag>
<programTitleTag attr="url">media:title</programTitleTag>
<programDescriptionTag>media:description</programDescriptionTag>
<programIconTag attr="url">media:thumbnail</programIconTag>
</parser>
</TunerFreePlugin>
6. Feed parsing
For content that cannot easily be defined as an xml tag, you can define a start and end string to search for. The value will be taken as the content between the start and end tag, e.g. if we wanted to get the program name from the text "programName=Doctor Who,episodeName=.." then we would define
<programStart>programName=</programStart> <programEnd>,</programEnd>
If you need to search for multiple strings to find the exact position, i.e. find the first occurrence of string 2 after string 1. For example, when searching in the following "tag=programName,value=DoctorWho,tag=episodeName,value=..." you could specify the following;
<programStart>tag=programName</programStart> <programStart2>value=</programStart2> <programEnd>,</programEnd>
The tags that you can use for this are;
programStart titleStart episodeStart dateStart dateFormat linkStart programTitleStart programDescriptionStart programIconStart programIdStart
programEnd titleEnd episodeEnd dateEnd dateFormat linkEnd programTitleEnd programDescriptionEnd programIconEnd programIdEnd
programStart2 titleStart2 episodeStart2 dateStart2 dateFormat linkStart2 programTitleStart2 programDescriptionStart2 programIconStart2 programIdStart2
programEnd2 titleEnd2 episodeEnd2 dateEnd2 dateFormat linkEnd2 programTitleEnd2 programDescriptionEnd2 programIconEnd2 programIdEnd2
7. Click Points
For web page based video, the software will click on the appropriate points on the page to make the video play and go full screen. You need to tell the software where to click by giving the X and Y coordinates of a number of possible click points. You can include basic calculations using +, - and * and the constants H (screen height), H2 (half screen height), W (screen width) and W2 (half screen width). So, if the play button is 300 pixels to the left of the middle of the screen, specify it as "W2-300". If a click is not applicable, specify the coordinates as 0,0.
The tags are;
- StartPlay. This is the location to be clicked to start playback first time.
- PlayNonFS. Play when not in full screen
- RevNonFS. Jump to start when not in full screen
- FS. Go to full screen
- PlayFS. Play when in full screen
- RevFS, Jump to start when in full screen
- HighRes. Toggle high resolution/low resolution
e.g.
<clicks> <PlayNonFS x="W2-490" y="540"/> <StartPlay x="0" y="0"/> <RevNonFS x="0" y="0"/> <FS x="W2+120" y="540"/> <PlayFS x="W2-306" y="H*0.96"/> <RevFS x="0" y="0"/> <HighRes x="0" y="0"/> </clicks>
To calculate the click positions, I put media center in to full screen, navigate to a page and then take a screenshot. I then paste that in to Paint and use that to find the co-ordinates of points on the screen. When not in full screen, the Y positions tend to be a fixed number, and the X positions tend to be plus or minus a fixed amount from the middle of the screen. In full screen, the Y position tends to be a fraction of the screen height, and the X positions again tend to be plus or minus a fixed amount from the middle of the screen, but are sometimes a fraction of the screen width.
8. Authentication
Sometimes feeds need authentication, e.g. they need you to have logged in in your browser first. The cache builder can pick up a logged in session from your browser, but only if you add the site to your Trusted Sites in IE by going to the Security tab in Internet Options, clicking on Trusted Sites and then Sites, and adding the site to the list.
To allow authenticated access at the time of playing the video, be sure to add the site to the Sites list in the Privacy tab of the Internet Options.
9. Testing
To test your plugin, put it in the C:/ProgramData/MillieSoft/TunerFreeMCE/additional_plugins folder. This folder is used to pick up any plugins that are not installed directly via the plugins page in TunerFreeMCE.
After you have created your plugin, run TunerFreeMCECacheBuilder.exe to pick up your programs. If you run the code with a -debug flag, some additional information will be outputted that may help you if you are having problems.
10. Publishing
After you have created your plugin, email me at
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
to get your plugin added to the list of plugins shown within TunerFreeMCE

|
BBCi channel plug in