Monday, December 28, 2009

Import and Lua Classes

New in 0.9.0.0, which will be released any day now, will include the new Import() function. Import() loads a script into the global space. I know what you're thinking: we already have LoadScript() and the "exec" prefix why on Earth do we need yet another way to load and execute scripts? Well I'll tell you why Jimmy: when you use LoadScript() or "exec" you change the internal script name into the script that was just loaded or executed. That's a good thing if you want to shift focus away from your script to another one but it's a bad thing if you do not. This is where Import() comes in, it does not change the internal script name so Get and SetScriptOption() behave as though your script made the call and not as the loaded script, which is a game changer. Adding Import() will also future proof us in the event that other such functions are added.

After adding this new function I went looking for some info on Lua Classes. Unfortunately I'm not the smartest bulb in tackle box and it all went straight over my head. But I did manage to come up with a simple Lua Class which can be seen by downloading libSearch. Hopefully others can find it useful as I'll be using it exclusively from now on when I add search.

Friday, December 25, 2009

Website forums

As I wait for my daughter to wake up on this Christmas morn I decided to add the ability for us to edit our posts on the forums. Merry Christmas!!! ;)

Monday, December 21, 2009

Debug notifications and complete Alias list

I've written a small console application that, if present in the plugins directory, will pop up and notify us that there was an error, and what the error contained. Probably useful for developers only and probably not that useful except that it'll save us time looking at the log. I added a function available from Lua to access the debug notifier DebuggerLog(string s);

Expect to find the application in the Dev Center once 0.9.0.0 comes out. Also speaking of the Dev Center I've updated the Lua Specific Functions file so it should be easier to browse, out with 0.9.0.0 as well.

Full List of Aliases

_guc() = GetURLCached()
_gu() = GetURL()
_gur() = GetURLxR()
_gux() = GetURLX()
_guxr() = GetURLXxR()
_sr() = str_replace()
_sp() = str_split()
_sf() = str_find()
_sfl() = str_findlast()
_se() = str_escape()
_su() = str_unescape()
_she() = str_html_encode()
_shd() = str_html_decode()
_sst() = str_strip_tags()
_sgb() = str_get_between()
_sgba() = str_get_between_a()
_st() = str_trim()
_vr() = VideoResource()
_vrx() = VideoResourceX()
_ar() = AudioResource()
_ir() = ImageResource()
_ct() = ConvertTime()
_vf() = VirtualFolder()
_dvf() = DynamicVirtualFolder()
_rx() = ResolveXML()
_srx() = SpecialResolveXML()
_v() = Version()
_l() = Log()
_dl() = DebuggerLog()
_sm() = ShowMsg()

Sunday, December 20, 2009

What are PlayOn Scripts?

PlayOn Scripts are plugins for the DLNA software PlayOn that add a large amount video content.

Friday, December 18, 2009

VideoResourceX

Table structure:
local vrTable = {
title = "Tile of Video",
path = "URL, Local Path, or code",
description = "Video Description",
thumbnail = "URL to image",
date = "11/22/2009 12:33:00 PM",
duration = ConvertTime("1:00:00"),
bitrate = 0,
resolution = "1920x1080",
genre = "Funny",
rating = "G",
index = 1;
}
VideoResourceX(vrTable);
All parameter's are optional and have a default value that will be supplied if any are missing. Mistyping the date will result in a error being logged but, if everything else is fine, it shouldn't cause the video to break.

Also I've added some short aliases for function names:
_l() = Log()

_vf() = VirtualFolder()
_dvf() = DynamicVirtualFolder()

_vr() = VideoResource()
_vrx() = VideoResourceX()
_ar() = AudioResource()
_ir() = ImageResource()

_ct() = ConvertTime()

_guc() = GetURLCached()
_gu() = GetURL()
_gux() = GetURLX()

Thursday, December 17, 2009

Thoughts

First up, the next update probably won't come out until after the holidays. I've gotten a request to expand VideoResource() and instead of stupidly trying to cram more xml into the description I'm just going to add a function called VideoResourceX() (which, by the way, I spent several agonizing hours thinking of the name). It'll look like this:

