pyy + C# = pyysharp?

Advances in C#’s syntax almost allow for a rudimentary implementation of pyy to be created. Comparatively, it is much uglier, less useful, and more of a pain to program than its Python counterpart which is why I doubt a functional C# version will ever become a reality.

Are there any advantages to using something like pyy when ASP.NET is available? Writing simple (X)HTML elements becomes a battle with the syntax and the code readability is greatly ruined. Creating a simple header link turns into an abomination that resembles Objective-C except with curly braces and parenthesis:

new h1(new {id="header"}, new a(new {href="/home/"}, "Link Title"))

The property-initializer syntax was also considered but the tag attributes seem too disjointed from the actual object:

new h1(new a("Link Title") {href="/home/"}) {id="header"}

The pyy equivalent for both of these examples is:

h1(a("Link Title", href="/home/"), id="header")

Unless some niche is made evident for a full pyy port don’t expect any of this code to see the light of day beyond the simple HtmlTag base class via this Gist.

Continue reading » · Rating: · Written on: 07-25-09 · No Comments »

DXVA/Awesome Compliant Checker

Checking an encode for DXVA compliance or the much more strict Awesome compliance has involved checking the MediaInfo output for up to 16 different settings. While most encoders understand these settings, a lot of end-users and potential uploaders do not. It is for this reason that I have created a pyy-based web application which automatically parses MediaInfo outputs and checks all these rules.

You can find the working version of it running at http://awesome.jakewharton.com/. Simply paste the text output from MediaInfo of any media file which you wish to check against DXVA or Awesome rules and submit. It will show you a green box if it is compliant and a red box if it is not. It will also list all the settings which violate the rules at the bottom.

As with most of my projects, the source is available on GitHub here and any contribution is welcome.

Update: JSON and XML requests can now be served via http://awesome.jakewharton.com/json/ and http://awesome.jakewharton.com/xml/, respectively. The MediaInfo text should be POSTed in ‘mediainfo’ and include ‘is_animation’ to denote the encode is animated. You can view example responses here.

Continue reading » · Rating: · Written on: 07-11-09 · No Comments »

Python Import Trickery

The use of 3rd party packages (i.e. through git submodules) you might run into an instance where a package requires a library that is not installed. If you use a 3rd party hosting solution and cannot modify your main installation there is an easy trick to aid in making these missing libraries importable.
Continue reading…

Continue reading » · Rating: · Written on: 07-07-09 · 1 Comment »