VideoResourceX(string title, string path, string description, string thumbnail, string datetime, long duration, int bitrate, string resolution, string genre, string rating, int sortIndex)

The new function will accept a table containing the data it needs.

VideoResourceX(table data)

I'm also probably going to add a FormatRTMP() function seeing as we do format the rtmp string a lot in our scripts. Keep an eye on the Dev Center for explanations for the new code.

There has been some confusion with the Script Options window, so I'm going to rework that to make it less confusing.

Finally, we're coming up to a 1.0.0.0 release which will be a milestone release. Hopefully it will also represent a feature freeze, where no more features will be added. After the 1.0 release future version will come out a lot more slowly as I'll be mainly focusing on bug fixes and code tweaks. I don't want the plugin getting any bigger and to be honest I feel as if it is very mature in its current state. I'm seeing some amazing stuff coming out and I'm seriously impressed in both the creativity shown by script writers and that I was able to make something so versatile.

Sunday, December 13, 2009

0.8.1.0

A new release went out, hereto called the hottamale release. It was basically a code push to allow hottamale to release some of his hard work for everyone to enjoy. I am glad to do and everyone should check out what he's been doing, it's pretty amazing stuff.

Friday, December 4, 2009

Version 0.8.0.0

Today's release is mainly a bug fix with code and performance improvements.

Notes:
Fixed a bug in deflate decompression
Fixed a bug where Lua errors weren't being reported
VideoRestartServer(); now uses the official video
Thanks to hottamale for his dilengence in getting GetURLX() to be as good as it is now, it's very powerful
GetURLX(); and GetURLXxR(); now accept a special header in the headerParse parameter: ExpectContinue<value>true|false

Get it now!

Monday, November 30, 2009

40k

Yesterday we passed 40,000 downloads (this is the last download count update I promise :)

It still amazes me that so many people want and use these scripts. We now have 52 scripts, most containing dynamic content. When I first got cable as a child we had about the same amount of channels. Of course now we have 100's if not 1000's of channels available to us and hopefully those cable channels will put their content on line so we can borrow it.

Thursday, November 26, 2009

30,000 Downloads, thanksgiving and ads

First I'd like to wish everyone a Happy Thanksgiving!

Second I'd like to point out that just 3 days ago we passed the 20k download mark. 10k downloads in 3 days is very impressive.

The last thing has to do with the Ads on the site. I'm not really making any amount of money on the ads, the revenue might pay for the hosting costs. If there is any cash left over I will try to send some giftcards out to the other Script Developers. Hopefully I'll receive a check before Christmas but it doesn't look good. We have far too many Firefox users coming to the site ;)

Tuesday, November 24, 2009

0.7.0.1

Had to push a quick bug fix, if you downloaded 0.7.0.0 earlier today please update to 0.7.0.1 to have the AutoRun scripts work.

Get it Here.

Thanks

Setting the Date of a VideoResource()

New in 0.7.0.0 is the ability to set the the date of a VideoResource. In retrospect this is something I should have included from day one but unfortunately I didn't see the potential. I want to thank hottamale from the site for requesting this and reminding me that it actually exists.

So in order to make this available and preserve backwards compatibility I had to come up with a work around and so I decided to add a special XML tag to the description to handle it (I'm claiming the <special> tag)


local dateXML = '<special date="1.0"><year>2009</year><month>11</month><day>11</day></special>';

VideoResource("test", "video.mp4", "This is before the special tag"..dateXML.."and this is after", "", 100000);


The plugin will extrapolate the Date information and remove the data from the description before it ever gets to the user's screen. Just keep in mind that the format is very strict and will attempt to catch and throw an error if malformed but if not properly set you could end up with ugly tags being sent to the user.

New Release

I decided to push the release of version 0.7.0.0 up a couple days, get it right now!

The update log:

0.7.0.0
Developers may now force a video type to PlayOn by including the tag <special force="wmv"> (for Windows Media Video) and <special force="flv"> (for Flash Video) in the video's url.
If autorun.lua is present in the Scripts directory, default loading is bypassed and autorun.lua is executed
Extended Lua with LoadScript();
Extended Lua with GetURLXxR();
Fixed a bug with SetScriptOption();
Added GetScriptOptionX(); and SetScriptOptionX(); which allows access to other scripts options (or create custom sections)
VideoResource(); now excepts a date, accessed by some xml data in the description var.
Extended Lua with GetVideoPerformanceLevel();

Monday, November 23, 2009

20,000 Downloads

We just destroyed 20k total downloads. I had no idea the Plugin, Scripts and site would effect so many people. Amazing stuff.

Sunday, November 22, 2009

LoadScript() and PlayOn contacted me

LoadScript
In my last post I recommended using the new LoadScript() function to load a script from our autorun scripts. I'd like to rescind that, I completely forgot about 'exec:'.

From our VirtualFolder() or VideoResource() calls we already have the ability to execute scripts within the Scripts\ directory. Something like:
VirtualFolder("Run Script", "exec:NBC.lua");
will work great in our autorun scripts.

I was going to remove LoadScript() altogether but I decided to leave it in, currently we could do something like:

local file = GetCurrentPath().."\\Scripts\\NBC.lua";
local contents = OpenFile(file);
RunScript(contents);

LoadScript() will make this easier

local file = GetCurrentPath().."\\Scripts\\NBC.lua";
LoadScript(file);

However, there is one caveat, LoadScript() and RunScript() will report itself to the plugin as though it is the executing script and not the executed script. What this means is that GetScriptOptions() and SetScriptOptions() will not work as expected. To have those functions behave properly they need to be ran with 'exec:' from within a VirtualFolder() or VideoResource() call.

edit: ignore the crossed off stuff, LoadScript() will properly identify itself as the correct script.

PlayOn Interaction
I just want to thanks the other script developers for making the plugin as awesome as it is. In fact it's impact is such that PlayOn has contacted me and asked me to make some specific changes which is cool :)

Saturday, November 21, 2009

More autorun

I just finished a autorun script that gets a list of scripts and their categories from PlayOnScripts.com and organizes the scripts on my server based on those categories. Pretty cool stuff.

On a side note I forgot to mention in the last post that nil LoadScript(string file) has been added so our autorun scripts can have the plugin load the script.

Friday, November 20, 2009

autorun.lua

I've been thinking lately about how to manage the growing number of scripts within the Scripts Plugin. I thought I could allow the developers to tag their scripts with categories or maybe use the categories from PlayOnScripts.com, but they both seemed cumbersome to implement. So I decided to allow the user to decide how to organize their scripts using....wait for it....it's coming....a Script.

Version 0.7.0.0 of the Scripts Plugin will check for the existence of autorun.lua and, if it exists, will execute the Script, bypassing the normal start up routine of loading the script's names from the Scripts\ folder. It opens the door for some interesting ways to organize our Scripts.

I haven't had a chance to write my own organizer yet but I do have some ideas brewing.

Thursday, November 19, 2009

Forcing Video Type

In the next version of the Scripts Plugin, v0.7.0.0, I've added the ability to force the Scripts Plugin to send videos to PlayOn based on what you submit and not what the Scripts Plugin thinks it is.

How it works now
Originally the Scripts Plugin checked for a file extension, if it was WMV then the video was set to Windows Media, everything else would be Flash. This proved flawed as server side parameters break this set up. As an example http://www.url.com/video.wmv?hashcode=ff7fa02b would be interpreted as a Flash video when it is a WMV. So instead of checking file extensions I changed it to simply check for the existence of .wmv and if it exists then it will set it as Windows Media. Still flawed however when you consider a url like this: http://www.url.com/video.wmv.flv the plugin assumes it is a WMV file which is incorrect.

Solution
Enter the <special> tag. So far the tag only excepts one parameter "force". By appending a url we send, to ResolveXML() or to the plugin directly from a VideoResource(), with the new tag we can explicitly tell the plugin the type, regardless of file extension. Using the example above we could do: http://www.url.com/video.wmv.flv<special force="flv"> The Scripts Plugin will now tell PlayOn that the video is a flash video regardless of any other factors. We could even tell PlayOn that the video with a .flv extension is to be decoded as Windows Media: http://www.url.com/video.wmv.flv<special force="wmv">

Version 0.7.0.0 will be released a short time after Thanksgiving.

Coming Soon

This will be where we can make announcements in the future